aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/dwarf2loc.c21
2 files changed, 26 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index bafae52..6aa90d9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2015-12-09 Kevin Buettner <kevinb@redhat.com>
+
+ * dwarf2loc.c (dwarf2_evaluate_loc_desc_full): Perform a pointer
+ to address conversion for DWARF_VALUE_MEMORY.
+
2015-12-09 Luis Machado <lgustavo@codesourcery.com>
* gdb/mi/mi-cmd-var.c (mi_parse_format): Handle new "zero-hexadecimal"
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index a8f5c91..b8e7fa0 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -2343,9 +2343,30 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
case DWARF_VALUE_MEMORY:
{
+ struct type *ptr_type;
CORE_ADDR address = dwarf_expr_fetch_address (ctx, 0);
int in_stack_memory = dwarf_expr_fetch_in_stack_memory (ctx, 0);
+ /* DW_OP_deref_size (and possibly other operations too) may
+ create a pointer instead of an address. Ideally, the
+ pointer to address conversion would be performed as part
+ of those operations, but the type of the object to
+ which the address refers is not known at the time of
+ the operation. Therefore, we do the conversion here
+ since the type is readily available. */
+
+ switch (TYPE_CODE (type))
+ {
+ case TYPE_CODE_FUNC:
+ case TYPE_CODE_METHOD:
+ ptr_type = builtin_type (ctx->gdbarch)->builtin_func_ptr;
+ break;
+ default:
+ ptr_type = builtin_type (ctx->gdbarch)->builtin_data_ptr;
+ break;
+ }
+ address = value_as_address (value_from_pointer (ptr_type, address));
+
do_cleanups (value_chain);
retval = value_at_lazy (type, address + byte_offset);
if (in_stack_memory)