aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-05-04 21:25:55 -0600
committerTom Tromey <tom@tromey.com>2017-09-29 21:12:18 -0600
commit789c4b5ea14b0c441e6021f07503e61ccfacb427 (patch)
tree2a8fab9d1e6a5dc1c41bb7b336f92fb9e3505f28 /gdb/mi
parentab816a274505933da2f854014b54901c3c3db9d2 (diff)
downloadgdb-789c4b5ea14b0c441e6021f07503e61ccfacb427.zip
gdb-789c4b5ea14b0c441e6021f07503e61ccfacb427.tar.gz
gdb-789c4b5ea14b0c441e6021f07503e61ccfacb427.tar.bz2
Change captured_mi_execute_command to use scoped_restore
Change captured_mi_execute_command to use a scoped_restore, removing a cleanup. The old code copied the current token, but I don't believe that is necessary. gdb/ChangeLog 2017-09-29 Tom Tromey <tom@tromey.com> * mi/mi-main.c (captured_mi_execute_command): Use scope_restore.
Diffstat (limited to 'gdb/mi')
-rw-r--r--gdb/mi/mi-main.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 4d9f37b..29acf2d 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -1875,20 +1875,19 @@ mi_cmd_remove_inferior (const char *command, char **argv, int argc)
Return <0 for error; >=0 for ok.
args->action will tell mi_execute_command what action
- to perfrom after the given command has executed (display/suppress
+ to perform after the given command has executed (display/suppress
prompt, display error). */
static void
captured_mi_execute_command (struct ui_out *uiout, struct mi_parse *context)
{
struct mi_interp *mi = (struct mi_interp *) command_interp ();
- struct cleanup *cleanup;
if (do_timings)
current_command_ts = context->cmd_start;
- current_token = xstrdup (context->token);
- cleanup = make_cleanup (free_current_contents, &current_token);
+ scoped_restore save_token = make_scoped_restore (&current_token,
+ context->token);
running_result_record_printed = 0;
mi_proceeded = 0;
@@ -1964,8 +1963,6 @@ captured_mi_execute_command (struct ui_out *uiout, struct mi_parse *context)
break;
}
}
-
- do_cleanups (cleanup);
}
/* Print a gdb exception to the MI output stream. */