Move 2006 ChangeLog entries to ChangeLog-2006.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi2-syn-frame.exp
CommitLineData
76ff342d
DJ
1# Copyright 2002, 2003, 2005
2# Free Software Foundation, Inc.
2fcf52f0
AC
3
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 2 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18# Please email any bugs, comments, and/or additions to this file to:
19# bug-gdb@prep.ai.mit.edu
20
21# Test MI output with synthetic frames on the stack (call dummies,
22# signal handlers).
23
24if [target_info exists gdb,nosignals] {
25 verbose "Skipping mi-syn-frame.exp because of nosignals."
26 continue
27}
28
29load_lib mi-support.exp
30set MIFLAGS "-i=mi2"
31
32set testfile "mi-syn-frame"
33set srcfile ${testfile}.c
34set binfile ${objdir}/${subdir}/${testfile}
35if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
b60f0898
JB
36 untested mi2-syn-frame.exp
37 return -1
2fcf52f0
AC
38}
39
40set my_mi_gdb_prompt "\\(gdb\\)\[ \]*\[\r\n\]*"
41
42mi_gdb_exit
43mi_gdb_start
44mi_delete_breakpoints
45mi_gdb_reinitialize_dir $srcdir/$subdir
46mi_gdb_load ${binfile}
47mi_run_to_main
48
f1ea48cb
BR
49mi_gdb_test "400-break-insert foo" \
50 "400\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"foo\",file=\".*mi-syn-frame.c\",line=\"$decimal\",times=\"0\"\}" \
51 "insert breakpoint foo"
2fcf52f0
AC
52
53
54#
55# Call foo() by hand, where we'll hit a breakpoint.
56#
57
58mi_gdb_test "401-data-evaluate-expression foo()" "\\&\"The program being debugged stopped while in a function called from GDB.\\\\n\"\[\r\n\]+\\&\"When the function \\(foo\\) is done executing, GDB will silently\\\\n\"\[\r\n\]+\\&\"stop \\(instead of continuing to evaluate the expression containing\\\\n\"\[\r\n\]+\\&\"the function call\\).\\\\n\"\[\r\n\]+401\\^error,msg=\"The program being debugged stopped while in a function called from GDB.*\"" "call inferior's function with a breakpoint set in it"
59
589e074d 60mi_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"
2fcf52f0
AC
61
62#
63# Continue back to main()
64#
65
66send_gdb "403-exec-continue\n"
67gdb_expect {
68 -re "403\\^running\[\r\n\]+${my_mi_gdb_prompt}hi in foo\[\r\n\]+403\\\*stopped\[\r\n\]+${my_mi_gdb_prompt}$" {
69 pass "403-exec-continue"
70 }
71 timeout {
72 fail "403-exec-continue"
73 }
74}
75
f1ea48cb
BR
76mi_gdb_test "404-stack-list-frames 0 0" \
77 "404\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \
78 "list stack frames"
2fcf52f0
AC
79
80
81#
82# Call have_a_very_merry_interrupt() which will eventually raise a signal
83# that's caught by handler() which calls subroutine().
84
f1ea48cb
BR
85mi_gdb_test "405-break-insert subroutine" \
86 "405\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"subroutine\",file=\".*mi-syn-frame.c\",line=\"$decimal\",times=\"0\"\}" \
87 "insert breakpoint subroutine"
2fcf52f0 88
f1ea48cb
BR
89mi_gdb_test "406-data-evaluate-expression have_a_very_merry_interrupt()" \
90 "Waiting to get a signal\[\r\n\]+\\&\"The program being debugged stopped while in a function called from GDB.\\\\n\"\[\r\n\]+\\&\"When the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\n\"\[\r\n\]+\\&\"stop \\(instead of continuing to evaluate the expression containing\\\\n\"\[\r\n\]+\\&\"the function call\\).\\\\n\"\[\r\n\]+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\\).\"" \
91 "evaluate expression have_a_very_merry_interrupt"
2fcf52f0
AC
92
93# We should have both a signal handler and a call dummy frame
94# in this next output.
95
f1ea48cb
BR
96mi_gdb_test "407-stack-list-frames" \
97 "407\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"subroutine\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"handler\",file=\".*mi-syn-frame.c\",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\",line=\"$decimal\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\}.*\\\]" \
98 "list stack frames"
2fcf52f0
AC
99
100
101send_gdb "408-exec-continue\n"
102gdb_expect {
103 -re "408\\^running\[\r\n\]+${my_mi_gdb_prompt}408\\\*stopped\[\r\n\]+${my_mi_gdb_prompt}$" {
104 pass "408-exec-continue"
105 }
106 timeout {
107 fail "408-exec-continue"
108 }
109}
110
f1ea48cb
BR
111mi_gdb_test "409-stack-list-frames 0 0" \
112 "409\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \
113 "list stack frames"
2fcf52f0
AC
114
115#
116# Call bar() by hand, which should get an exception while running.
117#
118
119mi_gdb_test "410-data-evaluate-expression bar()" "hi in bar\[\r\n\]+\\&\"The program being debugged was signaled while in a function called from GDB.\\\\n\"\[\r\n\]+\\&\"GDB remains in the frame where the signal was received.\\\\n\"\[\r\n\]+\\&\"To change this behavior use \\\\\"set unwindonsignal on\\\\\"\\\\n\"\[\r\n\]+\\&\"Evaluation of the expression containing the function \\(bar\\) will be abandoned.\\\\n\"\[\r\n\]+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.\"" "call inferior function which raises exception"
120
589e074d 121mi_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"
2fcf52f0
AC
122
123mi_gdb_exit
124
125return 0
This page took 0.333061 seconds and 4 git commands to generate.