mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-04 22:15:12 +08:00
Use TRY/CATCH in remove_prev_frame
This changes remove_prev_frame to use TRY/CATCH instead of a cleanup. TRY/CATCH seemed appropriate here because the cleanup is only needed in the case where an exception is thrown. Tested by the buildbot. ChangeLog 2018-05-25 Tom Tromey <tom@tromey.com> * frame.c (remove_prev_frame): Remove. (get_prev_frame_if_no_cycle): Use TRY/CATCH.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2018-05-25 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* frame.c (remove_prev_frame): Remove.
|
||||||
|
(get_prev_frame_if_no_cycle): Use TRY/CATCH.
|
||||||
|
|
||||||
2018-05-25 Maciej W. Rozycki <macro@mips.com>
|
2018-05-25 Maciej W. Rozycki <macro@mips.com>
|
||||||
|
|
||||||
* mips-linux-tdep.h (mips_supply_fpregset, mips_fill_fpregset):
|
* mips-linux-tdep.h (mips_supply_fpregset, mips_fill_fpregset):
|
||||||
|
33
gdb/frame.c
33
gdb/frame.c
@ -1871,22 +1871,6 @@ frame_register_unwind_location (struct frame_info *this_frame, int regnum,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 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
|
/* 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
|
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
|
most likely a stack cycle, so we discard it, and mark THIS_FRAME as
|
||||||
@ -1899,7 +1883,6 @@ static struct frame_info *
|
|||||||
get_prev_frame_if_no_cycle (struct frame_info *this_frame)
|
get_prev_frame_if_no_cycle (struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
struct frame_info *prev_frame;
|
struct frame_info *prev_frame;
|
||||||
struct cleanup *prev_frame_cleanup;
|
|
||||||
|
|
||||||
prev_frame = get_prev_frame_raw (this_frame);
|
prev_frame = get_prev_frame_raw (this_frame);
|
||||||
|
|
||||||
@ -1915,10 +1898,8 @@ get_prev_frame_if_no_cycle (struct frame_info *this_frame)
|
|||||||
if (prev_frame->level == 0)
|
if (prev_frame->level == 0)
|
||||||
return prev_frame;
|
return prev_frame;
|
||||||
|
|
||||||
/* The cleanup will remove the previous frame that get_prev_frame_raw
|
TRY
|
||||||
linked onto THIS_FRAME. */
|
{
|
||||||
prev_frame_cleanup = make_cleanup (remove_prev_frame, this_frame);
|
|
||||||
|
|
||||||
compute_frame_id (prev_frame);
|
compute_frame_id (prev_frame);
|
||||||
if (!frame_stash_add (prev_frame))
|
if (!frame_stash_add (prev_frame))
|
||||||
{
|
{
|
||||||
@ -1936,8 +1917,16 @@ get_prev_frame_if_no_cycle (struct frame_info *this_frame)
|
|||||||
this_frame->prev = NULL;
|
this_frame->prev = NULL;
|
||||||
prev_frame = NULL;
|
prev_frame = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
CATCH (ex, RETURN_MASK_ALL)
|
||||||
|
{
|
||||||
|
prev_frame->next = NULL;
|
||||||
|
this_frame->prev = NULL;
|
||||||
|
|
||||||
|
throw_exception (ex);
|
||||||
|
}
|
||||||
|
END_CATCH
|
||||||
|
|
||||||
discard_cleanups (prev_frame_cleanup);
|
|
||||||
return prev_frame;
|
return prev_frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user