GDB/testsuite: Add/correct gdb.reverse timeout tweaks
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.reverse / until-precsave.exp
CommitLineData
ecd75fc8 1# Copyright 2008-2014 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
7686c074
TT
27if { [prepare_for_testing $testfile.exp $testfile \
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"]
7686c074 34set bp_location9 [gdb_get_line_number "set breakpoint 9 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
bcd2dc50 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" \
48 "Breakpoint $decimal at .*/$srcfile, line $end_of_main\." \
49 "BP at end of main"
50
27949e73 51# This can take awhile.
7b415901
MR
52set savedtimeout $timeout
53if { [target_info exists gdb,timeout]
54 && $timeout < [target_info gdb,timeout] } {
55 set oldtimeout [target_info gdb,timeout]
56} else {
57 set oldtimeout $timeout
58}
59set timeout [expr $oldtimeout * 15]
02506ff1
MS
60gdb_test "continue" "Breakpoint .* set breakpoint 10a here .*" "run to end of main"
61
4c9ed63c 62# So can this, against gdbserver, for example.
7b415901 63set timeout [expr $oldtimeout * 3]
55baab26
TT
64gdb_test "record save $precsave" \
65 "Saved core file $precsave with execution log\." \
02506ff1 66 "save process recfile"
7b415901 67set timeout $savedtimeout
02506ff1
MS
68
69gdb_test "kill" "" "Kill process, prepare to debug log file" \
70 "Kill the program being debugged\\? \\(y or n\\) " "y"
71
55baab26 72gdb_test "record restore $precsave" \
02506ff1
MS
73 "Program terminated with signal .*" \
74 "reload core file"
75
76# Verify that plain vanilla "until <location>" works.
77#
78gdb_test "until $bp_location1" \
79 "main .* at .*:$bp_location1.*" \
80 "until line number"
81
82# Advance up to factorial, outer invocation
83#
84gdb_test "advance factorial" \
85 "factorial .value=6..*$srcfile:$bp_location7.*" \
86 "advance to factorial"
87
88# At this point, 'until' should continue the inferior up to when all the
89# inner invocations of factorial() are completed and we are back at this
90# frame.
91#
92gdb_test "until $bp_location19" \
93 "factorial .value=720.*${srcfile}:$bp_location19.*" \
94 "until factorial, recursive function"
95
96# Finish out to main scope
97#
98gdb_test "finish" \
99 " in main .*$srcfile:$bp_location1.*" \
100 "finish to main"
101
102# Advance to a function called by main (marker2)
103#
104gdb_test "advance marker2" \
7686c074 105 "marker2 .a=43.*$srcfile2:$bp_location9.*" \
02506ff1
MS
106 "advance to marker2"
107
108# Now issue an until with another function, not called by the current
109# frame, as argument. This should not work, i.e. the program should
110# stop at main, the caller, where we put the 'guard' breakpoint.
111#
112set test_msg "until func, not called by current frame"
113gdb_test_multiple "until marker3" "$test_msg" {
114 -re "main .*at .*${srcfile}:$bp_location20.*$gdb_prompt $" {
115 pass "$test_msg"
116 }
117 -re "main .*at .*${srcfile}:$bp_location21.*$gdb_prompt $" {
118 pass "$test_msg"
119 }
120}
121
122###
123###
124###
125
126# Set reverse execution direction
02506ff1 127
bcd2dc50 128gdb_test_no_output "set exec-dir reverse" "set reverse execution"
02506ff1
MS
129
130#
131# We should now be at main, after the return from marker2.
132# "Advance" backward into marker2.
133#
134
135gdb_test "advance marker2" \
7686c074 136 "marker2 .a=43.*$srcfile2:$bp_location9.*" \
02506ff1
MS
137 "reverse-advance to marker2"
138
139# Finish out to main scope (backward)
140
141gdb_test "finish" \
142 " in main .*$srcfile:$bp_location20.*" \
143 "reverse-finish from marker2"
144
145# Advance backward to last line of factorial (outer invocation)
146
147gdb_test "advance $bp_location19" \
148 "factorial .value=720.*${srcfile}:$bp_location19.*" \
149 "reverse-advance to final return of factorial"
150
151# Now do "until" across the recursive calls,
152# ending up in the same frame where we are now.
153
154gdb_test "until $bp_location7" \
155 "factorial .value=6..*$srcfile:$bp_location7.*" \
156 "reverse-until to entry of factorial"
This page took 0.848487 seconds and 4 git commands to generate.