Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@specifix.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sourceware.org
Subject: Re: RFA: Fix check for no-saved-pc
Date: Sat, 01 Dec 2007 01:50:00 -0000	[thread overview]
Message-ID: <1196473044.2501.189.camel@localhost.localdomain> (raw)
In-Reply-To: <20071130230045.GA24809@caradoc.them.org>

On Fri, 2007-11-30 at 18:00 -0500, Daniel Jacobowitz wrote:
> On Fri, Nov 30, 2007 at 02:40:31PM -0800, Michael Snyder wrote:
> > There's a check in get_prev_frame to see if the next saved pc
> > is zero.  I think it has an off-by-one error, and is checking 
> > for the pc of the wrong frame.
> 
> Mark K. and I have had roughly a month's worth of discussion on this
> check over the last two years; it's where it is on purpose.  Here's
> the last conversation:
> 
>   http://sourceware.org/ml/gdb-patches/2006-05/msg00196.html
>   http://sourceware.org/ml/gdb-patches/2006-07/msg00296.html

All right.  Then let's leave that test alone, and add another
test, much later on, to detect and report this situation.

Here's my revised patch.  Testsuites un-affected.

As before, the effect of this change is to have gdb print
a more informative message instead of a meaningless zero-frame.

2007-11-30  Michael Snyder  <msnyder@specifix.com>

	* frame.c (get_prev_frame): Remove unused local variable.
	(get_prev_frame_1): Check for null saved pc in the calling 
	frame.  Set up stop_reason conditions for printing stop reason.

Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.235
diff -u -p -r1.235 frame.c
--- frame.c	2 Nov 2007 14:47:27 -0000	1.235
+++ frame.c	1 Dec 2007 01:30:01 -0000
@@ -1248,6 +1248,16 @@ get_prev_frame_1 (struct frame_info *thi
 	  this_frame->prev = NULL;
 	  return NULL;
 	}
+      /* Also check for a null saved_pc.  At this point it can 
+	 only be a bad thing.  */
+      if (frame_pc_unwind (this_frame) == 0)
+	{
+	  frame_debug_got_null_frame (gdb_stdlog, this_frame, 
+				      "zero PC");
+	  this_frame->stop_reason = UNWIND_NO_SAVED_PC;
+	  this_frame->prev = NULL;
+	  return NULL;
+	}
     }
 
   /* Allocate the new frame but do not wire it in to the frame chain.
@@ -1355,8 +1365,6 @@ inside_entry_func (struct frame_info *th
 struct frame_info *
 get_prev_frame (struct frame_info *this_frame)
 {
-  struct frame_info *prev_frame;
-
   /* Return the inner-most frame, when the caller passes in NULL.  */
   /* NOTE: cagney/2002-11-09: Not sure how this would happen.  The
      caller should have previously obtained a valid frame using



  reply	other threads:[~2007-12-01  1:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-30 22:53 Michael Snyder
2007-11-30 23:00 ` Daniel Jacobowitz
2007-12-01  1:50   ` Michael Snyder [this message]
2007-12-04  2:06     ` Michael Snyder
2007-12-04 18:05     ` Mark Kettenis
2007-12-04 23:25       ` Michael Snyder
2007-12-12 19:42         ` Michael Snyder
2007-12-16 20:08           ` Mark Kettenis
2007-12-17 18:43             ` Michael Snyder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1196473044.2501.189.camel@localhost.localdomain \
    --to=msnyder@specifix.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox