From 028d0ed5d19d1c164d9ee4f4f85743ca7e955e52 Mon Sep 17 00:00:00 2001 From: Thiago Jung Bauermann Date: Fri, 13 May 2011 04:34:25 +0000 Subject: gdb/ * mi/mi-main.c (mi_cmd_execute): Use cleanup from prepare_execute_command. * top.c (prepare_execute_command): Return cleanup. (execute_command): Use cleanup from prepare_execute_command. * top.h (prepare_execute_command): Change prototype to return cleanup. * defs.h (struct value): Add opaque declaration. (make_cleanup_value_free_to_mark): Add prototype. * utils.c (do_value_free_to_mark): New function. (make_cleanup_value_free_to_mark): Likewise. gdb/testsuite/ * gdb.python/py-function.exp: Test setting a value from a function which executes a command. --- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.python/py-function.exp | 14 ++++++++++++++ 2 files changed, 19 insertions(+) (limited to 'gdb/testsuite') diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 9231ae2..f6ad357 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-05-13 Thiago Jung Bauermann + + * gdb.python/py-function.exp: Test setting a value from a function + which executes a command. + 2011-05-12 Tom Tromey * gdb.dwarf2/typeddwarf.S: New file. diff --git a/gdb/testsuite/gdb.python/py-function.exp b/gdb/testsuite/gdb.python/py-function.exp index dfccdff..ffadb5b 100644 --- a/gdb/testsuite/gdb.python/py-function.exp +++ b/gdb/testsuite/gdb.python/py-function.exp @@ -95,3 +95,17 @@ gdb_py_test_multiple "Test Normal Error" \ gdb_test "print \$normalerror()" "Traceback.*File.*line 5.*in invoke.*RuntimeError.*This is a Normal Error.*" \ "Test a Runtime error. There should be a stack trace." + +gdb_py_test_multiple "input command-calling function" \ + "python" "" \ + "class CallCommand(gdb.Function):" "" \ + " def __init__(self):" "" \ + " gdb.Function.__init__(self, 'call_command')" "" \ + " def invoke(self):" "" \ + " return gdb.execute('print 1', to_string=True)" "" \ + "CallCommand ()" "" \ + "end" "" + +gdb_test_no_output "set var \$foo = \$call_command()" "Setting a value from a function which executes a command." +# There was a bug where GDB would segfault in the second call, so try calling again. +gdb_test_no_output "set var \$foo = \$call_command()" "Setting a value from a function which executes a command, again." -- cgit v1.1