aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2loc.c
diff options
context:
space:
mode:
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>2003-07-22 15:41:59 +0000
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>2003-07-22 15:41:59 +0000
commitc3228f12381fe247c089a315455beced163f88e0 (patch)
treeb99844b4d7586619066e3d0b5182e567fdc4ee8a /gdb/dwarf2loc.c
parentb41b1f95b76030c2f695d94485afab9212a20a06 (diff)
downloadgdb-c3228f12381fe247c089a315455beced163f88e0.zip
gdb-c3228f12381fe247c089a315455beced163f88e0.tar.gz
gdb-c3228f12381fe247c089a315455beced163f88e0.tar.bz2
2003-07-22 Elena Zannoni <ezannoni@redhat.com>
* findvar.c (read_var_value): Remove case for thread local storage variables. It is now entirely handled by the dwarf2 location expression code. * printcmd.c (address_info): Ditto. * symtab.h (address_class): Remove LOC_THREAD_LOCAL_STATIC enumeration value. (struct symbol): Remove objfile field, which was used by LOC_THREAD_LOCAL_STATIC only. * dwarf2read.c (decode_locdesc): Remove is_thread_local variable. * dwarf2loc.h (struct dwarf2_loclist_baton): Add comment about usage of objfile pointer. * dwarf2loc.c (locexpr_describe_location): Add case to handle thread local variables. Add include of objfiles.h. * dwarf2expr.c (execute_stack_op): Add comments about thread local storage variables. * Makefile.in (dwarf2loc.o): Update dependencies.
Diffstat (limited to 'gdb/dwarf2loc.c')
-rw-r--r--gdb/dwarf2loc.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 9ed6b7e..01a2dda 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -29,6 +29,7 @@
#include "ax.h"
#include "ax-gdb.h"
#include "regcache.h"
+#include "objfiles.h"
#include "elf/dwarf2.h"
#include "dwarf2expr.h"
@@ -185,6 +186,8 @@ dwarf_expr_tls_address (void *baton, CORE_ADDR offset)
addr = target_get_thread_local_address (inferior_ptid,
debaton->objfile,
offset);
+ /* It wouldn't be wrong here to try a gdbarch method, too; finding
+ TLS is an ABI-specific thing. But we don't do that yet. */
else
error ("Cannot find thread-local variables on this target");
@@ -406,6 +409,34 @@ locexpr_describe_location (struct symbol *symbol, struct ui_file *stream)
return 1;
}
+ /* The location expression for a TLS variable looks like this (on a
+ 64-bit LE machine):
+
+ DW_AT_location : 10 byte block: 3 4 0 0 0 0 0 0 0 e0
+ (DW_OP_addr: 4; DW_OP_GNU_push_tls_address)
+
+ 0x3 is the encoding for DW_OP_addr, which has an operand as long
+ as the size of an address on the target machine (here is 8
+ bytes). 0xe0 is the encoding for DW_OP_GNU_push_tls_address.
+ The operand represents the offset at which the variable is within
+ the thread local storage. */
+
+ if (dlbaton->size > 1
+ && dlbaton->data[dlbaton->size - 1] == DW_OP_GNU_push_tls_address)
+ if (dlbaton->data[0] == DW_OP_addr)
+ {
+ int bytes_read;
+ CORE_ADDR offset = dwarf2_read_address (&dlbaton->data[1],
+ &dlbaton->data[dlbaton->size - 2],
+ &bytes_read);
+ fprintf_filtered (stream,
+ "a thread-local variable at offset %s in the"
+ "thread-local storage for `%s'",
+ paddr_nz (offset), dlbaton->objfile->name);
+ return 1;
+ }
+
+
fprintf_filtered (stream,
"a variable with complex or multiple locations (DWARF2)");
return 1;