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