Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2015-06-10 20:41:23 -0400
committerEugene Tarassov2015-06-10 20:41:23 -0400
commit849324997c0c434f3804f7fab42978bc82b78f60 (patch)
tree755fd84d364e29b669bdb4f278089e07df696a0b
parentac487f2e09f5a65ddf78a0aef2b74a1becfa9ac6 (diff)
downloadorg.eclipse.tcf.agent-849324997c0c434f3804f7fab42978bc82b78f60.tar.gz
org.eclipse.tcf.agent-849324997c0c434f3804f7fab42978bc82b78f60.tar.xz
org.eclipse.tcf.agent-849324997c0c434f3804f7fab42978bc82b78f60.zip
TCF Server: fixed handling of targets that don't define DWARF register number for PC
-rw-r--r--agent/tcf/framework/cpudefs.c3
-rw-r--r--agent/tcf/services/dwarfecomp.c8
-rw-r--r--server/tcf/services/context-proxy.c6
3 files changed, 8 insertions, 9 deletions
diff --git a/agent/tcf/framework/cpudefs.c b/agent/tcf/framework/cpudefs.c
index ef3d471a..cc94a467 100644
--- a/agent/tcf/framework/cpudefs.c
+++ b/agent/tcf/framework/cpudefs.c
@@ -478,6 +478,7 @@ LocationExpressionState * evaluate_location_expression(Context * ctx, StackFrame
void read_location_pieces(Context * ctx, StackFrame * frame,
LocationPiece * pieces, unsigned pieces_cnt, int big_endian,
void ** value, size_t * size) {
+ /* Note: 'big_endian' should match endianness of LocationPiece.value in 'pieces' */
uint8_t * bf = NULL;
size_t bf_size = 0;
unsigned bf_bits = 0;
@@ -529,7 +530,7 @@ void read_location_pieces(Context * ctx, StackFrame * frame,
if (context_read_mem(ctx, piece->addr, pbf, piece_size) < 0) exception(errno);
}
for (i = piece->bit_offs; i < piece->bit_offs + piece_bits; i++) {
- if (pbf[i / 8] & bit_mask(i)) bf[bf_offs / 8] |= bit_mask(bf_offs);
+ if (pbf[i / 8] & bit_mask(i)) bf[bf_offs / 8] |= bit_mask(bf_offs);
bf_offs++;
}
}
diff --git a/agent/tcf/services/dwarfecomp.c b/agent/tcf/services/dwarfecomp.c
index a3d5290c..f8e82da8 100644
--- a/agent/tcf/services/dwarfecomp.c
+++ b/agent/tcf/services/dwarfecomp.c
@@ -410,6 +410,8 @@ static U8_T get_frame_pc(void) {
static void add_expression_list(DWARFExpressionInfo * info, int fbreg, I8_T offs) {
int peer_version = 1;
Channel * c = cache_channel();
+ RegisterDefinition * pc = get_PC_definition(expr_ctx);
+
if (c != NULL) {
int i;
peer_version = 0;
@@ -419,7 +421,7 @@ static void add_expression_list(DWARFExpressionInfo * info, int fbreg, I8_T offs
}
}
- if (info->code_size > 0 && peer_version == 0) {
+ if (info->code_size > 0 && (peer_version == 0 || pc == NULL || pc->dwarf_id < 0)) {
/* The peer does not support OP_TCF_switch */
U8_T pc = get_frame_pc();
while (info != NULL && info->code_size > 0 && (info->code_addr > pc || pc - info->code_addr >= info->code_size)) {
@@ -434,10 +436,6 @@ static void add_expression_list(DWARFExpressionInfo * info, int fbreg, I8_T offs
}
else if (info->code_size > 0) {
size_t switch_pos;
- RegisterDefinition * pc = get_PC_definition(expr_ctx);
-
- if (pc == NULL || pc->dwarf_id < 0)
- str_exception(ERR_INV_DWARF, "Invalid PC register definition");
add(OP_bregx);
add_uleb128(pc->dwarf_id);
diff --git a/server/tcf/services/context-proxy.c b/server/tcf/services/context-proxy.c
index bb516b5e..a2383aea 100644
--- a/server/tcf/services/context-proxy.c
+++ b/server/tcf/services/context-proxy.c
@@ -1218,7 +1218,7 @@ static void validate_mid_frame_reg_values_cache(Channel * c, void * args, int er
json_read_binary_start(&state, &c->inp);
for (r = 0; r < n; r++) {
RegisterDefinition * reg = fc->reg_defs[r];
- if (reg->size > 0 && reg->dwarf_id >= 0) {
+ if (reg->size > 0 && (reg->dwarf_id >= 0 || reg->role != NULL)) {
size_t pos = 0;
uint8_t * data = fc->reg_data.data + reg->offset;
uint8_t * mask = fc->reg_data.mask + reg->offset;
@@ -1291,7 +1291,7 @@ int read_reg_bytes(StackFrame * frame, RegisterDefinition * reg_def, unsigned of
write_stream(&c->out, '[');
for (n = 0; n < fc->reg_cnt; n++) {
RegisterDefinition * reg = fc->reg_defs[n];
- if (reg->size > 0 && reg->dwarf_id >= 0) {
+ if (reg->size > 0 && (reg->dwarf_id >= 0 || reg->role != NULL)) {
const char * id = register2id(fc->ctx->ctx, frame->frame, reg);
if (n > 0) write_stream(&c->out, ',');
write_stream(&c->out, '[');
@@ -1320,7 +1320,7 @@ int read_reg_bytes(StackFrame * frame, RegisterDefinition * reg_def, unsigned of
uint8_t * m_addr = frame->regs->mask + reg_def->offset;
for (i = 0; i < size; i++) {
if (m_addr[offs + i] != 0xff) {
- errno = ERR_INV_CONTEXT;
+ set_fmt_errno(ERR_INV_CONTEXT, "Value of register %s is unknown in the selected frame", reg_def->name);
return -1;
}
}

Back to the top