* dwarf2-frame.c (dwarf2_frame_cache): Deal with a return address
authorMark Kettenis <kettenis@gnu.org>
Mon, 2 Feb 2004 22:00:14 +0000 (22:00 +0000)
committerMark Kettenis <kettenis@gnu.org>
Mon, 2 Feb 2004 22:00:14 +0000 (22:00 +0000)
column that's "empty" or "same value" when eliminating REG_RA
rules.

gdb/ChangeLog
gdb/dwarf2-frame.c

index 7c0ded56f9e1b3d7c327ce5b3a7f896e83ce6f34..63cda6c27c137cc272513451b823149b9ccea892 100644 (file)
@@ -1,3 +1,9 @@
+2004-02-02  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.
+
 2004-02-02  Jeff Johnston  <jjohnstn@redhat.com>
 
        * breakpoint.h (struct breakpoint): Add new flag, from_tty,
index 2c655d9793cde5204f639a40a768e5173851f446..22e41071f86140761b022b61193ab454091d3a7b 100644 (file)
@@ -661,14 +661,19 @@ dwarf2_frame_cache (struct frame_info *next_frame, void **this_cache)
       {
        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;
              }