summaryrefslogtreecommitdiff
path: root/gdb/findvar.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2008-12-02 14:50:59 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2008-12-02 14:50:59 +0000
commitff9d520b9dd390a2a8c2ac68a2f6b76a967ffe74 (patch)
treed13556ae3125d1858c4a019121597a2932cad814 /gdb/findvar.c
parent541fb9b0c146bd8554229ac226f06217d9365980 (diff)
downloadgdb-ff9d520b9dd390a2a8c2ac68a2f6b76a967ffe74.tar.gz
gdb/
Fix resolving external references to TLS variables. * findvar.c: Include `objfiles.h'. (read_var_value <LOC_UNRESOLVED>): New variable `obj_section'. Handle SEC_THREAD_LOCAL variables. * printcmd.c (address_info <LOC_UNRESOLVED>): Handle SEC_THREAD_LOCAL variables. gdb/testsuite/ Test resolving external references to TLS variables. * gdb.threads/tls.exp: New tests to examine A_THREAD_LOCAL and FILE2_THREAD_LOCAL. (testfile2, srcfile2): New variables. * gdb.threads/tls.c (file2_thread_local) (function_referencing_file2_thread_local): New. * gdb.threads/tls2.c: New file.
Diffstat (limited to 'gdb/findvar.c')
-rw-r--r--gdb/findvar.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 4796721f4fa..f7b6e63d449 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -34,6 +34,7 @@
#include "regcache.h"
#include "user-regs.h"
#include "block.h"
+#include "objfiles.h"
/* Basic byte-swapping routines. GDB has needed these for a long time...
All extract a target-format integer at ADDR which is LEN bytes long. */
@@ -536,6 +537,7 @@ read_var_value (struct symbol *var, struct frame_info *frame)
case LOC_UNRESOLVED:
{
struct minimal_symbol *msym;
+ struct obj_section *obj_section;
msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (var), NULL, NULL);
if (msym == NULL)
@@ -545,6 +547,11 @@ read_var_value (struct symbol *var, struct frame_info *frame)
SYMBOL_OBJ_SECTION (msym));
else
addr = SYMBOL_VALUE_ADDRESS (msym);
+
+ obj_section = SYMBOL_OBJ_SECTION (msym);
+ if (obj_section
+ && (obj_section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0)
+ addr = target_translate_tls_address (obj_section->objfile, addr);
}
break;