From b6cede7829a76495f4f491e74be169b41e100975 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Mon, 8 Aug 2011 21:41:14 +0000 Subject: gdb/ * dwarf2loc.c (dwarf2_evaluate_loc_desc_full) (dwarf2_evaluate_loc_desc_full) : New variable objfile_gdbarch. Fix BFD_ENDIAN_BIG case. gdb/testsuite/ * gdb.dwarf2/dw2-op-stack-value.S: New file. * gdb.dwarf2/dw2-op-stack-value.exp: New file. --- gdb/dwarf2loc.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'gdb/dwarf2loc.c') diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index 8ecc6887dfd..41891bb472a 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -1232,7 +1232,13 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, retval = allocate_value (type); contents = value_contents_raw (retval); if (n > TYPE_LENGTH (type)) - n = TYPE_LENGTH (type); + { + struct gdbarch *objfile_gdbarch = get_objfile_arch (objfile); + + if (gdbarch_byte_order (objfile_gdbarch) == BFD_ENDIAN_BIG) + val_bytes += n - TYPE_LENGTH (type); + n = TYPE_LENGTH (type); + } memcpy (contents, val_bytes, n); } break; @@ -1254,7 +1260,13 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, n -= byte_offset; if (n > TYPE_LENGTH (type)) - n = TYPE_LENGTH (type); + { + struct gdbarch *objfile_gdbarch = get_objfile_arch (objfile); + + if (gdbarch_byte_order (objfile_gdbarch) == BFD_ENDIAN_BIG) + ldata += n - TYPE_LENGTH (type); + n = TYPE_LENGTH (type); + } memcpy (contents, ldata, n); } break; -- cgit v1.2.1