This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] read_reg() patch
> I also think that the code itself is pretty unreadable. There are too
> many nested function calls. I think it could be improved by using a
> (temporary) local variable to store the result of
> extract_unsigned_integer().
How's this?
2004-07-26 Martin Hunt <hunt@redhat.com>
* dwarf2-frame.c (read_reg): Add a call to
store_unsigned_integer.
Index: dwarf2-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2-frame.c,v
retrieving revision 1.38
diff -u -p -r1.38 dwarf2-frame.c
--- dwarf2-frame.c 23 Jul 2004 22:05:20 -0000 1.38
+++ dwarf2-frame.c 26 Jul 2004 20:54:39 -0000
@@ -209,11 +209,20 @@ read_reg (void *baton, int reg)
struct gdbarch *gdbarch = get_frame_arch (next_frame);
int regnum;
char *buf;
+ CORE_ADDR tmp;
regnum = DWARF2_REG_TO_REGNUM (reg);
buf = (char *) alloca (register_size (gdbarch, regnum));
frame_unwind_register (next_frame, regnum, buf);
+
+ /* This extracts the least significant register_size() bits and
+ extends it to the size of a pointer. Without this, big-endian
+ targets where pointer size != register size breaks. */
+ tmp = extract_unsigned_integer (buf, register_size (gdbarch, regnum));
+ store_unsigned_integer (buf, TYPE_LENGTH (builtin_type_void_data_ptr),
+ tmp);
+
return extract_typed_address (buf, builtin_type_void_data_ptr);
}