diff options
author | Philippe Waroquiers <philippe.waroquiers@skynet.be> | 2015-09-15 21:02:15 +0200 |
---|---|---|
committer | Philippe Waroquiers <philippe.waroquiers@skynet.be> | 2015-09-15 21:12:39 +0200 |
commit | 5382cfab6110741b8ba36965b30334c00d8f9409 (patch) | |
tree | 957171c8f248954789ffbd0ec8539e3bef008d48 /gdb/findvar.c | |
parent | e68fa6f07666ec4726cfef59f641a81244cc2e00 (diff) | |
download | gdb-5382cfab6110741b8ba36965b30334c00d8f9409.zip gdb-5382cfab6110741b8ba36965b30334c00d8f9409.tar.gz gdb-5382cfab6110741b8ba36965b30334c00d8f9409.tar.bz2 |
Fix PR/18564 - regression in showing __thread so extern variable
Ensure tls variable address is not relocated, as the msym addr
is an offset in the thread local storage of the shared library/object.
Diffstat (limited to 'gdb/findvar.c')
-rw-r--r-- | gdb/findvar.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/gdb/findvar.c b/gdb/findvar.c index 1c077f7..fd1b9d7 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -739,14 +739,17 @@ default_read_var_value (struct symbol *var, const struct block *var_block, if (msym == NULL) error (_("No global symbol \"%s\"."), SYMBOL_LINKAGE_NAME (var)); - if (overlay_debugging) - addr = symbol_overlayed_address (BMSYMBOL_VALUE_ADDRESS (lookup_data.result), - MSYMBOL_OBJ_SECTION (lookup_data.result.objfile, - msym)); - else - addr = BMSYMBOL_VALUE_ADDRESS (lookup_data.result); - obj_section = MSYMBOL_OBJ_SECTION (lookup_data.result.objfile, msym); + /* Relocate address, unless there is no section or the variable is + a TLS variable. */ + if (obj_section == NULL + || (obj_section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0) + addr = MSYMBOL_VALUE_RAW_ADDRESS (msym); + else + addr = BMSYMBOL_VALUE_ADDRESS (lookup_data.result); + if (overlay_debugging) + addr = symbol_overlayed_address (addr, obj_section); + /* Determine address of TLS variable. */ if (obj_section && (obj_section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0) addr = target_translate_tls_address (obj_section->objfile, addr); |