Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2017-02-24 01:27:32 -0500
committerEugene Tarassov2017-02-24 01:27:32 -0500
commit60889eedb5f354e6a263a5d6bdd19594c4614741 (patch)
treedddb2b8dd46836549d705cd63a3ae50bb56929c5
parent3d10a86f1c82d56ebd9ed9e0a939ab3473c4dad5 (diff)
downloadorg.eclipse.tcf.agent-60889eedb5f354e6a263a5d6bdd19594c4614741.tar.gz
org.eclipse.tcf.agent-60889eedb5f354e6a263a5d6bdd19594c4614741.tar.xz
org.eclipse.tcf.agent-60889eedb5f354e6a263a5d6bdd19594c4614741.zip
Bug 512340 - object2symbol doesn't handle TAG_label, which cause fail to the getting function which defined in assemble file
Fixed symbols server use case
-rw-r--r--agent/tcf/services/symbols_elf.c45
-rw-r--r--tests/test-dwarf/tcf/backend/backend.c26
2 files changed, 58 insertions, 13 deletions
diff --git a/agent/tcf/services/symbols_elf.c b/agent/tcf/services/symbols_elf.c
index f73434d4..e520f5a9 100644
--- a/agent/tcf/services/symbols_elf.c
+++ b/agent/tcf/services/symbols_elf.c
@@ -2123,16 +2123,16 @@ const char * symbol2id(const Symbol * sym) {
tmp_app_hex('.', ref_id);
}
}
- if (tbl_index) {
- tmp_app_hex('-', tbl_index);
- }
+ if (sym->has_address) tmp_app_hex('$', sym->address);
+ if (sym->assembly_function) tmp_app_hex('#', sym->size);
+ if (tbl_index) tmp_app_hex('-', tbl_index);
if (frame != STACK_TOP_FRAME) {
assert(frame + 3 >= 0);
tmp_app_hex('+', frame + 3);
}
- tmp_app_hex('.', sym->index);
- tmp_app_hex('.', sym->dimension);
- tmp_app_hex('.', sym->cardinal);
+ if (sym->index) tmp_app_hex('=', sym->index);
+ if (sym->dimension) tmp_app_hex('!', sym->dimension);
+ if (sym->cardinal) tmp_app_hex('/', sym->cardinal);
tmp_app_str('.', sym->ctx->id);
}
tmp_buf[tmp_len++] = 0;
@@ -2218,6 +2218,16 @@ int id2symbol(const char * id, Symbol ** res) {
p++;
ref = obj;
}
+ if (*p == '$') {
+ p++;
+ sym->has_address = 1;
+ sym->address = (ContextAddress)read_hex(&p);
+ }
+ if (*p == '#') {
+ p++;
+ sym->assembly_function = 1;
+ sym->size = (ContextAddress)read_hex(&p);
+ }
if (*p == '-') {
p++;
tbl_index = (unsigned)read_hex(&p);
@@ -2226,13 +2236,22 @@ int id2symbol(const char * id, Symbol ** res) {
p++;
sym->frame = (int)read_hex(&p) - 3;
}
- if (*p == '.') p++;
- sym->index = (unsigned)read_hex(&p);
- if (*p == '.') p++;
- sym->dimension = (unsigned)read_hex(&p);
- if (*p == '.') p++;
- sym->cardinal = (unsigned)read_hex(&p);
- if (*p == '.') p++;
+ if (*p == '=') {
+ p++;
+ sym->index = (unsigned)read_hex(&p);
+ }
+ if (*p == '!') {
+ p++;
+ sym->dimension = (unsigned)read_hex(&p);
+ }
+ if (*p == '/') {
+ p++;
+ sym->cardinal = (unsigned)read_hex(&p);
+ }
+ if (*p++ != '.') {
+ errno = ERR_INV_CONTEXT;
+ return -1;
+ }
sym->ctx = id2ctx(p);
if (sym->ctx == NULL) {
errno = ERR_INV_CONTEXT;
diff --git a/tests/test-dwarf/tcf/backend/backend.c b/tests/test-dwarf/tcf/backend/backend.c
index f0d69000..20b6a8fd 100644
--- a/tests/test-dwarf/tcf/backend/backend.c
+++ b/tests/test-dwarf/tcf/backend/backend.c
@@ -805,6 +805,9 @@ static void loc_var_func(void * args, Symbol * sym) {
RegisterDefinition * reg = NULL;
ContextAddress addr = 0;
ContextAddress size = 0;
+ ContextAddress addr_proxy = 0;
+ ContextAddress size_proxy = 0;
+ Symbol * sym_proxy = NULL;
int addr_ok = 0;
int size_ok = 0;
SYM_FLAGS flags = 0;
@@ -829,6 +832,13 @@ static void loc_var_func(void * args, Symbol * sym) {
Symbol * sym_container = NULL;
int out_of_body = 0;
+ if (id2symbol(symbol2id(sym), &sym_proxy) < 0) {
+ error_sym("id2symbol", sym);
+ }
+ if (symcmp(sym, sym_proxy) != 0) {
+ errno = ERR_OTHER;
+ error("Invalid result of id2symbol()");
+ }
if (get_symbol_class(sym, &symbol_class) < 0) {
error_sym("get_symbol_class", sym);
}
@@ -1061,6 +1071,22 @@ static void loc_var_func(void * args, Symbol * sym) {
}
size_ok = 0;
}
+ if (get_symbol_address(sym_proxy, &addr_proxy) < 0) {
+ if (addr_ok) error_sym("get_symbol_address", sym_proxy);
+ }
+ else {
+ errno = ERR_OTHER;
+ if (!addr_ok) error_sym("get_symbol_address", sym_proxy);
+ if (addr != addr_proxy) error_sym("get_symbol_address", sym_proxy);
+ }
+ if (get_symbol_size(sym_proxy, &size_proxy) < 0) {
+ if (size_ok) error_sym("get_symbol_size", sym_proxy);
+ }
+ else {
+ errno = ERR_OTHER;
+ if (!size_ok) error_sym("get_symbol_size", sym_proxy);
+ if (size != size_proxy) error_sym("get_symbol_size", sym_proxy);
+ }
if (cpp_ref) {
Symbol * base_type = NULL;
ref_size_ok = 1;

Back to the top