diff options
Diffstat (limited to 'gdb/mi/mi-main.c')
-rw-r--r-- | gdb/mi/mi-main.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index d99c40e..c3e7bf7 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -54,6 +54,7 @@ #include "extension.h" #include "gdbcmd.h" #include "observer.h" +#include "common/gdb_optional.h" #include <ctype.h> #include "run-time-clock.h" @@ -312,16 +313,9 @@ exec_continue (char **argv, int argc) } static void -exec_direction_forward (void *notused) -{ - execution_direction = EXEC_FORWARD; -} - -static void exec_reverse_continue (char **argv, int argc) { enum exec_direction_kind dir = execution_direction; - struct cleanup *old_chain; if (dir == EXEC_REVERSE) error (_("Already in reverse mode.")); @@ -329,10 +323,9 @@ exec_reverse_continue (char **argv, int argc) if (!target_can_execute_reverse) error (_("Target %s does not support this command."), target_shortname); - old_chain = make_cleanup (exec_direction_forward, NULL); - execution_direction = EXEC_REVERSE; + scoped_restore save_exec_dir = make_scoped_restore (&execution_direction, + EXEC_REVERSE); exec_continue (argv, argc); - do_cleanups (old_chain); } void @@ -2140,15 +2133,13 @@ mi_execute_command (const char *cmd, int from_tty) if (command != NULL) { ptid_t previous_ptid = inferior_ptid; - struct cleanup *cleanup = make_cleanup (null_cleanup, NULL); - command->token = token; + gdb::optional<scoped_restore_tmpl<int>> restore_suppress; if (command->cmd != NULL && command->cmd->suppress_notification != NULL) - { - make_cleanup_restore_integer (command->cmd->suppress_notification); - *command->cmd->suppress_notification = 1; - } + restore_suppress.emplace (command->cmd->suppress_notification, 1); + + command->token = token; if (do_timings) { @@ -2210,8 +2201,6 @@ mi_execute_command (const char *cmd, int from_tty) (USER_SELECTED_THREAD | USER_SELECTED_FRAME); } } - - do_cleanups (cleanup); } } |