* dwarf2loc.c (read_pieced_value): If a piece occupies part of
authorUlrich Weigand <uweigand@de.ibm.com>
Mon, 4 Jan 2010 14:56:16 +0000 (14:56 +0000)
committerUlrich Weigand <uweigand@de.ibm.com>
Mon, 4 Jan 2010 14:56:16 +0000 (14:56 +0000)
a register, assume the least-signficant part is used.
(write_pieced_value): Likewise.

gdb/ChangeLog
gdb/dwarf2loc.c

index a8f1278cda55150806a17acf21e027b1a51e97d7..79fe93a2ee754ee926c836ad2336b26d4f9fa943 100644 (file)
@@ -1,3 +1,9 @@
+2010-01-04  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * dwarf2loc.c (read_pieced_value): If a piece occupies part of
+       a register, assume the least-signficant part is used.
+       (write_pieced_value): Likewise.
+
 2010-01-04  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * printcmd.c: Include "arch-utils.h".
index 726345c551a929d9c14073c25a855c2dd2320b99..6679d74bd3ad5bfd8fc08843e8eb087821135441 100644 (file)
@@ -275,11 +275,17 @@ read_pieced_value (struct value *v)
        case DWARF_VALUE_REGISTER:
          {
            struct gdbarch *arch = get_frame_arch (frame);
-           bfd_byte regval[MAX_REGISTER_SIZE];
            int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch,
                                                           p->v.expr.value);
-           get_frame_register (frame, gdb_regnum, regval);
-           memcpy (contents + offset, regval, p->size);
+           int reg_offset = 0;
+
+           if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG
+               && p->size < register_size (arch, gdb_regnum))
+             /* Big-endian, and we want less than full size.  */
+             reg_offset = register_size (arch, gdb_regnum) - p->size;
+
+           get_frame_register_bytes (frame, gdb_regnum, reg_offset, p->size,
+                                     contents + offset);
          }
          break;
 
@@ -346,7 +352,15 @@ write_pieced_value (struct value *to, struct value *from)
          {
            struct gdbarch *arch = get_frame_arch (frame);
            int gdb_regnum = gdbarch_dwarf2_reg_to_regnum (arch, p->v.expr.value);
-           put_frame_register (frame, gdb_regnum, contents + offset);
+           int reg_offset = 0;
+
+           if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG
+               && p->size < register_size (arch, gdb_regnum))
+             /* Big-endian, and we want less than full size.  */
+             reg_offset = register_size (arch, gdb_regnum) - p->size;
+
+           put_frame_register_bytes (frame, gdb_regnum, reg_offset, p->size,
+                                     contents + offset);
          }
          break;
        case DWARF_VALUE_MEMORY: