diff options
author | Tom Tromey <tom@tromey.com> | 2017-08-13 10:55:28 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-09-11 16:15:07 -0600 |
commit | 00f675ff65ff6f78712a46e9699856e935d86d86 (patch) | |
tree | e8c8d050598c69c8c47a8b451e18260f7a1704ae /gdb/mi/mi-cmd-break.c | |
parent | cb791d59489576280e416262eb61ab59765a0baf (diff) | |
download | gdb-00f675ff65ff6f78712a46e9699856e935d86d86.zip gdb-00f675ff65ff6f78712a46e9699856e935d86d86.tar.gz gdb-00f675ff65ff6f78712a46e9699856e935d86d86.tar.bz2 |
Change setup_breakpoint_reporting to return a scoped_restore
This changes setup_breakpoint_reporting to return a scoped_restore,
allowing for some cleanup removal.
ChangeLog
2017-09-11 Tom Tromey <tom@tromey.com>
* mi/mi-cmd-catch.c (mi_cmd_catch_assert)
(mi_cmd_catch_exception, mi_catch_load_unload): Update.
* mi/mi-cmd-break.c (setup_breakpoint_reporting): Return a
scoped_restore.
(mi_cmd_break_insert_1): Update.
* mi/mi-cmd-break.h (setup_breakpoint_reporting): Return a
scoped_restore.
Diffstat (limited to 'gdb/mi/mi-cmd-break.c')
-rw-r--r-- | gdb/mi/mi-cmd-break.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c index 560174e..bae8711 100644 --- a/gdb/mi/mi-cmd-break.c +++ b/gdb/mi/mi-cmd-break.c @@ -64,26 +64,22 @@ enum bp_type }; /* Arrange for all new breakpoints and catchpoints to be reported to - CURRENT_UIOUT until the cleanup returned by this function is run. + CURRENT_UIOUT until the destructor of the returned scoped_restore + is run. Note that MI output will be probably invalid if more than one breakpoint is created inside one MI command. */ -struct cleanup * +scoped_restore_tmpl<int> setup_breakpoint_reporting (void) { - struct cleanup *rev_flag; - if (! mi_breakpoint_observers_installed) { observer_attach_breakpoint_created (breakpoint_notify); mi_breakpoint_observers_installed = 1; } - rev_flag = make_cleanup_restore_integer (&mi_can_breakpoint_notify); - mi_can_breakpoint_notify = 1; - - return rev_flag; + return make_scoped_restore (&mi_can_breakpoint_notify, 1); } @@ -301,7 +297,7 @@ mi_cmd_break_insert_1 (int dprintf, const char *command, char **argv, int argc) } /* Now we have what we need, let's insert the breakpoint! */ - setup_breakpoint_reporting (); + scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting (); if (tracepoint) { |