* python/python.c (execute_gdb_command): Copy the argument text.

This commit is contained in:
Tom Tromey 2009-11-09 18:29:12 +00:00
parent b8b4e42bde
commit 86c6265d62
2 changed files with 9 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2009-11-09 Tom Tromey <tromey@redhat.com>
* python/python.c (execute_gdb_command): Copy the argument text.
2009-11-06 Vladimir Prus <vladimir@codesourcery.com>
* m68k-tdep.c (m68k_convert_register_p): Correct

View File

@ -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);