This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfc] dwarf2 unwinder and MIPS n32


On Sat, 28 Apr 2007, Daniel Jacobowitz wrote:

> Maybe if the size of the register != the size of a void * we should
> store it as an unsigned integer.  But that seems hackish to me.

 Of course MIPS addresses are signed, so if you have a stack pointer in 
KSEG0 (e.g. 0x8fff0000), you want to store it as a signed integer, don't 
you?

 Anyway, I have the following patch waiting in the queue for submission -- 
perhaps it is less hackish. ;-)

2007-04-30  Maciej W. Rozycki  <macro@mips.com>

	* dwarf2-frame.c (read_reg): Extract an address using the width
	of the register to be used to hold it as the size.
	(dwarf2_frame_prev_register): Store an address using the width
	of the holding register as the size.

 It can certainly jump the queue if you find it useful. ;-)

  Maciej

13118.diff
Index: gdb/src/gdb/dwarf2-frame.c
===================================================================
--- gdb.orig/src/gdb/dwarf2-frame.c	2007-02-13 13:51:55.000000000 +0000
+++ gdb/src/gdb/dwarf2-frame.c	2007-02-13 13:51:56.000000000 +0000
@@ -229,6 +229,7 @@
 static CORE_ADDR
 read_reg (void *baton, int reg)
 {
+  struct type reg_void_data_ptr = *builtin_type_void_data_ptr;
   struct frame_info *next_frame = (struct frame_info *) baton;
   struct gdbarch *gdbarch = get_frame_arch (next_frame);
   int regnum;
@@ -236,6 +237,8 @@
 
   regnum = DWARF2_REG_TO_REGNUM (reg);
 
+  TYPE_LENGTH(&reg_void_data_ptr) = register_size (gdbarch, regnum);
+
   buf = alloca (register_size (gdbarch, regnum));
   frame_unwind_register (next_frame, regnum, buf);
 
@@ -244,7 +247,7 @@
      under the covers, and this makes more sense for non-pointer
      registers.  Maybe read_reg and the associated interfaces should
      deal with "struct value" instead of CORE_ADDR.  */
-  return unpack_long (register_type (gdbarch, regnum), buf);
+  return extract_typed_address (buf, &reg_void_data_ptr);
 }
 
 static void
@@ -1020,10 +1023,13 @@
 			    enum lval_type *lvalp, CORE_ADDR *addrp,
 			    int *realnump, gdb_byte *valuep)
 {
+  struct type reg_void_data_ptr = *builtin_type_void_data_ptr;
   struct gdbarch *gdbarch = get_frame_arch (next_frame);
   struct dwarf2_frame_cache *cache =
     dwarf2_frame_cache (next_frame, this_cache);
 
+  TYPE_LENGTH(&reg_void_data_ptr) = register_size (gdbarch, regnum);
+
   switch (cache->reg[regnum].how)
     {
     case DWARF2_FRAME_REG_UNDEFINED:
@@ -1132,7 +1138,7 @@
       if (valuep)
 	{
 	  /* Store the value.  */
-	  store_typed_address (valuep, builtin_type_void_data_ptr, cache->cfa);
+	  store_typed_address (valuep, &reg_void_data_ptr, cache->cfa);
 	}
       break;
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]