This is the mail archive of the gdb-patches@sources.redhat.com 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]

[PATCH] Don't skip the return address column in dwarf2-frame.c


This makes sure we don't skip the return address column if it
corresponds to a real register.  I tested this in
i386-unknown-freebsd4.7 and x86_64-unknown-freebsd5.2.  It should be
safe on other targets too.

Mark

Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* dwarf2-frame.c (dwarf2_frame_cache): Don't skip the return
	address column.

Index: dwarf2-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2-frame.c,v
retrieving revision 1.23
diff -u -p -r1.23 dwarf2-frame.c
--- dwarf2-frame.c 5 Dec 2003 21:14:49 -0000 1.23
+++ dwarf2-frame.c 22 Dec 2003 20:28:51 -0000
@@ -557,28 +557,19 @@ dwarf2_frame_cache (struct frame_info *n
   }
 
   /* Go through the DWARF2 CFI generated table and save its register
-     location information in the cache.  */
+     location information in the cache.  Note that we don't skip the
+     return address column; it's perfectly all right for it to
+     correspond to a real register.  If it doesn't correspond to a
+     real register, or if we shouldn't treat it as such,
+     DWARF2_REG_TO_REGNUM should be defined to return a number outside
+     the range [0, NUM_REGS).  */
   {
     int column;		/* CFI speak for "register number".  */
 
     for (column = 0; column < fs->regs.num_regs; column++)
       {
-	int regnum;
-	
-	/* Skip the return address column.  */
-	if (column == fs->retaddr_column)
-	  /* NOTE: cagney/2003-06-07: Is this right?  What if
-	     RETADDR_COLUMN corresponds to a real register (and,
-	     worse, that isn't the PC_REGNUM)?  I'm guessing that the
-	     PC_REGNUM further down is trying to handle this.  That
-	     can't be right though; PC_REGNUM may not be valid (it can
-	     be negative).  I think, instead when RETADDR_COLUM isn't
-	     a real register, it should map itself onto
-	     frame_pc_unwind.  */
-	  continue;
-
 	/* Use the GDB register number as the destination index.  */
-	regnum = DWARF2_REG_TO_REGNUM (column);
+	int regnum = DWARF2_REG_TO_REGNUM (column);
 
 	/* If there's no corresponding GDB register, ignore it.  */
 	if (regnum < 0 || regnum >= num_regs)


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