diff options
author | Joel Brobecker <brobecker@gnat.com> | 2011-06-03 17:42:24 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2011-06-03 17:42:24 +0000 |
commit | 325663dcd23da40c9ddec4c483de2745ba7c0c3e (patch) | |
tree | 19b177b6e722788f46912d9b1bdee5fbc677e8a4 | |
parent | 164a5cb7bde2ca6fc6a9876eb8cc8ecafe5a00ac (diff) | |
download | gdb-325663dcd23da40c9ddec4c483de2745ba7c0c3e.zip gdb-325663dcd23da40c9ddec4c483de2745ba7c0c3e.tar.gz gdb-325663dcd23da40c9ddec4c483de2745ba7c0c3e.tar.bz2 |
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).
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/dwarf2expr.c | 13 |
2 files changed, 18 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 50e7a98..b0e7f91 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2011-06-03 Joel Brobecker <brobecker@adacore.com> + + * dwarf2expr.c (execute_stack_op) [DW_OP_deref]: Handle + the case where ADDR_SIZE is different from TYPE_LENGTH (type). + 2011-06-03 Tom Tromey <tromey@redhat.com> * python/py-inferior.c (python_inferior_exit): Use inferior's exit diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c index 3c60b6a..e1ddc96 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; } |