1 # Copyright 1998-2014 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 3 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, see <http://www.gnu.org/licenses/>. */
22 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
28 # Start with a fresh gdb
30 clean_restart ${binfile}
32 if ![runto_main] then {
33 perror "Couldn't run to main"
37 # Set a breakpoint on the statement that we're about to jump to.
38 # The statement doesn't contain a function call.
41 gdb_test_multiple "break 22" "break before jump to non-call" {
42 -re "\[Bb\]reakpoint (\[0-9\]*) at 0x\[0-9a-fA-F\]*: file .*${srcfile}, line 22.*$gdb_prompt $" {
43 set bp_on_non_call $expect_out(1,string)
44 pass "break before jump to non-call"
48 # Can we jump to the statement? Do we stop there?
50 gdb_test "jump 22" "Breakpoint \[0-9\]*, .*${srcfile}:22.*" \
53 # Set a breakpoint on the statement that we're about to jump to.
54 # The statement does contain a function call.
57 gdb_test_multiple "break 21" "break before jump to call" {
58 -re "\[Bb\]reakpoint (\[0-9\]*) at 0x\[0-9a-fA-F\]*: file .*${srcfile}, line 21.*$gdb_prompt $" {
59 set bp_on_call $expect_out(1,string)
60 pass "break before jump to call"
64 # Can we jump to the statement? Do we stop there?
67 "Breakpoint \[0-9\]*, .*${srcfile}:21.*" \
70 # If we disable the breakpoint at the function call, and then
71 # if we jump to that statement, do we not stop there, but at
72 # the following breakpoint?
74 gdb_test_no_output "disable $bp_on_call" "disable breakpoint on call"
76 gdb_test "jump 21" "Breakpoint \[0-9\]*, .*${srcfile}:22.*" \
77 "jump to call with disabled breakpoint"
79 # Verify that GDB responds gracefully to the "jump" command without
82 gdb_test "jump" "Argument required .starting address.*" \
83 "jump without argument disallowed"
86 # Verify that GDB responds gracefully to the "jump" command with
89 gdb_test "jump 21 100" \
90 "malformed linespec error: unexpected number, \"100\"" \
91 "jump with trailing argument junk"
94 # Verify that GDB responds gracefully to a request to jump out of
95 # the current function. (Note that this will very likely cause the
96 # inferior to die. Be prepared to rerun the inferior, if further
97 # testing is desired.)
99 # Try it both ways: confirming and not confirming the jump.
104 "aborted jump out of current function" \
105 "Line 12 is not in `main'. Jump anyway.*y or n. $" \
110 "jump out of current function" \
111 "Line 12 is not in `main'. Jump anyway.*y or n. $" \