2008-01-01 22:53:26 +00:00
# Copyright 2002, 2003, 2005, 2007, 2008 Free Software Foundation, Inc.
2003-02-02 05:51:09 +00:00
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
2007-08-23 18:14:19 +00:00
# the Free Software Foundation; either version 3 of the License, or
2003-02-02 05:51:09 +00:00
# (at your option) any later version.
2007-08-23 18:14:19 +00:00
#
2003-02-02 05:51:09 +00:00
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
2007-08-23 18:14:19 +00:00
#
2003-02-02 05:51:09 +00:00
# You should have received a copy of the GNU General Public License
2007-08-23 18:14:19 +00:00
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2003-02-02 05:51:09 +00:00
# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@prep.ai.mit.edu
# Test MI output with synthetic frames on the stack (call dummies,
# signal handlers).
2003-02-24 20:15:47 +00:00
if [target_info exists gdb,nosignals] {
verbose "Skipping mi-syn-frame.exp because of nosignals."
continue
}
2003-02-02 05:51:09 +00:00
load_lib mi-support.exp
set MIFLAGS "-i=mi"
set testfile "mi-syn-frame"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
2006-08-10 05:27:22 +00:00
untested mi-syn-frame.exp
return -1
2003-02-02 05:51:09 +00:00
}
mi_gdb_exit
2007-04-29 16:20:50 +00:00
mi_gdb_start
2003-02-02 05:51:09 +00:00
mi_run_to_main
2008-04-24 08:46:19 +00:00
mi_create_breakpoint "foo" 2 keep foo ".*mi-syn-frame.c" $decimal $hex \
"insert breakpoint foo"
2003-02-02 05:51:09 +00:00
#
# Call foo() by hand, where we'll hit a breakpoint.
#
gdb/
2008-04-04 Pedro Alves <pedro@codesourcery.com>
* mi/mi-cmds.h (enum mi_cmd_result): Delete MI_CMD_ERROR.
(mi_error_message): Delete declaration.
* mi/mi-interp.c (mi_cmd_interpreter_exec): Call error instead of
returning MI_CMD_ERROR.
* mi/mi-main.c (mi_error_message): Delete.
(mi_cmd_exec_interrupt):
(mi_cmd_thread_select, mi_cmd_thread_list_ids)
(mi_cmd_thread_info): Call error instead of returning
MI_CMD_ERROR.
(mi_cmd_data_list_register_values): Call error instead of
returning MI_CMD_ERROR. Adapt to new get_register interface.
(get_register): Change return typo to void. Call error instead of
returning MI_CMD_ERROR.
(mi_cmd_data_write_register_values): Call error instead of
returning MI_CMD_ERROR.
(mi_cmd_list_features): Return MI_CMD_DONE.
(captured_mi_execute_command): Remove MI_CMD_ERROR handling.
(mi_execute_command): Always print exceptions with -error.
gdb/testsuite/
2008-04-04 Pedro Alves <pedro@codesourcery.com>
* gdb.mi/mi-disassemble.exp, gdb.mi/mi-stack.exp,
gdb.mi/mi-syn-frame.exp, gdb.mi/mi-var-block.exp,
gdb.mi/mi-var-cmd.exp, gdb.mi/mi-var-display.exp,
gdb.mi/mi2-disassemble.exp, gdb.mi/mi2-stack.exp,
gdb.mi/mi2-syn-frame.exp, gdb.mi/mi2-var-block.exp,
gdb.mi/mi2-var-cmd.exp, gdb.mi/mi2-var-display.exp: Update to not
expect an mi error duplicated in stderr.
2008-04-04 21:59:25 +00:00
mi_gdb_test "401-data-evaluate-expression foo()" "401\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nWhen the function \\(foo\\) is done executing, GDB will silently\\\\nstop \\(instead of continuing to evaluate the expression containing\\\\nthe function call\\).\"" "call inferior's function with a breakpoint set in it"
2003-02-02 05:51:09 +00:00
2005-06-13 02:41:51 +00:00
mi_gdb_test "402-stack-list-frames" "402\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"foo\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\}.*\\\]" "backtrace from inferior function stopped at bp, showing gdb dummy frame"
2003-02-02 05:51:09 +00:00
#
# Continue back to main()
#
2005-08-04 01:52:31 +00:00
mi_gdb_test "403-exec-continue" \
2005-09-11 20:24:54 +00:00
"403\\^running" \
2007-04-29 16:20:50 +00:00
"testing exec continue"
2003-02-02 05:51:09 +00:00
2008-04-05 17:12:46 +00:00
# Presently, the *stopped notification for this case does not include
# any information. This can be considered a bug.
2008-04-24 12:09:49 +00:00
mi_gdb_test "" "\\*stopped" "finished exec continue"
2005-09-11 20:24:54 +00:00
2005-08-02 14:21:01 +00:00
mi_gdb_test "404-stack-list-frames 0 0" \
"404\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \
"list stack frames"
2003-02-02 05:51:09 +00:00
#
# Call have_a_very_merry_interrupt() which will eventually raise a signal
# that's caught by handler() which calls subroutine().
2008-04-24 08:46:19 +00:00
mi_create_breakpoint "subroutine" 3 keep subroutine ".*mi-syn-frame.c" $decimal $hex \
"insert breakpoint subroutine"
2003-02-02 05:51:09 +00:00
2005-08-02 14:21:01 +00:00
mi_gdb_test "406-data-evaluate-expression have_a_very_merry_interrupt()" \
gdb/
2008-04-04 Pedro Alves <pedro@codesourcery.com>
* mi/mi-cmds.h (enum mi_cmd_result): Delete MI_CMD_ERROR.
(mi_error_message): Delete declaration.
* mi/mi-interp.c (mi_cmd_interpreter_exec): Call error instead of
returning MI_CMD_ERROR.
* mi/mi-main.c (mi_error_message): Delete.
(mi_cmd_exec_interrupt):
(mi_cmd_thread_select, mi_cmd_thread_list_ids)
(mi_cmd_thread_info): Call error instead of returning
MI_CMD_ERROR.
(mi_cmd_data_list_register_values): Call error instead of
returning MI_CMD_ERROR. Adapt to new get_register interface.
(get_register): Change return typo to void. Call error instead of
returning MI_CMD_ERROR.
(mi_cmd_data_write_register_values): Call error instead of
returning MI_CMD_ERROR.
(mi_cmd_list_features): Return MI_CMD_DONE.
(captured_mi_execute_command): Remove MI_CMD_ERROR handling.
(mi_execute_command): Always print exceptions with -error.
gdb/testsuite/
2008-04-04 Pedro Alves <pedro@codesourcery.com>
* gdb.mi/mi-disassemble.exp, gdb.mi/mi-stack.exp,
gdb.mi/mi-syn-frame.exp, gdb.mi/mi-var-block.exp,
gdb.mi/mi-var-cmd.exp, gdb.mi/mi-var-display.exp,
gdb.mi/mi2-disassemble.exp, gdb.mi/mi2-stack.exp,
gdb.mi/mi2-syn-frame.exp, gdb.mi/mi2-var-block.exp,
gdb.mi/mi2-var-cmd.exp, gdb.mi/mi2-var-display.exp: Update to not
expect an mi error duplicated in stderr.
2008-04-04 21:59:25 +00:00
"406\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nWhen the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\nstop \\(instead of continuing to evaluate the expression containing\\\\nthe function call\\).\"" \
2007-04-29 16:20:50 +00:00
"data evaluate expression"
2003-02-02 05:51:09 +00:00
# We should have both a signal handler and a call dummy frame
# in this next output.
2005-08-02 14:21:01 +00:00
mi_gdb_test "407-stack-list-frames" \
"407\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"subroutine\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"handler\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"<signal handler called>\"\},.*frame=\{level=\"$decimal\",addr=\"$hex\",func=\"have_a_very_merry_interrupt\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \
"list stack frames"
2003-02-02 05:51:09 +00:00
2005-09-11 20:24:54 +00:00
mi_gdb_test "408-exec-continue" "408\\^running"
2008-04-24 12:09:49 +00:00
mi_gdb_test "" ".*\\*stopped.*" "finished exec continue"
2003-02-02 05:51:09 +00:00
2005-08-02 14:21:01 +00:00
mi_gdb_test "409-stack-list-frames 0 0" \
"409\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \
"list stack frames"
2003-02-02 05:51:09 +00:00
#
# Call bar() by hand, which should get an exception while running.
#
2005-08-04 01:52:31 +00:00
mi_gdb_test "410-data-evaluate-expression bar()" \
gdb/
2008-04-04 Pedro Alves <pedro@codesourcery.com>
* mi/mi-cmds.h (enum mi_cmd_result): Delete MI_CMD_ERROR.
(mi_error_message): Delete declaration.
* mi/mi-interp.c (mi_cmd_interpreter_exec): Call error instead of
returning MI_CMD_ERROR.
* mi/mi-main.c (mi_error_message): Delete.
(mi_cmd_exec_interrupt):
(mi_cmd_thread_select, mi_cmd_thread_list_ids)
(mi_cmd_thread_info): Call error instead of returning
MI_CMD_ERROR.
(mi_cmd_data_list_register_values): Call error instead of
returning MI_CMD_ERROR. Adapt to new get_register interface.
(get_register): Change return typo to void. Call error instead of
returning MI_CMD_ERROR.
(mi_cmd_data_write_register_values): Call error instead of
returning MI_CMD_ERROR.
(mi_cmd_list_features): Return MI_CMD_DONE.
(captured_mi_execute_command): Remove MI_CMD_ERROR handling.
(mi_execute_command): Always print exceptions with -error.
gdb/testsuite/
2008-04-04 Pedro Alves <pedro@codesourcery.com>
* gdb.mi/mi-disassemble.exp, gdb.mi/mi-stack.exp,
gdb.mi/mi-syn-frame.exp, gdb.mi/mi-var-block.exp,
gdb.mi/mi-var-cmd.exp, gdb.mi/mi-var-display.exp,
gdb.mi/mi2-disassemble.exp, gdb.mi/mi2-stack.exp,
gdb.mi/mi2-syn-frame.exp, gdb.mi/mi2-var-block.exp,
gdb.mi/mi2-var-cmd.exp, gdb.mi/mi2-var-display.exp: Update to not
expect an mi error duplicated in stderr.
2008-04-04 21:59:25 +00:00
"410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\"\\\\nEvaluation of the expression containing the function \\(bar\\) will be abandoned.\"" \
2007-04-29 16:20:50 +00:00
"call inferior function which raises exception"
2003-02-02 05:51:09 +00:00
2005-06-13 02:41:51 +00:00
mi_gdb_test "411-stack-list-frames" "411\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"bar\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"}.*\\\]" "backtrace from inferior function at exception"
2003-02-02 05:51:09 +00:00
mi_gdb_exit
return 0