]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.reverse/break-precsave.exp
* gdb.reverse/break-precsave.exp: Use standard_testfile.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.reverse / break-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 reverse debugging
17# with breakpoints in a process record 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 break-reverse.c
02506ff1
MS
25
26if { [prepare_for_testing $testfile.exp $testfile $srcfile] } {
27 return -1
28}
29
30set foo_location [gdb_get_line_number "break in foo" ]
31set bar_location [gdb_get_line_number "break in bar" ]
32set main_location [gdb_get_line_number "break in main"]
33set end_location [gdb_get_line_number "end of main" ]
34
35runto main
36
d3895d7d 37if [supports_process_record] {
02506ff1 38 # Activate process record/replay
bcd2dc50 39 gdb_test_no_output "record" "Turn on process record"
02506ff1
MS
40}
41
42gdb_test "break $end_location" \
43 "Breakpoint $decimal at .*/$srcfile, line $end_location\." \
44 "BP at end of main"
45
46gdb_test "continue" "Breakpoint .* end of main .*" "run to end of main"
47
48gdb_test "record save break.precsave" \
49 "Saved core file break.precsave with execution log\." \
50 "save process recfile"
51
52gdb_test "kill" "" "Kill process, prepare to debug log file" \
53 "Kill the program being debugged\\? \\(y or n\\) " "y"
54
55gdb_test "record restore break.precsave" \
56 "Program terminated with signal .*" \
57 "reload precord save file"
58
59gdb_test "break foo" \
60 "Breakpoint $decimal at .* line $foo_location\." \
61 "set breakpoint on foo"
62
63gdb_test "break bar" \
64 "Breakpoint $decimal at .* line $bar_location\." \
65 "set breakpoint on bar"
66
67gdb_continue_to_breakpoint "foo" ".*/$srcfile:$foo_location.*"
68gdb_continue_to_breakpoint "bar" ".*/$srcfile:$bar_location.*"
69gdb_test_multiple "continue" "go to end of main forward" {
70 -re ".*Breakpoint $decimal,.*/$srcfile:$end_location.*$gdb_prompt $" {
71 pass "go to end of main forward"
72 }
73 -re "No more reverse-execution history.* end of main .*$gdb_prompt $" {
74 pass "go to end of main forward"
75 }
76}
77
bcd2dc50 78gdb_test_no_output "set exec-direction reverse" "set reverse"
02506ff1
MS
79
80gdb_continue_to_breakpoint "bar backward" ".*/$srcfile:$bar_location.*"
81gdb_continue_to_breakpoint "foo backward" ".*/$srcfile:$foo_location.*"
82
83gdb_test_multiple "continue" "main backward" {
84 -re ".*Breakpoint $decimal,.*/$srcfile:$main_location.*$gdb_prompt $" {
85 pass "main backward"
86 }
87 -re "No more reverse-execution history.* break in main .*$gdb_prompt $" {
88 pass "main backward"
89 }
90}
91
bcd2dc50 92gdb_test_no_output "set exec-direction forward" "set forward"
02506ff1
MS
93
94gdb_continue_to_breakpoint "foo" ".*/$srcfile:$foo_location.*"
95gdb_continue_to_breakpoint "bar" ".*/$srcfile:$bar_location.*"
96
97gdb_test_multiple "continue" "end of record log" {
98 -re ".*Breakpoint $decimal,.*/$srcfile:$end_location.*$gdb_prompt $" {
99 pass "end of record log"
100 }
101 -re "No more reverse-execution history.* end of main .*$gdb_prompt $" {
102 pass "end of record log"
103 }
104}