aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-08-13 11:04:37 -0600
committerTom Tromey <tom@tromey.com>2017-09-03 13:03:05 -0600
commit56496dd4d6519c26bb375a78588bf56b28b13512 (patch)
treee6af839ad4cdb4db09e0a1f68242effb7bee5eb0 /gdb
parente91a1fa7d49482565b5f96a2ca9e51ce6327c4ae (diff)
downloadbinutils-56496dd4d6519c26bb375a78588bf56b28b13512.zip
binutils-56496dd4d6519c26bb375a78588bf56b28b13512.tar.gz
binutils-56496dd4d6519c26bb375a78588bf56b28b13512.tar.bz2
Use std::string in mi_cmd_interpreter_exec
Change mi_cmd_interpreter_exec to use std::string, removing a cleanup. ChangeLog 2017-09-03 Tom Tromey <tom@tromey.com> * mi/mi-interp.c (mi_cmd_interpreter_exec): Use std::string.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/mi/mi-interp.c12
2 files changed, 8 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 72b52f5..8d75d48 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2017-09-03 Tom Tromey <tom@tromey.com>
+ * mi/mi-interp.c (mi_cmd_interpreter_exec): Use std::string.
+
+2017-09-03 Tom Tromey <tom@tromey.com>
+
* mi/mi-cmd-env.c (env_execute_cli_command): Use
gdb::unique_xmalloc_ptr.
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 959ae37..6b6d8f0 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -206,8 +206,6 @@ mi_cmd_interpreter_exec (const char *command, char **argv, int argc)
{
struct interp *interp_to_use;
int i;
- char *mi_error_message = NULL;
- struct cleanup *old_chain;
if (argc < 2)
error (_("-interpreter-exec: "
@@ -231,24 +229,22 @@ mi_cmd_interpreter_exec (const char *command, char **argv, int argc)
/* Now run the code. */
- old_chain = make_cleanup (null_cleanup, 0);
+ std::string mi_error_message;
for (i = 1; i < argc; i++)
{
struct gdb_exception e = interp_exec (interp_to_use, argv[i]);
if (e.reason < 0)
{
- mi_error_message = xstrdup (e.message);
- make_cleanup (xfree, mi_error_message);
+ mi_error_message = e.message;
break;
}
}
mi_remove_notify_hooks ();
- if (mi_error_message != NULL)
- error ("%s", mi_error_message);
- do_cleanups (old_chain);
+ if (!mi_error_message.empty ())
+ error ("%s", mi_error_message.c_str ());
}
/* This inserts a number of hooks that are meant to produce