* hppa-tdep.c (frame_chain): Fix more obscure problems caused
authorJeff Law <law@redhat.com>
Wed, 18 Oct 1995 05:48:23 +0000 (05:48 +0000)
committerJeff Law <law@redhat.com>
Wed, 18 Oct 1995 05:48:23 +0000 (05:48 +0000)
        by system calls that core dump processes without saving all
        the register state.

gdb/ChangeLog
gdb/hppa-tdep.c

index 72eb419de4f642c0ea145159344dac40dd6ebfa2..731e9f038ccbeddb20902336215c4fe92d427dc8 100644 (file)
@@ -1,5 +1,9 @@
 Tue Oct 17 10:38:53 1995  Jeffrey A Law  (law@cygnus.com)
 
+       * hppa-tdep.c (frame_chain): Fix more obscure problems caused
+       by system calls that core dump processes without saving all
+       the register state.
+
        * config/pa/hppahpux.mt (XDEPFILES): Remove bogus definition.
        * config/pa/hppapro.mt (XDEPFILES): Likewise.
 
index 3addc58ed916951fc7cd07d6b7e3a12ec6b91769..62531a34f11189d8a317a6aa6b5314203189b7be 100644 (file)
@@ -1076,8 +1076,11 @@ frame_chain (frame)
 
          /* Abominable hack.  */
          if (current_target.to_has_execution == 0
-             && saved_regs.regs[FLAGS_REGNUM]
-             && (read_memory_integer (saved_regs.regs[FLAGS_REGNUM], 4) & 0x2))
+             && ((saved_regs.regs[FLAGS_REGNUM]
+                  && (read_memory_integer (saved_regs.regs[FLAGS_REGNUM], 4)
+                      & 0x2))
+                 || (saved_regs.regs[FLAGS_REGNUM] == 0
+                     && read_register (FLAGS_REGNUM) & 0x2)))
            {
              u = find_unwind_entry (FRAME_SAVED_PC (frame));
              if (!u)
@@ -1091,6 +1094,29 @@ frame_chain (frame)
     }
   else
     {
+      struct frame_saved_regs saved_regs;
+
+      /* Get the innermost frame.  */
+      tmp_frame = frame;
+      while (tmp_frame->next != NULL)
+       tmp_frame = tmp_frame->next;
+
+      get_frame_saved_regs (tmp_frame, &saved_regs);
+      /* Abominable hack.  See above.  */
+      if (current_target.to_has_execution == 0
+         && ((saved_regs.regs[FLAGS_REGNUM]
+              && (read_memory_integer (saved_regs.regs[FLAGS_REGNUM], 4)
+                  & 0x2))
+             || (saved_regs.regs[FLAGS_REGNUM] == 0
+                 && read_register (FLAGS_REGNUM)  & 0x2)))
+       {
+         u = find_unwind_entry (FRAME_SAVED_PC (frame));
+         if (!u)
+           return read_memory_integer (saved_regs.regs[FP_REGNUM], 4);
+          else
+           return frame_base - (u->Total_frame_size << 3);
+       }
+       
       /* The value in %r3 was never saved into the stack (thus %r3 still
         holds the value of the previous frame pointer).  */
       return read_register (FP_REGNUM);