aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2loc.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2010-06-07 19:55:33 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2010-06-07 19:55:33 +0000
commit5c631832c12b23cae13bde49a3d393e8bf94f599 (patch)
tree98209d93e18f835b6343c45693d1dc75fc882afe /gdb/dwarf2loc.c
parent17ea53c331199c560a28089d4c5757caa1517d33 (diff)
downloadgdb-5c631832c12b23cae13bde49a3d393e8bf94f599.zip
gdb-5c631832c12b23cae13bde49a3d393e8bf94f599.tar.gz
gdb-5c631832c12b23cae13bde49a3d393e8bf94f599.tar.bz2
gdb/
Fix PR 10640. * dwarf2-frame.c (no_dwarf_call): New function. (execute_stack_op): Set CTX->DWARF_CALL. * dwarf2expr.c (execute_stack_op) <DW_OP_call2, DW_OP_call4>: New. * dwarf2expr.h (struct dwarf_expr_context) <dwarf_call>: New. (struct dwarf_expr_context) <get_subr>: Remove the #if0-ed field. * dwarf2loc.c (per_cu_dwarf_call, dwarf_expr_dwarf_call): New functions. (dwarf2_evaluate_loc_desc): Initialize CTX->DWARF_CALL. (needs_frame_dwarf_call): New function. (dwarf2_loc_desc_needs_frame): Initialize CTX->DWARF_CALL. * dwarf2read.c (follow_die_offset): Based on former follow_die_ref. Update the comment. Move variables die, offset and error call to ... (follow_die_ref): ... a new function. (dwarf2_fetch_die_location_block): New function. * dwarf2loc.h (dwarf2_fetch_die_location_block): New prototype. gdb/testsuite/ Test PR 10640. * gdb.dwarf2/dw2-op-call.exp, gdb.dwarf2/dw2-op-call.S: New.
Diffstat (limited to 'gdb/dwarf2loc.c')
-rw-r--r--gdb/dwarf2loc.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 9864c46..8a9a346 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -232,6 +232,33 @@ dwarf_expr_tls_address (void *baton, CORE_ADDR offset)
return target_translate_tls_address (objfile, offset);
}
+/* Call DWARF subroutine from DW_AT_location of DIE at DIE_OFFSET in current CU
+ (as is PER_CU). State of the CTX is not affected by the call and return. */
+
+static void
+per_cu_dwarf_call (struct dwarf_expr_context *ctx, size_t die_offset,
+ struct dwarf2_per_cu_data *per_cu)
+{
+ struct dwarf2_locexpr_baton block;
+
+ block = dwarf2_fetch_die_location_block (die_offset, per_cu);
+
+ /* DW_OP_call_ref is currently not supported. */
+ gdb_assert (block.per_cu == per_cu);
+
+ dwarf_expr_eval (ctx, block.data, block.size);
+}
+
+/* Helper interface of per_cu_dwarf_call for dwarf2_evaluate_loc_desc. */
+
+static void
+dwarf_expr_dwarf_call (struct dwarf_expr_context *ctx, size_t die_offset)
+{
+ struct dwarf_expr_baton *debaton = ctx->baton;
+
+ return per_cu_dwarf_call (ctx, die_offset, debaton->per_cu);
+}
+
struct piece_closure
{
/* Reference count. */
@@ -815,6 +842,7 @@ dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame,
ctx->get_frame_base = dwarf_expr_frame_base;
ctx->get_frame_cfa = dwarf_expr_frame_cfa;
ctx->get_tls_address = dwarf_expr_tls_address;
+ ctx->dwarf_call = dwarf_expr_dwarf_call;
dwarf_expr_eval (ctx, data, size);
if (ctx->num_pieces > 0)
@@ -962,6 +990,16 @@ needs_frame_tls_address (void *baton, CORE_ADDR offset)
return 1;
}
+/* Helper interface of per_cu_dwarf_call for dwarf2_loc_desc_needs_frame. */
+
+static void
+needs_frame_dwarf_call (struct dwarf_expr_context *ctx, size_t die_offset)
+{
+ struct needs_frame_baton *nf_baton = ctx->baton;
+
+ return per_cu_dwarf_call (ctx, die_offset, nf_baton->per_cu);
+}
+
/* Return non-zero iff the location expression at DATA (length SIZE)
requires a frame to evaluate. */
@@ -988,6 +1026,7 @@ dwarf2_loc_desc_needs_frame (const gdb_byte *data, unsigned short size,
ctx->get_frame_base = needs_frame_frame_base;
ctx->get_frame_cfa = needs_frame_frame_cfa;
ctx->get_tls_address = needs_frame_tls_address;
+ ctx->dwarf_call = needs_frame_dwarf_call;
dwarf_expr_eval (ctx, data, size);