]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.reverse/finish-precsave.exp
* arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.reverse / finish-precsave.exp
CommitLineData
c5a57081 1# Copyright 2008-2012 Free Software Foundation, Inc.
02506ff1
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 19if ![supports_reverse] {
02506ff1
MS
20 return
21}
22
7686c074 23standard_testfile finish-reverse.c
02506ff1
MS
24
25if { [prepare_for_testing $testfile.exp "$testfile" $srcfile] } {
26 return -1
27}
28
29runto main
30
d3895d7d 31if [supports_process_record] {
02506ff1 32 # Activate process record/replay
bcd2dc50 33 gdb_test_no_output "record" "Turn on process record"
02506ff1
MS
34}
35
36# Run until end, then save execution log.
37
38set breakloc [gdb_get_line_number "end of main" "$srcfile"]
39gdb_test "break $breakloc" \
40 "Breakpoint $decimal at .*/$srcfile, line $breakloc\." \
41 "BP at end of main"
42
43gdb_test "continue" "Breakpoint .* end of main .*" "run to end of main"
44
45gdb_test "record save finish.precsave" \
46 "Saved core file finish.precsave with execution log\." \
47 "save process recfile"
48
49gdb_test "kill" "" "Kill process, prepare to debug log file" \
50 "Kill the program being debugged\\? \\(y or n\\) " "y"
51
52gdb_test "record restore finish.precsave" \
53 "Program terminated with signal .*" \
54 "reload precord save file"
55
56# Test finish from void func
57
58set breakloc [gdb_get_line_number "VOID FUNC" "$srcfile"]
59gdb_test "break void_func" \
60 "Breakpoint $decimal at .*/$srcfile, line $breakloc\." \
61 "set breakpoint on void_func"
62gdb_continue_to_breakpoint "void_func" ".*/$srcfile:$breakloc.*"
63
64set test_msg "finish from void_func"
65gdb_test_multiple "finish" "$test_msg" {
66 -re " call to void_func .*$gdb_prompt $" {
67 send_gdb "step\n"
68 exp_continue
69 }
70 -re " void_checkpoint .*$gdb_prompt $" {
71 pass "$test_msg"
72 }
73}
74
75# Test finish from char func
76
77set breakloc [gdb_get_line_number "CHAR FUNC" "$srcfile"]
78gdb_test "break char_func" \
79 "Breakpoint $decimal at .*/$srcfile, line $breakloc\." \
80 "set breakpoint on char_func"
81gdb_continue_to_breakpoint "char_func" ".*/$srcfile:$breakloc.*"
82
83set test_msg "finish from char_func"
84gdb_test_multiple "finish" "$test_msg" {
85 -re " void_checkpoint .*$gdb_prompt $" {
86 send_gdb "step\n"
87 exp_continue
88 }
89 -re " char_checkpoint .*$gdb_prompt $" {
90 pass "$test_msg"
91 }
92}
93
94# Test finish from short func
95
96set breakloc [gdb_get_line_number "SHORT FUNC" "$srcfile"]
97gdb_test "break short_func" \
98 "Breakpoint $decimal at .* line $breakloc\." \
99 "set breakpoint on short_func"
100gdb_continue_to_breakpoint "short_func" ".*/$srcfile:$breakloc.*"
101
102set test_msg "finish from short_func"
103gdb_test_multiple "finish" "$test_msg" {
104 -re " char_checkpoint .*$gdb_prompt $" {
105 send_gdb "step\n"
106 exp_continue
107 }
108 -re " short_checkpoint .*$gdb_prompt $" {
109 pass "$test_msg"
110 }
111}
112
113# Test finish from int func
114
115set breakloc [gdb_get_line_number "INT FUNC" "$srcfile"]
116gdb_test "break int_func" \
117 "Breakpoint $decimal at .* line $breakloc\." \
118 "set breakpoint on int_func"
119gdb_continue_to_breakpoint "int_func" ".*/$srcfile:$breakloc.*"
120
121set test_msg "finish from int_func"
122gdb_test_multiple "finish" "$test_msg" {
123 -re " short_checkpoint .*$gdb_prompt $" {
124 send_gdb "step\n"
125 exp_continue
126 }
127 -re " int_checkpoint .*$gdb_prompt $" {
128 pass "$test_msg"
129 }
130}
131
132# Test finish from long func
133
134set breakloc [gdb_get_line_number "LONG FUNC" "$srcfile"]
135gdb_test "break long_func" \
136 "Breakpoint $decimal at .* line $breakloc\." \
137 "set breakpoint on long_func"
138gdb_continue_to_breakpoint "long_func" ".*/$srcfile:$breakloc.*"
139
140set test_msg "finish from long_func"
141gdb_test_multiple "finish" "$test_msg" {
142 -re " int_checkpoint .*$gdb_prompt $" {
143 send_gdb "step\n"
144 exp_continue
145 }
146 -re " long_checkpoint .*$gdb_prompt $" {
147 pass "$test_msg"
148 }
149}
150
151# Test finish from long long func
152
153set breakloc [gdb_get_line_number "LONG LONG FUNC" "$srcfile"]
154gdb_test "break long_long_func" \
155 "Breakpoint $decimal at .* line $breakloc\." \
156 "set breakpoint on long_long_func"
157gdb_continue_to_breakpoint "long_long_func" ".*/$srcfile:$breakloc.*"
158
159set test_msg "finish from long_long_func"
160gdb_test_multiple "finish" "$test_msg" {
161 -re " long_checkpoint .*$gdb_prompt $" {
162 send_gdb "step\n"
163 exp_continue
164 }
165 -re " long_long_checkpoint .*$gdb_prompt $" {
166 pass "$test_msg"
167 }
168}
169
170
171###
172###
173###
174
175# Now switch to reverse
bcd2dc50 176gdb_test_no_output "set exec-dir reverse" "set reverse execution"
02506ff1
MS
177
178# Test reverse finish from long long func
179
180set breakloc [gdb_get_line_number "LONG LONG FUNC" "$srcfile"]
181gdb_continue_to_breakpoint "long_long_func" ".*/$srcfile:$breakloc.*"
182
183set test_msg "reverse finish from long_long_func"
184gdb_test_multiple "finish" "$test_msg" {
185 -re ".* long_checkpoint.*$gdb_prompt $" {
186 pass "$test_msg"
187 }
188}
189
190# Test reverse finish from long func
191
192set breakloc [gdb_get_line_number "LONG FUNC" "$srcfile"]
193gdb_continue_to_breakpoint "long_func" ".*/$srcfile:$breakloc.*"
194
195set test_msg "reverse finish from long_func"
196gdb_test_multiple "finish" "$test_msg" {
197 -re ".* int_checkpoint.*$gdb_prompt $" {
198 pass "$test_msg"
199 }
200}
201
202# Test reverse finish from int func
203
204set breakloc [gdb_get_line_number "INT FUNC" "$srcfile"]
205gdb_continue_to_breakpoint "int_func" ".*/$srcfile:$breakloc.*"
206
207set test_msg "reverse finish from int_func"
208gdb_test_multiple "finish" "$test_msg" {
209 -re ".* short_checkpoint.*$gdb_prompt $" {
210 pass "$test_msg"
211 }
212}
213
214# Test reverse finish from short func
215
216set breakloc [gdb_get_line_number "SHORT FUNC" "$srcfile"]
217gdb_continue_to_breakpoint "short_func" ".*/$srcfile:$breakloc.*"
218
219set test_msg "reverse finish from short_func"
220gdb_test_multiple "finish" "$test_msg" {
221 -re ".* char_checkpoint.*$gdb_prompt $" {
222 pass "$test_msg"
223 }
224}
225
226# Test reverse finish from char func
227
228set breakloc [gdb_get_line_number "CHAR FUNC" "$srcfile"]
229gdb_continue_to_breakpoint "char_func" ".*/$srcfile:$breakloc.*"
230
231set test_msg "reverse finish from char_func"
232gdb_test_multiple "finish" "$test_msg" {
233 -re ".* void_checkpoint.*$gdb_prompt $" {
234 pass "$test_msg"
235 }
236}
237
238# Test reverse finish from void func
239
240set breakloc [gdb_get_line_number "VOID FUNC" "$srcfile"]
241gdb_continue_to_breakpoint "void_func" ".*/$srcfile:$breakloc.*"
242
243set test_msg "reverse finish from void_func"
244gdb_test_multiple "finish" "$test_msg" {
245 -re ".* call to void_func.*$gdb_prompt $" {
246 pass "$test_msg"
247 }
248}