1 # Copyright
1998, 1999 Free Software Foundation
, Inc.
3 # This
program is free software
; you can redistribute it and
/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation
; either version
2 of the License
, or
6 #
(at your option
) any later version.
8 # This
program is distributed in the hope that it will be useful
,
9 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License
for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this
program; if not
, write to the Free Software
15 # Foundation
, Inc.
, 59 Temple Place
- Suite
330, Boston
, MA
02111-1307, USA.
*/
17 # Please email
any bugs
, comments
, and
/or additions to this file to
:
18 # bug
-gdb@prep.ai.mit.edu
30 set srcfile $
{testfile
}.c
31 set binfile $
{objdir
}/$
{subdir
}/$
{testfile
}
34 if { [gdb_compile
"${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
35 gdb_suppress_entire_file
"Testcase compile failed, so all tests in this file will automatically fail."
39 # Start with a fresh gdb
43 gdb_reinitialize_dir $srcdir
/$subdir
46 if ![runto_main
] then {
47 perror
"Couldn't run to main"
51 #
Set a breakpoint
on the statement that we
're about to jump to.
52 # The statement doesn't contain a function
call.
57 -re
"\[Bb\]reakpoint (\[0-9\]*) at 0x\[0-9a-fA-F\]*: file .*${srcfile}, line 22.*$gdb_prompt $"\
58 {set bp_on_non_call $expect_out
(1,string
)
59 pass
"break before jump to non-call"}
61 {fail
"break before jump to non-call"}
62 timeout
{fail
"(timeout) break before jump to non-call"}
65 # Can we jump to the statement?
Do we stop there?
69 -re
"Breakpoint \[0-9\]*, .*${srcfile}:22.*$gdb_prompt $"\
70 {pass
"jump to non-call"}
72 {fail
"jump to non-call"}
73 timeout
{fail
"(timeout) jump to non-call"}
76 #
Set a breakpoint
on the statement that we
're about to jump to.
77 # The statement does contain a function call.
82 -re "\[Bb\]reakpoint (\[0-9\]*) at 0x\[0-9a-fA-F\]*: file .*${srcfile}, line 21.*$gdb_prompt $"\
83 {set bp_on_call $expect_out(1,string)
84 pass "break before jump to call"}
86 {fail "break before jump to call"}
87 timeout {fail "(timeout) break before jump to call"}
90 # Can we jump to the statement? Do we stop there?
94 -re "Breakpoint \[0-9\]*, .*${srcfile}:21.*$gdb_prompt $"\
98 timeout {fail "(timeout) jump to call"}
101 # If we disable the breakpoint at the function call, and then
102 # if we jump to that statement, do we not stop there, but at
103 # the following breakpoint?
105 send_gdb "disable $bp_on_call\n"
108 {pass "disable breakpoint on call"}
109 timeout {fail "(timeout) disable breakpoint on call"}
114 -re "Breakpoint \[0-9\]*, .*${srcfile}:22.*$gdb_prompt $"\
115 {pass "jump to call with disabled breakpoint"}
117 {fail "jump to call with disabled breakpoint"}
118 timeout {fail "(timeout) jump to call with disabled breakpoint"}
121 # Verify that GDB responds gracefully to the "jump" command without
126 -re "Argument required .starting address..*$gdb_prompt $"\
127 {pass "jump without argument disallowed"}
129 {fail "jump without argument disallowed"}
130 timeout {fail "(timeout) jump without argument disallowed"}
133 # Verify that GDB responds gracefully to the "jump" command with
136 send_gdb "jump 21 100\n"
138 -re "Junk at end of line specification: 100.*$gdb_prompt $"\
139 {pass "jump with trailing argument junk"}
141 {fail "jump with trailing argument junk"}
142 timeout {fail "(timeout) jump with trailing argument junk"}
145 # Verify that GDB responds gracefully to a request to jump out of
146 # the current function. (Note that this will very likely cause the
147 # inferior to die. Be prepared to rerun the inferior, if further
148 # testing is desired.)
150 # Try it both ways: confirming and not confirming the jump.
154 -re "Line 12 is not in `main'. Jump anyway.
*y or n. $
"\
157 -re
"Not confirmed.*$gdb_prompt $"\
158 {pass
"aborted jump out of current function"}
160 {fail
"aborted jump out of current function"}
161 timeout
{fail
"(timeout) aborted jump out of current function"}
165 {fail
"aborted jump out of current function"}
166 timeout
{fail
"(timeout) aborted jump out of current function"}
171 -re
"Line 12 is not in `main'. Jump anyway.*y or n. $"\
174 -re
"Continuing at.*$gdb_prompt $"\
175 {pass
"jump out of current function"}
177 {fail
"jump out of current function"}
178 timeout
{fail
"(timeout) jump out of current function"}
182 {fail
"jump out of current function"}
183 timeout
{fail
"(timeout) jump out of current function"}