get_prev_frame, outer_frame_id and unwind->stop_reason checks are redundant.

After the previous patch, it should be clear that the
this_frame->unwind->stop_reason check is redundant with the
outer_frame_id check just below.  We can now move the frame_id_eq
comparison to the default this_frame->unwind->stop_reason callback.

Tested on x86_64 Fedora 17.

gdb/
2013-11-28  Pedro Alves  <palves@redhat.com>

	* frame-unwind.c (default_frame_unwind_stop_reason): Return
	UNWIND_OUTERMOST if the frame's ID is outer_frame_id.
	* frame.c (get_prev_frame_1): Remove outer_frame_id check.
This commit is contained in:
Pedro Alves
2013-11-28 15:48:51 +00:00
parent 5de5158168
commit 50fd528a13
3 changed files with 13 additions and 18 deletions

View File

@@ -1,3 +1,9 @@
2013-11-28 Pedro Alves <palves@redhat.com>
* frame-unwind.c (default_frame_unwind_stop_reason): Return
UNWIND_OUTERMOST if the frame's ID is outer_frame_id.
* frame.c (get_prev_frame_1): Remove outer_frame_id check.
2013-11-28 Pedro Alves <palves@redhat.com> 2013-11-28 Pedro Alves <palves@redhat.com>
* frame.c (get_prev_frame_1): If the frame id is outer_frame_id, * frame.c (get_prev_frame_1): If the frame id is outer_frame_id,

View File

@@ -143,13 +143,17 @@ default_frame_sniffer (const struct frame_unwind *self,
return 1; return 1;
} }
/* A default frame unwinder stop_reason callback that always claims /* The default frame unwinder stop_reason callback. */
the frame is unwindable. */
enum unwind_stop_reason enum unwind_stop_reason
default_frame_unwind_stop_reason (struct frame_info *this_frame, default_frame_unwind_stop_reason (struct frame_info *this_frame,
void **this_cache) void **this_cache)
{ {
struct frame_id this_id = get_frame_id (this_frame);
if (frame_id_eq (this_id, outer_frame_id))
return UNWIND_OUTERMOST;
else
return UNWIND_NO_REASON; return UNWIND_NO_REASON;
} }

View File

@@ -1773,21 +1773,6 @@ get_prev_frame_1 (struct frame_info *this_frame)
if (this_frame->stop_reason != UNWIND_NO_REASON) if (this_frame->stop_reason != UNWIND_NO_REASON)
return NULL; return NULL;
/* Check that this frame is not the outermost. If it is, don't try
to unwind to the prev frame. */
this_id = get_frame_id (this_frame);
if (frame_id_eq (this_id, outer_frame_id))
{
if (frame_debug)
{
fprintf_unfiltered (gdb_stdlog, "-> ");
fprint_frame (gdb_stdlog, NULL);
fprintf_unfiltered (gdb_stdlog, " // frame ID is outer_frame_id }\n");
}
this_frame->stop_reason = UNWIND_OUTERMOST;
return NULL;
}
/* Check that this frame's ID isn't inner to (younger, below, next) /* Check that this frame's ID isn't inner to (younger, below, next)
the next frame. This happens when a frame unwind goes backwards. the next frame. This happens when a frame unwind goes backwards.
This check is valid only if this frame and the next frame are NORMAL. This check is valid only if this frame and the next frame are NORMAL.