summaryrefslogtreecommitdiff
path: root/gdb/dwarf2expr.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2011-06-03 17:42:21 +0000
committerJoel Brobecker <brobecker@gnat.com>2011-06-03 17:42:21 +0000
commite24bf762cbfd8331e9bb8b0f9ea8c6fadcd4b7b5 (patch)
tree53d13a9669317de1d88bb05c0e710c31a16dd3d9 /gdb/dwarf2expr.c
parent79e212f34bcbc348aa1a8499d792164b179415d3 (diff)
downloadgdb-e24bf762cbfd8331e9bb8b0f9ea8c6fadcd4b7b5.tar.gz
address size can be different from DW_OP_deref size
gdb/ChangeLog: * dwarf2expr.c (execute_stack_op) [DW_OP_deref]: Handle the case where ADDR_SIZE is different from TYPE_LENGTH (type).
Diffstat (limited to 'gdb/dwarf2expr.c')
-rw-r--r--gdb/dwarf2expr.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c
index 3c60b6ab1b4..e1ddc963e8d 100644
--- a/gdb/dwarf2expr.c
+++ b/gdb/dwarf2expr.c
@@ -877,6 +877,19 @@ execute_stack_op (struct dwarf_expr_context *ctx,
type = address_type;
(ctx->read_mem) (ctx->baton, buf, addr, addr_size);
+
+ /* If the size of the object read from memory is different
+ from the type length, we need to zero-extend it. */
+ if (TYPE_LENGTH (type) != addr_size)
+ {
+ ULONGEST result =
+ extract_unsigned_integer (buf, addr_size, byte_order);
+
+ buf = alloca (TYPE_LENGTH (type));
+ store_unsigned_integer (buf, TYPE_LENGTH (type),
+ byte_order, result);
+ }
+
result_val = value_from_contents_and_address (type, buf, addr);
break;
}