}
}
-/* Called during frame unwinding to remove a previous frame pointer from a
- frame passed in ARG. */
-
-static void
-remove_prev_frame (void *arg)
-{
- struct frame_info *this_frame, *prev_frame;
-
- this_frame = (struct frame_info *) arg;
- prev_frame = this_frame->prev;
- gdb_assert (prev_frame != NULL);
-
- prev_frame->next = NULL;
- this_frame->prev = NULL;
-}
-
/* Get the previous raw frame, and check that it is not identical to
same other frame frame already in the chain. If it is, there is
most likely a stack cycle, so we discard it, and mark THIS_FRAME as
get_prev_frame_if_no_cycle (struct frame_info *this_frame)
{
struct frame_info *prev_frame;
- struct cleanup *prev_frame_cleanup;
prev_frame = get_prev_frame_raw (this_frame);
if (prev_frame->level == 0)
return prev_frame;
- /* The cleanup will remove the previous frame that get_prev_frame_raw
- linked onto THIS_FRAME. */
- prev_frame_cleanup = make_cleanup (remove_prev_frame, this_frame);
-
- compute_frame_id (prev_frame);
- if (!frame_stash_add (prev_frame))
+ TRY
{
- /* Another frame with the same id was already in the stash. We just
- detected a cycle. */
- if (frame_debug)
+ compute_frame_id (prev_frame);
+ if (!frame_stash_add (prev_frame))
{
- fprintf_unfiltered (gdb_stdlog, "-> ");
- fprint_frame (gdb_stdlog, NULL);
- fprintf_unfiltered (gdb_stdlog, " // this frame has same ID }\n");
+ /* Another frame with the same id was already in the stash. We just
+ detected a cycle. */
+ if (frame_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog, "-> ");
+ fprint_frame (gdb_stdlog, NULL);
+ fprintf_unfiltered (gdb_stdlog, " // this frame has same ID }\n");
+ }
+ this_frame->stop_reason = UNWIND_SAME_ID;
+ /* Unlink. */
+ prev_frame->next = NULL;
+ this_frame->prev = NULL;
+ prev_frame = NULL;
}
- this_frame->stop_reason = UNWIND_SAME_ID;
- /* Unlink. */
+ }
+ CATCH (ex, RETURN_MASK_ALL)
+ {
prev_frame->next = NULL;
this_frame->prev = NULL;
- prev_frame = NULL;
+
+ throw_exception (ex);
}
+ END_CATCH
- discard_cleanups (prev_frame_cleanup);
return prev_frame;
}