]>
Commit | Line | Data |
---|---|---|
4a94e368 | 1 | # Copyright 2008-2022 Free Software Foundation, Inc. |
28d41a99 MS |
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 | |
5 | # the Free Software Foundation; either version 3 of the License, or | |
6 | # (at your option) any later version. | |
7 | # | |
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. | |
12 | # | |
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/>. | |
15 | ||
16 | # This file is part of the GDB testsuite. It tests 'finish' with | |
17 | # reverse debugging. | |
18 | ||
d3895d7d | 19 | if ![supports_reverse] { |
28d41a99 MS |
20 | return |
21 | } | |
22 | ||
7686c074 | 23 | standard_testfile |
28d41a99 | 24 | |
5b362f04 | 25 | if { [prepare_for_testing "failed to prepare" "$testfile" $srcfile] } { |
28d41a99 MS |
26 | return -1 |
27 | } | |
28 | ||
50441f0f | 29 | runto_main |
28d41a99 | 30 | |
d3895d7d | 31 | if [supports_process_record] { |
28d41a99 | 32 | # Activate process record/replay |
9f058c10 | 33 | gdb_test_no_output "record" "turn on process record" |
28d41a99 MS |
34 | } |
35 | ||
36 | # Test finish from void func | |
37 | ||
38 | set breakloc [gdb_get_line_number "VOID FUNC" "$srcfile"] | |
39 | gdb_test "break void_func" \ | |
a80db015 | 40 | "Breakpoint $decimal at .*$srcfile, line $breakloc\." \ |
28d41a99 | 41 | "set breakpoint on void_func" |
a80db015 | 42 | gdb_continue_to_breakpoint "void_func" ".*$srcfile:$breakloc.*" |
28d41a99 MS |
43 | |
44 | set test_msg "finish from void_func" | |
45 | gdb_test_multiple "finish" "$test_msg" { | |
46 | -re " call to void_func .*$gdb_prompt $" { | |
47 | send_gdb "step\n" | |
48 | exp_continue | |
49 | } | |
50 | -re " void_checkpoint .*$gdb_prompt $" { | |
51 | pass "$test_msg" | |
52 | } | |
53 | } | |
54 | ||
55 | # Test finish from char func | |
56 | ||
57 | set breakloc [gdb_get_line_number "CHAR FUNC" "$srcfile"] | |
58 | gdb_test "break char_func" \ | |
a80db015 | 59 | "Breakpoint $decimal at .*$srcfile, line $breakloc\." \ |
28d41a99 | 60 | "set breakpoint on char_func" |
a80db015 | 61 | gdb_continue_to_breakpoint "char_func" ".*$srcfile:$breakloc.*" |
28d41a99 MS |
62 | |
63 | set test_msg "finish from char_func" | |
64 | gdb_test_multiple "finish" "$test_msg" { | |
65 | -re " void_checkpoint .*$gdb_prompt $" { | |
66 | send_gdb "step\n" | |
67 | exp_continue | |
68 | } | |
69 | -re " char_checkpoint .*$gdb_prompt $" { | |
70 | pass "$test_msg" | |
71 | } | |
72 | } | |
73 | ||
74 | # Test finish from short func | |
75 | ||
76 | set breakloc [gdb_get_line_number "SHORT FUNC" "$srcfile"] | |
77 | gdb_test "break short_func" \ | |
78 | "Breakpoint $decimal at .* line $breakloc\." \ | |
79 | "set breakpoint on short_func" | |
a80db015 | 80 | gdb_continue_to_breakpoint "short_func" ".*$srcfile:$breakloc.*" |
28d41a99 MS |
81 | |
82 | set test_msg "finish from short_func" | |
83 | gdb_test_multiple "finish" "$test_msg" { | |
84 | -re " char_checkpoint .*$gdb_prompt $" { | |
85 | send_gdb "step\n" | |
86 | exp_continue | |
87 | } | |
88 | -re " short_checkpoint .*$gdb_prompt $" { | |
89 | pass "$test_msg" | |
90 | } | |
91 | } | |
92 | ||
93 | # Test finish from int func | |
94 | ||
95 | set breakloc [gdb_get_line_number "INT FUNC" "$srcfile"] | |
96 | gdb_test "break int_func" \ | |
97 | "Breakpoint $decimal at .* line $breakloc\." \ | |
98 | "set breakpoint on int_func" | |
a80db015 | 99 | gdb_continue_to_breakpoint "int_func" ".*$srcfile:$breakloc.*" |
28d41a99 MS |
100 | |
101 | set test_msg "finish from int_func" | |
102 | gdb_test_multiple "finish" "$test_msg" { | |
103 | -re " short_checkpoint .*$gdb_prompt $" { | |
104 | send_gdb "step\n" | |
105 | exp_continue | |
106 | } | |
107 | -re " int_checkpoint .*$gdb_prompt $" { | |
108 | pass "$test_msg" | |
109 | } | |
110 | } | |
111 | ||
112 | # Test finish from long func | |
113 | ||
114 | set breakloc [gdb_get_line_number "LONG FUNC" "$srcfile"] | |
115 | gdb_test "break long_func" \ | |
116 | "Breakpoint $decimal at .* line $breakloc\." \ | |
117 | "set breakpoint on long_func" | |
a80db015 | 118 | gdb_continue_to_breakpoint "long_func" ".*$srcfile:$breakloc.*" |
28d41a99 MS |
119 | |
120 | set test_msg "finish from long_func" | |
121 | gdb_test_multiple "finish" "$test_msg" { | |
122 | -re " int_checkpoint .*$gdb_prompt $" { | |
123 | send_gdb "step\n" | |
124 | exp_continue | |
125 | } | |
126 | -re " long_checkpoint .*$gdb_prompt $" { | |
127 | pass "$test_msg" | |
128 | } | |
129 | } | |
130 | ||
131 | # Test finish from long long func | |
132 | ||
133 | set breakloc [gdb_get_line_number "LONG LONG FUNC" "$srcfile"] | |
134 | gdb_test "break long_long_func" \ | |
135 | "Breakpoint $decimal at .* line $breakloc\." \ | |
136 | "set breakpoint on long_long_func" | |
a80db015 | 137 | gdb_continue_to_breakpoint "long_long_func" ".*$srcfile:$breakloc.*" |
28d41a99 MS |
138 | |
139 | set test_msg "finish from long_long_func" | |
140 | gdb_test_multiple "finish" "$test_msg" { | |
141 | -re " long_checkpoint .*$gdb_prompt $" { | |
142 | send_gdb "step\n" | |
143 | exp_continue | |
144 | } | |
145 | -re " long_long_checkpoint .*$gdb_prompt $" { | |
146 | pass "$test_msg" | |
147 | } | |
148 | } | |
149 | ||
150 | ||
151 | ### | |
152 | ### | |
153 | ### | |
154 | ||
155 | # Now switch to reverse | |
bcd2dc50 | 156 | gdb_test_no_output "set exec-dir reverse" "set reverse execution" |
28d41a99 MS |
157 | |
158 | # Test reverse finish from long long func | |
159 | ||
160 | set breakloc [gdb_get_line_number "LONG LONG FUNC" "$srcfile"] | |
4d421147 AB |
161 | gdb_continue_to_breakpoint "long_long_func backward" \ |
162 | ".*$srcfile:$breakloc.*" | |
28d41a99 MS |
163 | |
164 | set test_msg "reverse finish from long_long_func" | |
165 | gdb_test_multiple "finish" "$test_msg" { | |
166 | -re ".* long_checkpoint.*$gdb_prompt $" { | |
dcd5da87 | 167 | pass "$test_msg" |
28d41a99 MS |
168 | } |
169 | } | |
170 | ||
171 | # Test reverse finish from long func | |
172 | ||
173 | set breakloc [gdb_get_line_number "LONG FUNC" "$srcfile"] | |
4d421147 AB |
174 | gdb_continue_to_breakpoint "long_func backward" \ |
175 | ".*$srcfile:$breakloc.*" | |
28d41a99 MS |
176 | |
177 | set test_msg "reverse finish from long_func" | |
178 | gdb_test_multiple "finish" "$test_msg" { | |
179 | -re ".* int_checkpoint.*$gdb_prompt $" { | |
dcd5da87 | 180 | pass "$test_msg" |
28d41a99 MS |
181 | } |
182 | } | |
183 | ||
184 | # Test reverse finish from int func | |
185 | ||
186 | set breakloc [gdb_get_line_number "INT FUNC" "$srcfile"] | |
4d421147 AB |
187 | gdb_continue_to_breakpoint "int_func backward" \ |
188 | ".*$srcfile:$breakloc.*" | |
28d41a99 MS |
189 | |
190 | set test_msg "reverse finish from int_func" | |
191 | gdb_test_multiple "finish" "$test_msg" { | |
192 | -re ".* short_checkpoint.*$gdb_prompt $" { | |
dcd5da87 | 193 | pass "$test_msg" |
28d41a99 MS |
194 | } |
195 | } | |
196 | ||
197 | # Test reverse finish from short func | |
198 | ||
199 | set breakloc [gdb_get_line_number "SHORT FUNC" "$srcfile"] | |
4d421147 AB |
200 | gdb_continue_to_breakpoint "short_func backward" \ |
201 | ".*$srcfile:$breakloc.*" | |
28d41a99 MS |
202 | |
203 | set test_msg "reverse finish from short_func" | |
204 | gdb_test_multiple "finish" "$test_msg" { | |
205 | -re ".* char_checkpoint.*$gdb_prompt $" { | |
dcd5da87 | 206 | pass "$test_msg" |
28d41a99 MS |
207 | } |
208 | } | |
209 | ||
210 | # Test reverse finish from char func | |
211 | ||
212 | set breakloc [gdb_get_line_number "CHAR FUNC" "$srcfile"] | |
4d421147 AB |
213 | gdb_continue_to_breakpoint "char_func backward" \ |
214 | ".*$srcfile:$breakloc.*" | |
28d41a99 MS |
215 | |
216 | set test_msg "reverse finish from char_func" | |
217 | gdb_test_multiple "finish" "$test_msg" { | |
218 | -re ".* void_checkpoint.*$gdb_prompt $" { | |
dcd5da87 | 219 | pass "$test_msg" |
28d41a99 MS |
220 | } |
221 | } | |
222 | ||
223 | # Test reverse finish from void func | |
224 | ||
225 | set breakloc [gdb_get_line_number "VOID FUNC" "$srcfile"] | |
4d421147 AB |
226 | gdb_continue_to_breakpoint "void_func backward" \ |
227 | ".*$srcfile:$breakloc.*" | |
28d41a99 MS |
228 | |
229 | set test_msg "reverse finish from void_func" | |
230 | gdb_test_multiple "finish" "$test_msg" { | |
231 | -re ".* call to void_func.*$gdb_prompt $" { | |
dcd5da87 | 232 | pass "$test_msg" |
28d41a99 MS |
233 | } |
234 | } |