]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.reverse/finish-reverse.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.reverse / finish-reverse.exp
CommitLineData
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 19require supports_reverse
28d41a99 20
7686c074 21standard_testfile
28d41a99 22
5b362f04 23if { [prepare_for_testing "failed to prepare" "$testfile" $srcfile] } {
28d41a99
MS
24 return -1
25}
26
50441f0f 27runto_main
28d41a99 28
d3895d7d 29if [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
36set breakloc [gdb_get_line_number "VOID FUNC" "$srcfile"]
37gdb_test "break void_func" \
a80db015 38 "Breakpoint $decimal at .*$srcfile, line $breakloc\." \
28d41a99 39 "set breakpoint on void_func"
a80db015 40gdb_continue_to_breakpoint "void_func" ".*$srcfile:$breakloc.*"
28d41a99
MS
41
42set test_msg "finish from void_func"
43gdb_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
55set breakloc [gdb_get_line_number "CHAR FUNC" "$srcfile"]
56gdb_test "break char_func" \
a80db015 57 "Breakpoint $decimal at .*$srcfile, line $breakloc\." \
28d41a99 58 "set breakpoint on char_func"
a80db015 59gdb_continue_to_breakpoint "char_func" ".*$srcfile:$breakloc.*"
28d41a99
MS
60
61set test_msg "finish from char_func"
62gdb_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
74set breakloc [gdb_get_line_number "SHORT FUNC" "$srcfile"]
75gdb_test "break short_func" \
76 "Breakpoint $decimal at .* line $breakloc\." \
77 "set breakpoint on short_func"
a80db015 78gdb_continue_to_breakpoint "short_func" ".*$srcfile:$breakloc.*"
28d41a99
MS
79
80set test_msg "finish from short_func"
81gdb_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
93set breakloc [gdb_get_line_number "INT FUNC" "$srcfile"]
94gdb_test "break int_func" \
95 "Breakpoint $decimal at .* line $breakloc\." \
96 "set breakpoint on int_func"
a80db015 97gdb_continue_to_breakpoint "int_func" ".*$srcfile:$breakloc.*"
28d41a99
MS
98
99set test_msg "finish from int_func"
100gdb_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
112set breakloc [gdb_get_line_number "LONG FUNC" "$srcfile"]
113gdb_test "break long_func" \
114 "Breakpoint $decimal at .* line $breakloc\." \
115 "set breakpoint on long_func"
a80db015 116gdb_continue_to_breakpoint "long_func" ".*$srcfile:$breakloc.*"
28d41a99
MS
117
118set test_msg "finish from long_func"
119gdb_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
131set breakloc [gdb_get_line_number "LONG LONG FUNC" "$srcfile"]
132gdb_test "break long_long_func" \
133 "Breakpoint $decimal at .* line $breakloc\." \
134 "set breakpoint on long_long_func"
a80db015 135gdb_continue_to_breakpoint "long_long_func" ".*$srcfile:$breakloc.*"
28d41a99
MS
136
137set test_msg "finish from long_long_func"
138gdb_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 154gdb_test_no_output "set exec-dir reverse" "set reverse execution"
28d41a99
MS
155
156# Test reverse finish from long long func
157
158set breakloc [gdb_get_line_number "LONG LONG FUNC" "$srcfile"]
4d421147
AB
159gdb_continue_to_breakpoint "long_long_func backward" \
160 ".*$srcfile:$breakloc.*"
28d41a99
MS
161
162set test_msg "reverse finish from long_long_func"
163gdb_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
171set breakloc [gdb_get_line_number "LONG FUNC" "$srcfile"]
4d421147
AB
172gdb_continue_to_breakpoint "long_func backward" \
173 ".*$srcfile:$breakloc.*"
28d41a99
MS
174
175set test_msg "reverse finish from long_func"
176gdb_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
184set breakloc [gdb_get_line_number "INT FUNC" "$srcfile"]
4d421147
AB
185gdb_continue_to_breakpoint "int_func backward" \
186 ".*$srcfile:$breakloc.*"
28d41a99
MS
187
188set test_msg "reverse finish from int_func"
189gdb_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
197set breakloc [gdb_get_line_number "SHORT FUNC" "$srcfile"]
4d421147
AB
198gdb_continue_to_breakpoint "short_func backward" \
199 ".*$srcfile:$breakloc.*"
28d41a99
MS
200
201set test_msg "reverse finish from short_func"
202gdb_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
210set breakloc [gdb_get_line_number "CHAR FUNC" "$srcfile"]
4d421147
AB
211gdb_continue_to_breakpoint "char_func backward" \
212 ".*$srcfile:$breakloc.*"
28d41a99
MS
213
214set test_msg "reverse finish from char_func"
215gdb_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
223set breakloc [gdb_get_line_number "VOID FUNC" "$srcfile"]
4d421147
AB
224gdb_continue_to_breakpoint "void_func backward" \
225 ".*$srcfile:$breakloc.*"
28d41a99
MS
226
227set test_msg "reverse finish from void_func"
228gdb_test_multiple "finish" "$test_msg" {
229 -re ".* call to void_func.*$gdb_prompt $" {
dcd5da87 230 pass "$test_msg"
28d41a99
MS
231 }
232}