]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* gdb/frame.c (get_prev_frame): Move check for pc == 0 ...
authorDaniel Jacobowitz <drow@false.org>
Wed, 10 May 2006 18:34:29 +0000 (18:34 +0000)
committerDaniel Jacobowitz <drow@false.org>
Wed, 10 May 2006 18:34:29 +0000 (18:34 +0000)
(get_prev_frame_1): ... to here.

ChangeLog.csl
gdb/frame.c

index 04f61f2f11a47eff413b13a5e5f7294850cc07bd..5cf4205ac0d417577dddc39457de2429f5966a86 100644 (file)
@@ -1,3 +1,8 @@
+2006-05-10  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * gdb/frame.c (get_prev_frame): Move check for pc == 0 ...
+       (get_prev_frame_1): ... to here.
+
 2006-05-09  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * gdb/bsd-uthread.c (bsd_uthread_solib_loaded): Always pass 0 for
index 80814fbf35e1499b35b5d24647bc139618898516..0f737741ce50bd77aad9ebb77087d71fee1a0d18 100644 (file)
@@ -1133,6 +1133,26 @@ get_prev_frame_1 (struct frame_info *this_frame)
   this_frame->prev = prev_frame;
   prev_frame->next = this_frame;
 
+  /* Now that the frame chain is in a consistant state, check whether
+     this frame is useful.  If it is not, unlink it.  Its storage will
+     be reclaimed the next time the frame cache is flushed, and we
+     will not try to unwind THIS_FRAME again.  */
+
+  /* Assume that the only way to get a zero PC is through something
+     like a SIGSEGV or a dummy frame, and hence that NORMAL frames
+     will never unwind a zero PC.  This will look up the unwinder
+     for the newly created frame, to determine its type.  */
+  if (prev_frame->level > 0
+      && get_frame_type (prev_frame) == NORMAL_FRAME
+      && get_frame_type (this_frame) == NORMAL_FRAME
+      && get_frame_pc (prev_frame) == 0)
+    {
+      if (frame_debug)
+       fprintf_unfiltered (gdb_stdlog, "-> // zero PC}\n");
+      this_frame->prev = NULL;
+      return NULL;
+    }
+
   if (frame_debug)
     {
       fprintf_unfiltered (gdb_stdlog, "-> ");
@@ -1310,18 +1330,6 @@ get_prev_frame (struct frame_info *this_frame)
       return NULL;
     }
 
-  /* Assume that the only way to get a zero PC is through something
-     like a SIGSEGV or a dummy frame, and hence that NORMAL frames
-     will never unwind a zero PC.  */
-  if (this_frame->level > 0
-      && get_frame_type (this_frame) == NORMAL_FRAME
-      && get_frame_type (get_next_frame (this_frame)) == NORMAL_FRAME
-      && get_frame_pc (this_frame) == 0)
-    {
-      frame_debug_got_null_frame (gdb_stdlog, this_frame, "zero PC");
-      return NULL;
-    }
-
   return get_prev_frame_1 (this_frame);
 }