]>
Commit | Line | Data |
---|---|---|
ecd75fc8 | 1 | # Copyright 1998-2014 Free Software Foundation, Inc. |
c906108c SS |
2 | |
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 | |
e22f8b7c | 5 | # the Free Software Foundation; either version 3 of the License, or |
c906108c | 6 | # (at your option) any later version. |
e22f8b7c | 7 | # |
c906108c SS |
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. | |
e22f8b7c | 12 | # |
c906108c | 13 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
c906108c | 15 | |
c906108c | 16 | |
c906108c SS |
17 | clear_xfail "*-*-*" |
18 | ||
f8b41b00 | 19 | standard_testfile .c |
c906108c SS |
20 | |
21 | # Build the test case | |
fc91c6c2 | 22 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } { |
b60f0898 JB |
23 | untested jump.exp |
24 | return -1 | |
c906108c SS |
25 | } |
26 | ||
27 | ||
28 | # Start with a fresh gdb | |
29 | ||
f8b41b00 | 30 | clean_restart ${binfile} |
c906108c SS |
31 | |
32 | if ![runto_main] then { | |
33 | perror "Couldn't run to main" | |
34 | return -1 | |
35 | } | |
36 | ||
37 | # Set a breakpoint on the statement that we're about to jump to. | |
38 | # The statement doesn't contain a function call. | |
39 | # | |
c906108c | 40 | set bp_on_non_call 0 |
a76e022a MS |
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" | |
45 | } | |
c906108c SS |
46 | } |
47 | ||
48 | # Can we jump to the statement? Do we stop there? | |
49 | # | |
a76e022a MS |
50 | gdb_test "jump 22" "Breakpoint \[0-9\]*, .*${srcfile}:22.*" \ |
51 | "jump to non-call" | |
c906108c SS |
52 | |
53 | # Set a breakpoint on the statement that we're about to jump to. | |
54 | # The statement does contain a function call. | |
55 | # | |
c906108c | 56 | set bp_on_call 0 |
a76e022a MS |
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" | |
61 | } | |
c906108c SS |
62 | } |
63 | ||
64 | # Can we jump to the statement? Do we stop there? | |
65 | # | |
a76e022a MS |
66 | gdb_test "jump 21" \ |
67 | "Breakpoint \[0-9\]*, .*${srcfile}:21.*" \ | |
68 | "jump to call" | |
c906108c SS |
69 | |
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? | |
73 | # | |
a76e022a | 74 | gdb_test_no_output "disable $bp_on_call" "disable breakpoint on call" |
c906108c | 75 | |
a76e022a MS |
76 | gdb_test "jump 21" "Breakpoint \[0-9\]*, .*${srcfile}:22.*" \ |
77 | "jump to call with disabled breakpoint" | |
c906108c SS |
78 | |
79 | # Verify that GDB responds gracefully to the "jump" command without | |
80 | # an argument. | |
81 | # | |
a76e022a MS |
82 | gdb_test "jump" "Argument required .starting address.*" \ |
83 | "jump without argument disallowed" | |
84 | ||
c906108c SS |
85 | |
86 | # Verify that GDB responds gracefully to the "jump" command with | |
87 | # trailing junk. | |
88 | # | |
a76e022a | 89 | gdb_test "jump 21 100" \ |
40e084e1 | 90 | "malformed linespec error: unexpected number, \"100\"" \ |
a76e022a MS |
91 | "jump with trailing argument junk" |
92 | ||
c906108c SS |
93 | |
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.) | |
98 | # | |
99 | # Try it both ways: confirming and not confirming the jump. | |
100 | # | |
c906108c | 101 | |
a76e022a MS |
102 | gdb_test "jump 12" \ |
103 | "Not confirmed.*" \ | |
104 | "aborted jump out of current function" \ | |
105 | "Line 12 is not in `main'. Jump anyway.*y or n. $" \ | |
106 | "n" | |
107 | ||
108 | gdb_test "jump 12" \ | |
109 | "Continuing at.*" \ | |
110 | "jump out of current function" \ | |
111 | "Line 12 is not in `main'. Jump anyway.*y or n. $" \ | |
112 | "y" | |
c906108c SS |
113 | |
114 | gdb_exit | |
115 | return 0 |