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] Handle empty DWARF CFI return address column


Thanks to Ulrich Weigand for pointing this out.

Ulrich, I'm convinced this is the right approach.  FS->retaddr_column
pointing outside the table is essentially the same as the the column
being "unspecified".  And copying a "same value" rule makes no sense
of course.

Tested on i386-unknown-freebsd4.7 and x86_64-unknown-freebsd5.2.

Committed,

Mark


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

	* dwarf2-frame.c (dwarf2_frame_cache): Deal with a return address
	column that's "empty" or "same value" when eliminating REG_RA
	rules.

Index: dwarf2-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2-frame.c,v
retrieving revision 1.26
diff -u -p -r1.26 dwarf2-frame.c
--- dwarf2-frame.c 18 Jan 2004 21:22:50 -0000 1.26
+++ dwarf2-frame.c 2 Feb 2004 21:53:36 -0000
@@ -661,14 +661,19 @@ dwarf2_frame_cache (struct frame_info *n
       {
 	if (cache->reg[regnum].how == REG_RA)
 	  {
-	    if (fs->retaddr_column < fs->regs.num_regs)
+	    /* It seems rather bizarre to specify an "empty" column as
+               the return adress column.  However, this is exactly
+               what GCC does on some targets.  It turns out that GCC
+               assumes that the return address can be found in the
+               register corresponding to the return address column.
+               Incidentally, that's how should treat a return address
+               column specifying "same value" too.  */
+	    if (fs->retaddr_column < fs->regs.num_regs
+		&& fs->regs.reg[fs->retaddr_column].how != REG_UNSPECIFIED
+		&& fs->regs.reg[fs->retaddr_column].how != REG_SAME_VALUE)
 	      cache->reg[regnum] = fs->regs.reg[fs->retaddr_column];
 	    else
 	      {
-		/* It turns out that GCC assumes that if the return
-                   address column is "empty" the return address can be
-                   found in the register corresponding to the return
-                   address column.  */
 		cache->reg[regnum].loc.reg = fs->retaddr_column;
 		cache->reg[regnum].how = REG_SAVED_REG;
 	      }


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