From: Ulrich Weigand Date: Mon, 4 Jan 2010 14:56:16 +0000 (+0000) Subject: * dwarf2loc.c (read_pieced_value): If a piece occupies part of X-Git-Tag: sid-snapshot-20100201~392 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dcbf108f79b23f0092a6d3c7cfb13471172e865f;p=external%2Fbinutils.git * dwarf2loc.c (read_pieced_value): If a piece occupies part of a register, assume the least-signficant part is used. (write_pieced_value): Likewise. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a8f1278..79fe93a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2010-01-04 Ulrich Weigand + * 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 + * printcmd.c: Include "arch-utils.h". (do_one_display): Re-parse expression if current architecture changed. diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index 726345c..6679d74 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -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: