aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/python.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2009-11-09 18:29:12 +0000
committerTom Tromey <tromey@redhat.com>2009-11-09 18:29:12 +0000
commit86c6265d62c78d255c648eb33242ed74ec58772d (patch)
tree2984c9e12282d9bb9b81a23f7fc90a3839ab4fe7 /gdb/python/python.c
parentb8b4e42bdeee63d803eca3e1194a7fa785a4df73 (diff)
downloadgdb-86c6265d62c78d255c648eb33242ed74ec58772d.zip
gdb-86c6265d62c78d255c648eb33242ed74ec58772d.tar.gz
gdb-86c6265d62c78d255c648eb33242ed74ec58772d.tar.bz2
* python/python.c (execute_gdb_command): Copy the argument text.
Diffstat (limited to 'gdb/python/python.c')
-rw-r--r--gdb/python/python.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 254bd28..77a0069 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -309,7 +309,11 @@ execute_gdb_command (PyObject *self, PyObject *args)
TRY_CATCH (except, RETURN_MASK_ALL)
{
- execute_command (arg, from_tty);
+ /* Copy the argument text in case the command modifies it. */
+ char *copy = xstrdup (arg);
+ struct cleanup *cleanup = make_cleanup (xfree, copy);
+ execute_command (copy, from_tty);
+ do_cleanups (cleanup);
}
GDB_PY_HANDLE_EXCEPTION (except);