From 86c6265d62c78d255c648eb33242ed74ec58772d Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 9 Nov 2009 18:29:12 +0000 Subject: [PATCH] * python/python.c (execute_gdb_command): Copy the argument text. --- gdb/ChangeLog | 4 ++++ gdb/python/python.c | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a63582a3865..1fe42c6eeef 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2009-11-09 Tom Tromey + + * python/python.c (execute_gdb_command): Copy the argument text. + 2009-11-06 Vladimir Prus * m68k-tdep.c (m68k_convert_register_p): Correct diff --git a/gdb/python/python.c b/gdb/python/python.c index 254bd280a16..77a00693ea3 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); -- 2.30.2