aboutsummaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-01-23 18:58:31 +0000
committerPedro Alves <palves@redhat.com>2019-01-23 19:04:26 +0000
commit5419bdae559360a10044983b06c11a31de8d81f4 (patch)
tree9347b273532e24024e5389a44c46f3dea4d76c52 /gdb/breakpoint.c
parente587ef421eb7e009c6a69da55c269e9df45093e4 (diff)
downloadgdb-5419bdae559360a10044983b06c11a31de8d81f4.zip
gdb-5419bdae559360a10044983b06c11a31de8d81f4.tar.gz
gdb-5419bdae559360a10044983b06c11a31de8d81f4.tar.bz2
Replace delete_longjmp_breakpoint_cleanup with a forward_scope_exit type
This removes delete_longjmp_breakpoint_cleanup in favor of forward_scope_exit. gdb/ChangeLog: 2019-01-23 Tom Tromey <tom@tromey.com> Andrew Burgess <andrew.burgess@embecosm.com> Pedro Alves <palves@redhat.com> * breakpoint.c (until_break_command): Use delete_longjmp_breakpoint_cleanup class. * infcmd.c (delete_longjmp_breakpoint_cleanup): Remove function. (until_next_command): Use delete_longjmp_breakpoint_cleanup class. * inferior.h: Include forward-scope-exit.h. (delete_longjmp_breakpoint_cleanup): Replace function declaration with FORWARD_SCOPE_EXIT type.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 3166fa0..999809c 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -11073,7 +11073,6 @@ until_break_command (const char *arg, int from_tty, int anywhere)
struct gdbarch *frame_gdbarch;
struct frame_id stack_frame_id;
struct frame_id caller_frame_id;
- struct cleanup *old_chain;
int thread;
struct thread_info *tp;
struct until_break_fsm *sm;
@@ -11106,8 +11105,6 @@ until_break_command (const char *arg, int from_tty, int anywhere)
tp = inferior_thread ();
thread = tp->global_num;
- old_chain = make_cleanup (null_cleanup, NULL);
-
/* Note linespec handling above invalidates the frame chain.
Installing a breakpoint also invalidates the frame chain (as it
may need to switch threads), so do any frame handling before
@@ -11122,6 +11119,9 @@ until_break_command (const char *arg, int from_tty, int anywhere)
one. */
breakpoint_up caller_breakpoint;
+
+ gdb::optional<delete_longjmp_breakpoint_cleanup> lj_deleter;
+
if (frame_id_p (caller_frame_id))
{
struct symtab_and_line sal2;
@@ -11136,7 +11136,7 @@ until_break_command (const char *arg, int from_tty, int anywhere)
bp_until);
set_longjmp_breakpoint (tp, caller_frame_id);
- make_cleanup (delete_longjmp_breakpoint_cleanup, &thread);
+ lj_deleter.emplace (thread);
}
/* set_momentary_breakpoint could invalidate FRAME. */
@@ -11159,7 +11159,8 @@ until_break_command (const char *arg, int from_tty, int anywhere)
std::move (caller_breakpoint));
tp->thread_fsm = &sm->thread_fsm;
- discard_cleanups (old_chain);
+ if (lj_deleter)
+ lj_deleter->release ();
proceed (-1, GDB_SIGNAL_DEFAULT);
}