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