Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.reverse / break-reverse.exp
CommitLineData
88b9d363 1# Copyright 2008-2022 Free Software Foundation, Inc.
28d41a99
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.
18
d3895d7d 19if ![supports_reverse] {
28d41a99
MS
20 return
21}
22
7686c074 23standard_testfile
28d41a99 24
5b362f04 25if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
28d41a99
MS
26 return -1
27}
28
29set foo_location [gdb_get_line_number "break in foo" ]
30set bar_location [gdb_get_line_number "break in bar" ]
31set main_location [gdb_get_line_number "break in main"]
32set end_location [gdb_get_line_number "end of main" ]
33
50441f0f 34runto_main
28d41a99 35
d3895d7d 36if [supports_process_record] {
28d41a99 37 # Activate process record/replay
9f058c10 38 gdb_test_no_output "record" "turn on process record"
28d41a99
MS
39}
40
41gdb_test "break foo" \
42 "Breakpoint $decimal at .* line $foo_location\." \
43 "set breakpoint on foo"
44
45gdb_test "break bar" \
46 "Breakpoint $decimal at .* line $bar_location\." \
47 "set breakpoint on bar"
48
49gdb_test "break $end_location" \
50 "Breakpoint $decimal at .* line $end_location\." \
dfa3faca 51 "set breakpoint at end of main"
28d41a99 52
4d421147
AB
53gdb_continue_to_breakpoint "foo forward, the first time" \
54 ".*$srcfile:$foo_location.*"
55gdb_continue_to_breakpoint "bar forward, the first time" \
56 ".*$srcfile:$bar_location.*"
57gdb_continue_to_breakpoint "end forward, the first time" \
58 ".*$srcfile:$end_location.*"
28d41a99 59
bcd2dc50 60gdb_test_no_output "set exec-direction reverse" "set reverse"
28d41a99 61
a80db015
LM
62gdb_continue_to_breakpoint "bar backward" ".*$srcfile:$bar_location.*"
63gdb_continue_to_breakpoint "foo backward" ".*$srcfile:$foo_location.*"
28d41a99
MS
64
65gdb_test_multiple "continue" "main backward" {
a80db015 66 -re ".*Breakpoint $decimal,.*$srcfile:$main_location.*$gdb_prompt $" {
28d41a99
MS
67 pass "main backward"
68 }
69 -re "No more reverse-execution history.* break in main .*$gdb_prompt $" {
70 pass "main backward"
71 }
72}
73
bcd2dc50 74gdb_test_no_output "set exec-direction forward" "set forward"
28d41a99 75
4d421147
AB
76gdb_continue_to_breakpoint "foo forward again" \
77 ".*$srcfile:$foo_location.*"
78gdb_continue_to_breakpoint "bar forward again" \
79 ".*$srcfile:$bar_location.*"
28d41a99
MS
80
81gdb_test_multiple "continue" "end of record log" {
a80db015 82 -re ".*Breakpoint $decimal,.*$srcfile:$end_location.*$gdb_prompt $" {
28d41a99
MS
83 pass "end of record log"
84 }
85 -re "No more reverse-execution history.* end of main .*$gdb_prompt $" {
86 pass "end of record log"
87 }
88}
This page took 1.477164 seconds and 4 git commands to generate.