svn commit: r244116 - stable/9/contrib/gdb/gdb

Ed Maste emaste at FreeBSD.org
Tue Dec 11 12:34:47 UTC 2012


Author: emaste
Date: Tue Dec 11 12:34:46 2012
New Revision: 244116
URL: http://svnweb.freebsd.org/changeset/base/244116

Log:
  MFC r242943: Do not unwind past a zero PC frame.
  
    This improves GDB usability when debugging code compiled with
    optimization.
  
    Upstream GDB revision f0031b6d3ae9b164b3747986ab898190bd4dcf8c (prior
    to GDB's switch to GPLv3), with frame_debug_got_null_frame expanded
    inline.
  
    | 2004-12-12  Andrew Cagney  <cagney at gnu.org>
    |
    | * frame.c (get_prev_frame): When unwinding normal frames, check
    | that the PC isn't zero.
  
  Sponsored by:	ADARA Networks

Modified:
  stable/9/contrib/gdb/gdb/frame.c
Directory Properties:
  stable/9/contrib/gdb/   (props changed)

Modified: stable/9/contrib/gdb/gdb/frame.c
==============================================================================
--- stable/9/contrib/gdb/gdb/frame.c	Tue Dec 11 12:32:11 2012	(r244115)
+++ stable/9/contrib/gdb/gdb/frame.c	Tue Dec 11 12:34:46 2012	(r244116)
@@ -1846,6 +1846,23 @@ get_prev_frame (struct frame_info *this_
       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)
+    {
+      if (frame_debug)
+	{
+	  fprintf_unfiltered (gdb_stdlog, "-> ");
+	  fprint_frame (gdb_stdlog, this_frame->prev);
+	  fprintf_unfiltered (gdb_stdlog, " // zero PC \n");
+	}
+      return NULL;
+    }
+
   /* Only try to do the unwind once.  */
   if (this_frame->prev_p)
     {


More information about the svn-src-stable-9 mailing list