From 8a9b8146fd539229c51c6a4e5a4f682df2a630b0 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 12 May 2011 17:40:55 +0000 Subject: gdb PR gdb/12617: * value.h (value_from_contents): Declare. * value.c (value_from_contents): New function. * dwarf2read.c (dwarf_stack_op_name): Add new values. (dwarf2_get_die_type): New function. * dwarf2loc.c (dwarf_expr_get_base_type): New function. (allocate_piece_closure): Acquire reference to values. (read_pieced_value): Update for value-based expressions. (write_pieced_value): Likewise. (free_pieced_value_closure): Call value_free as needed. (dwarf2_evaluate_loc_desc_full): Set get_base_type field. Update for value-based expressions. * dwarf2loc.h (dwarf2_get_die_type): Declare. * dwarf2expr.h (struct dwarf_stack_value) : Change type. : New field. (struct dwarf_expr_piece) : Change type. : New field. (struct dwarf_expr_context) : New field. (dwarf_expr_piece, dwarf_expr_fetch): Update. (dwarf_expr_pop, dwarf_expr_push): Remove. (dwarf_expr_push_address): Declare. * dwarf2expr.c (dwarf_arch_cookie): New global. (struct dwarf_gdbarch_types): New. (dwarf_gdbarch_types_init, dwarf_expr_address_type): New functions. (dwarf_expr_push): Change type of 'value' argument. Update. Now static. (dwarf_expr_push_address): New function. (dwarf_expr_pop): Now static. (dwarf_expr_fetch): Change return type. (dwarf_require_integral): New function. (dwarf_expr_fetch): Simplify. (add_piece): Update. (base_types_equal_p, dwarf_get_base_type, get_unsigned_type): New functions. (execute_stack_op) : Remove. Use values for DWARF stack. : New cases. (_initialize_dwarf2expr): New function. (add_piece): Update. (new_dwarf_expr_context): Set new field. (free_dwarf_expr_context): Call value_free_to_mark. * dwarf2-frame.c (no_base_type): New function. (execute_stack_op): Set get_base_type field. Update. gdb/testsuite * gdb.dwarf2/typeddwarf.S: New file. * gdb.dwarf2/typeddwarf.c: New file. * gdb.dwarf2/typeddwarf.exp: New file. --- gdb/dwarf2-frame.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'gdb/dwarf2-frame.c') diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c index e78c328..4e4e6d9 100644 --- a/gdb/dwarf2-frame.c +++ b/gdb/dwarf2-frame.c @@ -353,6 +353,14 @@ no_dwarf_call (struct dwarf_expr_context *ctx, size_t die_offset) _("Support for DW_OP_call* is invalid in CFI")); } +/* Helper function for execute_stack_op. */ + +static struct type * +no_base_type (struct dwarf_expr_context *ctx, size_t die) +{ + error (_("Support for typed DWARF is not supported in CFI")); +} + /* Execute the required actions for both the DW_CFA_restore and DW_CFA_restore_extended instructions. */ static void @@ -406,14 +414,15 @@ execute_stack_op (const gdb_byte *exp, ULONGEST len, int addr_size, ctx->get_frame_pc = no_get_frame_pc; ctx->get_tls_address = no_get_tls_address; ctx->dwarf_call = no_dwarf_call; + ctx->get_base_type = no_base_type; - dwarf_expr_push (ctx, initial, initial_in_stack_memory); + dwarf_expr_push_address (ctx, initial, initial_in_stack_memory); dwarf_expr_eval (ctx, exp, len); if (ctx->location == DWARF_VALUE_MEMORY) result = dwarf_expr_fetch_address (ctx, 0); else if (ctx->location == DWARF_VALUE_REGISTER) - result = read_reg (this_frame, dwarf_expr_fetch (ctx, 0)); + result = read_reg (this_frame, value_as_long (dwarf_expr_fetch (ctx, 0))); else { /* This is actually invalid DWARF, but if we ever do run across -- cgit v1.1