This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] Adjust get_prev_frame_1 fix
- From: Daniel Jacobowitz <drow at false dot org>
- To: gdb-patches at sourceware dot org, Pedro Alves <pedro at codesourcery dot com>
- Date: Mon, 30 Jun 2008 14:02:45 -0400
- Subject: [commit] Adjust get_prev_frame_1 fix
As you know, I've been working on updating my inline support patch to
fit nicely into trunk. This has required more than the usual amount
of staring at our unwinders. At two points in the last three days
I was trying to figure out why Pedro's get_frame_id call fixed the
bug, so I've replaced it with an equivalent fix that does not rely
on side effects: the problem was trying to find the unwinder
for THIS_FRAME after we'd already connected a PREV frame to it.
The unwinder cleanups took this to mean that a sniffer had called
get_prev_frame, which would be naughty.
Tested on x86_64-linux, checked in.
--
Daniel Jacobowitz
CodeSourcery
2008-06-30 Daniel Jacobowitz <dan@codesourcery.com>
* frame.c (get_prev_frame_1): Call frame_unwind_find_by_frame
directly instead of get_frame_id.
Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.242
diff -u -p -r1.242 frame.c
--- frame.c 20 May 2008 22:21:19 -0000 1.242
+++ frame.c 30 Jun 2008 17:53:43 -0000
@@ -1180,9 +1180,13 @@ get_prev_frame_1 (struct frame_info *thi
return this_frame->prev;
}
- /* If the frame id hasn't been built yet, it must be done before
- setting a stop reason. */
- this_id = get_frame_id (this_frame);
+ /* If the frame unwinder hasn't been selected yet, we must do so
+ before setting prev_p; otherwise the check for misbehaved
+ sniffers will think that this frame's sniffer tried to unwind
+ further (see frame_cleanup_after_sniffer). */
+ if (this_frame->unwind == NULL)
+ this_frame->unwind
+ = frame_unwind_find_by_frame (this_frame, &this_frame->prologue_cache);
this_frame->prev_p = 1;
this_frame->stop_reason = UNWIND_NO_REASON;
@@ -1190,6 +1194,7 @@ get_prev_frame_1 (struct frame_info *thi
/* Check that this frame's ID was valid. If it wasn't, don't try to
unwind to the prev frame. Be careful to not apply this test to
the sentinel frame. */
+ this_id = get_frame_id (this_frame);
if (this_frame->level >= 0 && !frame_id_p (this_id))
{
if (frame_debug)