Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2014-02-11 21:56:13 -0500
committerEugene Tarassov2014-02-11 21:56:13 -0500
commit5be368395c6e3baee25c49d6208a84ef76cdaf4c (patch)
treec78cba96c9884942ac1dccfeb9f275e264fde83a
parentbcafed3127d36ab053a000068f69dc85cf040658 (diff)
downloadorg.eclipse.tcf.agent-5be368395c6e3baee25c49d6208a84ef76cdaf4c.tar.gz
org.eclipse.tcf.agent-5be368395c6e3baee25c49d6208a84ef76cdaf4c.tar.xz
org.eclipse.tcf.agent-5be368395c6e3baee25c49d6208a84ef76cdaf4c.zip
TCF Agent: fixed: get_symbol_address() fails for an ELF symbol that is defined at the end of a section
-rw-r--r--agent/tcf/services/symbols_elf.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/agent/tcf/services/symbols_elf.c b/agent/tcf/services/symbols_elf.c
index e497c33d..42a73bfc 100644
--- a/agent/tcf/services/symbols_elf.c
+++ b/agent/tcf/services/symbols_elf.c
@@ -253,9 +253,17 @@ int elf_symbol_address(Context * ctx, ELF_SymbolInfo * info, ContextAddress * ad
set_errno(ERR_OTHER, "Cannot get address of ELF symbol: the symbol is a common block");
return -1;
}
- if (file->type == ET_REL && info->section != NULL) {
- sec = info->section;
- value += sec->addr;
+ if (info->section != NULL) {
+ if (file->type == ET_REL) {
+ sec = info->section;
+ value += sec->addr;
+ }
+ if (info->section->size > 0 && info->value == info->section->addr + info->section->size) {
+ *address = elf_map_to_run_time_address(ctx, file, sec, (ContextAddress)value - 1);
+ if (errno) return -1;
+ *address += 1;
+ return 0;
+ }
}
*address = elf_map_to_run_time_address(ctx, file, sec, (ContextAddress)value);
return errno ? -1 : 0;

Back to the top