[gdb/testsuite] Add KFAIL for missing support of reverse-debugging xsave
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.reverse / step-precsave.exp
1 # Copyright 2008-2019 Free Software Foundation, Inc.
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 reverse stepping.
17 # Lots of code borrowed from "step-test.exp".
18
19 #
20 # Test step and next with a reloaded process record file.
21 #
22
23 # This test suitable only for process record-replay
24 if ![supports_process_record] {
25 return
26 }
27
28 standard_testfile step-reverse.c
29 set precsave [standard_output_file step.precsave]
30
31 if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
32 return -1
33 }
34
35 runto main
36
37 if [supports_process_record] {
38 # Activate process record/replay
39 gdb_test_no_output "record" "turn on process record"
40 }
41
42 set end_of_main [gdb_get_line_number "end of main" ]
43 gdb_test "break $end_of_main" \
44 "Breakpoint $decimal at .*$srcfile, line $end_of_main\." \
45 "breakpoint at end of main"
46
47 # This can take awhile.
48 with_timeout_factor 20 {
49 set test "run to end of main"
50 set pass_pattern "Breakpoint .* end of main .*"
51 set kfail_pattern "Process record does not support instruction 0xc5 at.*"
52 set kfail2_pattern "Process record does not support instruction 0xfae64 at.*"
53 gdb_test_multiple "continue" $test {
54 -re "\[\r\n\]*(?:$pass_pattern)\[\r\n\]+$gdb_prompt $" {
55 pass $test
56 }
57 -re "\[\r\n\]*(?:$kfail_pattern)\[\r\n\]+$gdb_prompt $" {
58 kfail "record/23188" $test
59 }
60 -re "\[\r\n\]*(?:$kfail2_pattern)\[\r\n\]+$gdb_prompt $" {
61 kfail "record/25038" $test
62 }
63 }
64 }
65
66 # So can this, against gdbserver, for example.
67
68 with_timeout_factor 10 {
69 gdb_test "record save $precsave" \
70 "Saved core file $precsave with execution log\." \
71 "save process recfile"
72 }
73
74 gdb_test "kill" "" "kill process, prepare to debug log file" \
75 "Kill the program being debugged\\? \\(y or n\\) " "y"
76
77 gdb_test "record restore $precsave" \
78 "Restored records from core file .*" \
79 "reload core file"
80
81 # plain vanilla step/next (no count)
82
83 gdb_test "next" ".*NEXT TEST 1.*" "next test 1"
84 gdb_test "step" ".*STEP TEST 1.*" "step test 1"
85
86 # step/next with count
87
88 gdb_test "next 2" ".*NEXT TEST 2.*" "next test 2"
89 gdb_test "step 3" ".*STEP TEST 2.*" "step test 2"
90
91 # step over call
92
93 gdb_test "step" ".*NEXT OVER THIS CALL.*" "step up to call"
94 gdb_test "next" ".*STEP INTO THIS CALL.*" "next over call"
95
96 # step into call
97
98 gdb_test "step" ".*ARRIVED IN CALLEE.*" "step into call"
99
100 # finish out of call
101
102 set test_message "finish out of fn call"
103 gdb_test_multiple "finish" "$test_message" {
104 -re "FINISH TEST.*$gdb_prompt $" {
105 pass "$test_message"
106 }
107 -re "STEP INTO THIS CALL.*$gdb_prompt $" {
108 send_gdb "step\n"
109 exp_continue
110 }
111 }
112
113 # stepi over flat code (no calls)
114
115 set test_message "simple stepi"
116 gdb_test_multiple "stepi" "$test_message" {
117 -re "STEPI TEST.*$gdb_prompt $" {
118 pass "$test_message"
119 }
120 -re "FINISH TEST.*$gdb_prompt $" {
121 send_gdb "stepi\n"
122 exp_continue
123 }
124 -re "NEXTI TEST.*$gdb_prompt $" {
125 fail "$test_message (too far)"
126 }
127 }
128
129 # stepi into a function call
130
131 set test_message "stepi into function call"
132 gdb_test_multiple "stepi" "$test_message" {
133 -re "ARRIVED IN CALLEE.*$gdb_prompt $" {
134 pass "$test_message"
135 }
136 -re "NEXTI TEST.*$gdb_prompt $" {
137 fail "$test_message (too far)"
138 }
139 -re "RETURN FROM CALLEE.*$gdb_prompt $" {
140 fail "$test_message (too far)"
141 }
142 -re "ENTER CALLEE.*$gdb_prompt $" {
143 send_gdb "stepi\n"
144 exp_continue
145 }
146 -re "STEPI TEST.*$gdb_prompt $" {
147 send_gdb "stepi\n"
148 exp_continue
149 }
150 }
151
152 # stepi thru return of a function call
153
154 set test_message "stepi back from function call"
155 gdb_test_multiple "stepi" "$test_message" {
156 -re "NEXTI TEST.*$gdb_prompt $" {
157 pass "$test_message"
158 }
159 -re "ARRIVED IN CALLEE.*$gdb_prompt $" {
160 send_gdb "stepi\n"
161 exp_continue
162 }
163 -re "RETURN FROM CALLEE.*$gdb_prompt $" {
164 send_gdb "stepi\n"
165 exp_continue
166 }
167 -re "STEPI TEST.*$gdb_prompt $" {
168 send_gdb "stepi\n"
169 exp_continue
170 }
171 -re "ENTER CALLEE.*$gdb_prompt $" {
172 fail "$test_message (too far)"
173 }
174 }
175
176 ###
177 ###
178 ###
179
180 # Set reverse execution direction
181
182 gdb_test_no_output "set exec-dir reverse" "set reverse execution"
183
184 # stepi backward thru return and into a function
185
186 set stepi_location [gdb_get_line_number "ARRIVED IN CALLEE" "$srcfile"]
187 set test_message "reverse stepi thru function return"
188 gdb_test_multiple "stepi" "$test_message" {
189 -re "NEXTI TEST.*$gdb_prompt $" {
190 fail "$test_message (start statement)"
191 }
192 -re "RETURN FROM CALLEE.*$gdb_prompt $" {
193 send_gdb "stepi\n"
194 exp_continue
195 }
196 -re "$hex\[ \t\]*$stepi_location.*ARRIVED IN CALLEE.*$gdb_prompt $" {
197 send_gdb "stepi\n"
198 exp_continue
199 }
200 -re "ARRIVED IN CALLEE.*$gdb_prompt $" {
201 pass "$test_message"
202 }
203 -re "ENTER CALLEE.*$gdb_prompt $" {
204 fail "$test_message (too far)"
205 }
206 -re "STEPI TEST.*$gdb_prompt $" {
207 fail "$test_message (too far)"
208 }
209 }
210
211 # stepi backward out of a function call
212
213 set stepi_location [gdb_get_line_number "STEPI TEST" "$srcfile"]
214 set test_message "reverse stepi from a function call"
215 gdb_test_multiple "stepi" "$test_message" {
216 -re "ARRIVED IN CALLEE.*$gdb_prompt $" {
217 fail "$test_message (start statement)"
218 }
219 -re "ENTER CALLEE.*$gdb_prompt $" {
220 send_gdb "stepi\n"
221 exp_continue
222 }
223 -re "${hex} in main .*:$stepi_location.*STEPI TEST.*$gdb_prompt $" {
224 send_gdb "stepi\n"
225 exp_continue
226 }
227 -re "STEPI TEST.*$gdb_prompt $" {
228 pass "$test_message"
229 }
230 -re "STEP INTO THIS CALL.*$gdb_prompt $" {
231 fail "$test_message (too far)"
232 }
233 }
234
235 # stepi backward over flat code (no calls)
236
237 set stepi_location [gdb_get_line_number "FINISH TEST" "$srcfile"]
238 set test_message "simple reverse stepi"
239 gdb_test_multiple "stepi" "$test_message" {
240 -re "STEPI TEST.*$gdb_prompt $" {
241 fail "$test_message (start statement)"
242 }
243 -re "$hex\[ \t\]*$stepi_location.* FINISH TEST.*$gdb_prompt $" {
244 send_gdb "stepi\n"
245 exp_continue
246 }
247 -re "$stepi_location.* FINISH TEST.*$gdb_prompt $" {
248 pass "$test_message"
249 }
250 -re "STEP INTO THIS CALL.*$gdb_prompt $" {
251 fail "$test_message (too far)"
252 }
253 }
254
255 # step backward into function (thru return)
256
257 gdb_test "step" "(RETURN FROM CALLEE|ARRIVED IN CALLEE).*" \
258 "reverse step into fn call"
259
260 # step backward out of called function (thru call)
261
262 set test_message "reverse step out of called fn"
263 gdb_test_multiple "step" "$test_message" {
264 -re "STEP INTO THIS CALL.*.*$gdb_prompt $" {
265 pass "$test_message"
266 }
267 -re "ARRIVED IN CALLEE.*$gdb_prompt $" {
268 send_gdb "step\n"
269 exp_continue
270 }
271 -re "ENTER CALLEE.*$gdb_prompt $" {
272 send_gdb "step\n"
273 exp_continue
274 }
275 }
276
277 # next backward over call
278
279 gdb_test "next" ".*NEXT OVER THIS CALL.*" "reverse next over call"
280
281 # step/next backward with count
282
283 gdb_test "step 3" ".*REVERSE STEP TEST 1.*" "reverse step test 1"
284 gdb_test "next 2" ".*REVERSE NEXT TEST 1.*" "reverse next test 1"
285
286 # step/next backward without count
287
288 gdb_test "step" ".*STEP TEST 1.*" "reverse step test 2"
289 gdb_test "next" ".*NEXT TEST 1.*" "reverse next test 2"
290
291
292
293 # Finish test by running forward to the end.
294 # FIXME return to this later...
295 # gdb_test_no_output "set exec-dir forward" "set forward execution"
296 # gdb_continue_to_end "step-reverse.exp"
297
This page took 0.03693 seconds and 4 git commands to generate.