diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2011-11-18 20:03:42 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2011-11-18 20:03:42 +0000 |
commit | 01efb936400c4198c11922bb7f9650a9314a598c (patch) | |
tree | 899beb4cb3931aec8f4ef73fcee7c7cdf3b9a4aa /gdb/findvar.c | |
parent | 732f3f122e676d05dd5618a648764b0de6473013 (diff) | |
download | binutils-01efb936400c4198c11922bb7f9650a9314a598c.zip binutils-01efb936400c4198c11922bb7f9650a9314a598c.tar.gz binutils-01efb936400c4198c11922bb7f9650a9314a598c.tar.bz2 |
* findvar.c (read_frame_register_value): Respect value_offset
of the register value. Remove big-endian special case.
Diffstat (limited to 'gdb/findvar.c')
-rw-r--r-- | gdb/findvar.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/gdb/findvar.c b/gdb/findvar.c index 426b488..33332c6 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -631,31 +631,37 @@ default_value_from_register (struct type *type, int regnum, void read_frame_register_value (struct value *value, struct frame_info *frame) { + struct gdbarch *gdbarch = get_frame_arch (frame); int offset = 0; + int reg_offset = value_offset (value); int regnum = VALUE_REGNUM (value); - const int len = TYPE_LENGTH (check_typedef (value_type (value))); + int len = TYPE_LENGTH (check_typedef (value_type (value))); gdb_assert (VALUE_LVAL (value) == lval_register); - while (offset < len) + /* Skip registers wholly inside of REG_OFFSET. */ + while (reg_offset >= register_size (gdbarch, regnum)) + { + reg_offset -= register_size (gdbarch, regnum); + regnum++; + } + + /* Copy the data. */ + while (len > 0) { struct value *regval = get_frame_register_value (frame, regnum); - int reg_len = TYPE_LENGTH (value_type (regval)); - int reg_offset = 0; + int reg_len = TYPE_LENGTH (value_type (regval)) - reg_offset; /* If the register length is larger than the number of bytes remaining to copy, then only copy the appropriate bytes. */ - if (offset + reg_len > len) - { - reg_len = len - offset; - if (gdbarch_byte_order (get_frame_arch (frame)) == BFD_ENDIAN_BIG) - reg_offset = TYPE_LENGTH (value_type (regval)) - reg_len; - } + if (reg_len > len) + reg_len = len; - value_contents_copy (value, offset, regval, - value_offset (regval) + reg_offset, reg_len); + value_contents_copy (value, offset, regval, reg_offset, reg_len); offset += reg_len; + len -= reg_len; + reg_offset = 0; regnum++; } } |