1 # Copyright 1998, 1999, 2007, 2008, 2009, 2010
2 # Free Software Foundation, Inc.
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 3 of the License, or
7 # (at your option) any later version.
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.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>. */
27 set srcfile ${testfile}.c
28 set binfile ${objdir}/${subdir}/${testfile}
31 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
37 # Start with a fresh gdb
41 gdb_reinitialize_dir $srcdir/$subdir
44 if ![runto_main] then {
45 perror "Couldn't run to main"
49 # Set a breakpoint on the statement that we're about to jump to.
50 # The statement doesn't contain a function call.
55 -re "\[Bb\]reakpoint (\[0-9\]*) at 0x\[0-9a-fA-F\]*: file .*${srcfile}, line 22.*$gdb_prompt $"\
56 {set bp_on_non_call $expect_out(1,string)
57 pass "break before jump to non-call"}
59 {fail "break before jump to non-call"}
60 timeout {fail "(timeout) break before jump to non-call"}
63 # Can we jump to the statement? Do we stop there?
67 -re "Breakpoint \[0-9\]*, .*${srcfile}:22.*$gdb_prompt $"\
68 {pass "jump to non-call"}
70 {fail "jump to non-call"}
71 timeout {fail "(timeout) jump to non-call"}
74 # Set a breakpoint on the statement that we're about to jump to.
75 # The statement does contain a function call.
80 -re "\[Bb\]reakpoint (\[0-9\]*) at 0x\[0-9a-fA-F\]*: file .*${srcfile}, line 21.*$gdb_prompt $"\
81 {set bp_on_call $expect_out(1,string)
82 pass "break before jump to call"}
84 {fail "break before jump to call"}
85 timeout {fail "(timeout) break before jump to call"}
88 # Can we jump to the statement? Do we stop there?
92 -re "Breakpoint \[0-9\]*, .*${srcfile}:21.*$gdb_prompt $"\
96 timeout {fail "(timeout) jump to call"}
99 # If we disable the breakpoint at the function call, and then
100 # if we jump to that statement, do we not stop there, but at
101 # the following breakpoint?
103 send_gdb "disable $bp_on_call\n"
106 {pass "disable breakpoint on call"}
107 timeout {fail "(timeout) disable breakpoint on call"}
112 -re "Breakpoint \[0-9\]*, .*${srcfile}:22.*$gdb_prompt $"\
113 {pass "jump to call with disabled breakpoint"}
115 {fail "jump to call with disabled breakpoint"}
116 timeout {fail "(timeout) jump to call with disabled breakpoint"}
119 # Verify that GDB responds gracefully to the "jump" command without
124 -re "Argument required .starting address..*$gdb_prompt $"\
125 {pass "jump without argument disallowed"}
127 {fail "jump without argument disallowed"}
128 timeout {fail "(timeout) jump without argument disallowed"}
131 # Verify that GDB responds gracefully to the "jump" command with
134 send_gdb "jump 21 100\n"
136 -re "Junk at end of line specification: 100.*$gdb_prompt $"\
137 {pass "jump with trailing argument junk"}
139 {fail "jump with trailing argument junk"}
140 timeout {fail "(timeout) jump with trailing argument junk"}
143 # Verify that GDB responds gracefully to a request to jump out of
144 # the current function. (Note that this will very likely cause the
145 # inferior to die. Be prepared to rerun the inferior, if further
146 # testing is desired.)
148 # Try it both ways: confirming and not confirming the jump.
152 -re "Line 12 is not in `main'. Jump anyway.*y or n. $"\
155 -re "Not confirmed.*$gdb_prompt $"\
156 {pass "aborted jump out of current function"}
158 {fail "aborted jump out of current function"}
159 timeout {fail "(timeout) aborted jump out of current function"}
163 {fail "aborted jump out of current function"}
164 timeout {fail "(timeout) aborted jump out of current function"}
169 -re "Line 12 is not in `main'. Jump anyway.*y or n. $"\
172 -re "Continuing at.*$gdb_prompt $"\
173 {pass "jump out of current function"}
175 {fail "jump out of current function"}
176 timeout {fail "(timeout) jump out of current function"}
180 {fail "jump out of current function"}
181 timeout {fail "(timeout) jump out of current function"}