]> Git Repo - binutils.git/blame - gdb/testsuite/gdb.reverse/until-precsave.exp
[gdb/testsuite] Add KFAIL for missing support of reverse-debugging xsave
[binutils.git] / gdb / testsuite / gdb.reverse / until-precsave.exp
CommitLineData
42a4f53d 1# Copyright 2008-2019 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 'until' and
17# 'advance' in precord logfile.
18
19# This test suitable only for process record-replay
d3895d7d 20if ![supports_process_record] {
02506ff1
MS
21 return
22}
23
7686c074 24standard_testfile until-reverse.c ur1.c
55baab26 25set precsave [standard_output_file until.precsave]
02506ff1 26
5b362f04 27if { [prepare_for_testing "failed to prepare" $testfile \
7686c074 28 [list $srcfile $srcfile2]] } {
02506ff1
MS
29 return -1
30}
31
32set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
33set bp_location7 [gdb_get_line_number "set breakpoint 7 here"]
dc7e1a77 34set bp_location8 [gdb_get_line_number "set breakpoint 8 here" "$srcfile2"]
02506ff1
MS
35set bp_location19 [gdb_get_line_number "set breakpoint 19 here"]
36set bp_location20 [gdb_get_line_number "set breakpoint 20 here"]
37set bp_location21 [gdb_get_line_number "set breakpoint 21 here"]
38
39runto main
40
d3895d7d 41if [supports_process_record] {
02506ff1 42 # Activate process record/replay
9f058c10 43 gdb_test_no_output "record" "turn on process record"
02506ff1
MS
44}
45
46set end_of_main [gdb_get_line_number "set breakpoint 10a here" ]
47gdb_test "break $end_of_main" \
a80db015 48 "Breakpoint $decimal at .*$srcfile, line $end_of_main\." \
bb95117e 49 "breakpoint at end of main"
02506ff1 50
27949e73 51# This can take awhile.
de1c2c52 52with_timeout_factor 20 {
d6e76313
TV
53 set test "run to end of main"
54 set pass_pattern "Breakpoint .* set breakpoint 10a here .*"
55 set kfail_pattern "Process record does not support instruction 0xfae64 at.*"
56 gdb_test_multiple "continue" $test {
57 -re "\[\r\n\]*(?:$pass_pattern)\[\r\n\]+$gdb_prompt $" {
58 pass $test
59 }
60 -re "\[\r\n\]*(?:$kfail_pattern)\[\r\n\]+$gdb_prompt $" {
61 kfail "gdb/25038" $test
62 return -1
63 }
64 }
7b415901 65}
02506ff1 66
4c9ed63c 67# So can this, against gdbserver, for example.
45fd756c 68
de1c2c52 69with_timeout_factor 10 {
45fd756c
YQ
70 gdb_test "record save $precsave" \
71 "Saved core file $precsave with execution log\." \
72 "save process recfile"
73}
02506ff1 74
cdc7edd7 75gdb_test "kill" "" "kill process, prepare to debug log file" \
02506ff1
MS
76 "Kill the program being debugged\\? \\(y or n\\) " "y"
77
55baab26 78gdb_test "record restore $precsave" \
470e2f4e 79 "Restored records from core file .*" \
02506ff1
MS
80 "reload core file"
81
82# Verify that plain vanilla "until <location>" works.
83#
84gdb_test "until $bp_location1" \
85 "main .* at .*:$bp_location1.*" \
86 "until line number"
87
88# Advance up to factorial, outer invocation
89#
90gdb_test "advance factorial" \
91 "factorial .value=6..*$srcfile:$bp_location7.*" \
92 "advance to factorial"
93
94# At this point, 'until' should continue the inferior up to when all the
95# inner invocations of factorial() are completed and we are back at this
96# frame.
97#
98gdb_test "until $bp_location19" \
99 "factorial .value=720.*${srcfile}:$bp_location19.*" \
100 "until factorial, recursive function"
101
102# Finish out to main scope
103#
104gdb_test "finish" \
e6359af3 105 "main .*$srcfile:.*" \
02506ff1
MS
106 "finish to main"
107
108# Advance to a function called by main (marker2)
109#
110gdb_test "advance marker2" \
dc7e1a77 111 "marker2 .a=43.*$srcfile2:$bp_location8.*" \
02506ff1
MS
112 "advance to marker2"
113
114# Now issue an until with another function, not called by the current
115# frame, as argument. This should not work, i.e. the program should
116# stop at main, the caller, where we put the 'guard' breakpoint.
117#
118set test_msg "until func, not called by current frame"
119gdb_test_multiple "until marker3" "$test_msg" {
120 -re "main .*at .*${srcfile}:$bp_location20.*$gdb_prompt $" {
121 pass "$test_msg"
122 }
123 -re "main .*at .*${srcfile}:$bp_location21.*$gdb_prompt $" {
124 pass "$test_msg"
125 }
126}
127
128###
129###
130###
131
132# Set reverse execution direction
02506ff1 133
bcd2dc50 134gdb_test_no_output "set exec-dir reverse" "set reverse execution"
02506ff1
MS
135
136#
137# We should now be at main, after the return from marker2.
138# "Advance" backward into marker2.
139#
140
141gdb_test "advance marker2" \
dc7e1a77 142 "marker2 .a=43.*$srcfile2:$bp_location8.*" \
02506ff1
MS
143 "reverse-advance to marker2"
144
145# Finish out to main scope (backward)
146
147gdb_test "finish" \
148 " in main .*$srcfile:$bp_location20.*" \
149 "reverse-finish from marker2"
150
151# Advance backward to last line of factorial (outer invocation)
152
153gdb_test "advance $bp_location19" \
154 "factorial .value=720.*${srcfile}:$bp_location19.*" \
155 "reverse-advance to final return of factorial"
156
157# Now do "until" across the recursive calls,
158# ending up in the same frame where we are now.
159
160gdb_test "until $bp_location7" \
161 "factorial .value=6..*$srcfile:$bp_location7.*" \
162 "reverse-until to entry of factorial"
This page took 2.644875 seconds and 4 git commands to generate.