[PATCH/i386newframe] Fix return address column handling

Mark Kettenis kettenis@chello.nl
Sat May 17 21:44:00 GMT 2003


There isn't necessarily a register mapping for the return address
column.  This patch deals with that possibility.

Checked in.

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>
 
	* dwarf-frame.c (dwarf_frame_cache): Fix handling of return
	address column.

 
Index: dwarf-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/Attic/dwarf-frame.c,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 dwarf-frame.c
--- dwarf-frame.c 17 May 2003 14:51:30 -0000 1.1.2.4
+++ dwarf-frame.c 17 May 2003 21:40:11 -0000
@@ -520,15 +520,21 @@ dwarf_frame_cache (struct frame_info *ne
   /* Save the register info in the cache.  */
   for (reg = 0; reg < fs->regs.num_regs; reg++)
     {
+      int regnum;
+
+      /* Skip the return address column.  */
+      if (reg == fs->retaddr_column)
+	continue;
+
       /* Use the GDB register number as index.  */
-      int regnum = DWARF2_REG_TO_REGNUM (reg);
+      regnum = DWARF2_REG_TO_REGNUM (reg);
 
       if (regnum >= 0 && regnum < num_regs)
 	cache->reg[regnum] = fs->regs.reg[reg];
     }
 
-  /* Make sure we have stored the return addess value.  */
-  if (cache->reg[PC_REGNUM].how == REG_UNSAVED)
+  /* Stored the location of the return addess.  */
+  if (fs->retaddr_column < fs->regs.num_regs)
     cache->reg[PC_REGNUM] = fs->regs.reg[fs->retaddr_column];
 
   do_cleanups (old_chain);



More information about the Gdb-patches mailing list