This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Change captured_mi_execute_command to use scoped_restore
- From: Tom Tromey <tromey at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 30 Sep 2017 03:13:48 -0000
- Subject: [binutils-gdb] Change captured_mi_execute_command to use scoped_restore
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=789c4b5ea14b0c441e6021f07503e61ccfacb427
commit 789c4b5ea14b0c441e6021f07503e61ccfacb427
Author: Tom Tromey <tom@tromey.com>
Date: Thu May 4 21:25:55 2017 -0600
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.
Diff:
---
gdb/ChangeLog | 4 ++++
gdb/mi/mi-main.c | 9 +++------
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index db456b3..005e366 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2017-09-29 Tom Tromey <tom@tromey.com>
+ * mi/mi-main.c (captured_mi_execute_command): Use scope_restore.
+
+2017-09-29 Tom Tromey <tom@tromey.com>
+
* mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions): Update.
* ada-lang.h (struct ada_exc_info): Remove typedef. Declare
operator< and operator==.
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, ¤t_token);
+ scoped_restore save_token = make_scoped_restore (¤t_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. */