summaryrefslogtreecommitdiff
path: root/gdb/dwarf2loc.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2016-08-22 16:56:52 -0600
committerTom Tromey <tom@tromey.com>2016-09-02 11:33:00 -0600
commit4aa4e28bdcf5f0d733def62b542fea11d5f219d5 (patch)
tree3a5f878a8dd275ea370cf6e8172f8ed7f92accd1 /gdb/dwarf2loc.c
parent1b2d85b255f11d0fce6c323f9e113673445c961a (diff)
downloadbinutils-gdb-4aa4e28bdcf5f0d733def62b542fea11d5f219d5.tar.gz
Handle DW_OP_form_tls_address
Currently gdb supports DW_OP_GNU_push_tls_address, but not DW_OP_form_tls_address. I think it would be better if the toolchain as a whole moved to using the standard opcode, and the prerequisite to this is getting gdb to recognize it. GCC can sometimes emit DW_OP_form_tls_address for emultls targets. As far as I know, nobody has ever tried this with gdb (since it wouldn't work at all). I don't think there's a major drawback to using a single opcode for all targets, because computing the location of a thread-local is already target specific. This is PR gdb/11616. I don't know how to write a test case for this; though it's worth noting that there aren't explicit tests for DW_OP_GNU_push_tls_address either -- and if I change GCC, these paths will be tested to the same extent they are now. 2016-09-02 Tom Tromey <tom@tromey.com> PR gdb/11616: * dwarf2read.c (decode_locdesc): Handle DW_OP_form_tls_address. * dwarf2loc.c (dwarf2_compile_expr_to_ax): Handle DW_OP_form_tls_address. (locexpr_describe_location_piece): Likewise. * dwarf2expr.h (struct dwarf_expr_context_funcs): Update comment. * dwarf2expr.c (execute_stack_op): Handle DW_OP_form_tls_address. (ctx_no_get_tls_address): Mention DW_OP_form_tls_address. * compile/compile-loc2c.c (struct insn_info): Update comment. (compute_stack_depth_worker): Handle DW_OP_form_tls_address.
Diffstat (limited to 'gdb/dwarf2loc.c')
-rw-r--r--gdb/dwarf2loc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index e60475fecc4..946ddf8b6e9 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -3571,6 +3571,7 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
break;
case DW_OP_GNU_push_tls_address:
+ case DW_OP_form_tls_address:
unimplemented (op);
break;
@@ -3907,7 +3908,8 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream,
&& (data[0] == DW_OP_addr
|| (addr_size == 4 && data[0] == DW_OP_const4u)
|| (addr_size == 8 && data[0] == DW_OP_const8u))
- && data[1 + addr_size] == DW_OP_GNU_push_tls_address
+ && (data[1 + addr_size] == DW_OP_GNU_push_tls_address
+ || data[1 + addr_size] == DW_OP_form_tls_address)
&& piece_end_p (data + 2 + addr_size, end))
{
ULONGEST offset;
@@ -3930,7 +3932,8 @@ locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream,
&& data + 1 + (leb128_size = skip_leb128 (data + 1, end)) < end
&& data[0] == DW_OP_GNU_const_index
&& leb128_size > 0
- && data[1 + leb128_size] == DW_OP_GNU_push_tls_address
+ && (data[1 + leb128_size] == DW_OP_GNU_push_tls_address
+ || data[1 + leb128_size] == DW_OP_form_tls_address)
&& piece_end_p (data + 2 + leb128_size, end))
{
uint64_t offset;