* 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.
This commit is contained in:
Thiago Jung Bauermann 2011-05-13 04:34:25 +00:00
parent c9eaa05f39
commit 028d0ed5d1
8 changed files with 68 additions and 8 deletions

View file

@ -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."