RFA: Fix check for no-saved-pc
Sat Dec 1 01:50:00 GMT 2007
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:
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 <email@example.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.
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;
+ /* 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
More information about the Gdb-patches