Update copyright year in most headers.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.reverse / break-reverse.exp
CommitLineData
4c38e0a4 1# Copyright 2008, 2009, 2010 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
19if ![target_info exists gdb,can_reverse] {
20 return
21}
22
23set testfile "break-reverse"
24set srcfile ${testfile}.c
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
37if [target_info exists gdb,use_precord] {
38 # Activate process record/replay
39 gdb_test "record" "" "Turn on process record"
40 # FIXME: command ought to acknowledge, so we can test if it succeeded.
41}
42
43gdb_test "break foo" \
44 "Breakpoint $decimal at .* line $foo_location\." \
45 "set breakpoint on foo"
46
47gdb_test "break bar" \
48 "Breakpoint $decimal at .* line $bar_location\." \
49 "set breakpoint on bar"
50
51gdb_test "break $end_location" \
52 "Breakpoint $decimal at .* line $end_location\." \
53 set breakpoint at end of main"
54
55gdb_continue_to_breakpoint "foo" ".*/$srcfile:$foo_location.*"
56gdb_continue_to_breakpoint "bar" ".*/$srcfile:$bar_location.*"
57gdb_continue_to_breakpoint "end" ".*/$srcfile:$end_location.*"
58
59# FIXME 'set exec-dir' command should give some output so we can test.
60gdb_test "set exec-direction reverse" "" "set reverse"
61
62gdb_continue_to_breakpoint "bar backward" ".*/$srcfile:$bar_location.*"
63gdb_continue_to_breakpoint "foo backward" ".*/$srcfile:$foo_location.*"
64
65gdb_test_multiple "continue" "main backward" {
66 -re ".*Breakpoint $decimal,.*/$srcfile:$main_location.*$gdb_prompt $" {
67 pass "main backward"
68 }
69 -re "No more reverse-execution history.* break in main .*$gdb_prompt $" {
70 pass "main backward"
71 }
72}
73
74gdb_test "set exec-direction forward" "" "set forward"
75
76gdb_continue_to_breakpoint "foo" ".*/$srcfile:$foo_location.*"
77gdb_continue_to_breakpoint "bar" ".*/$srcfile:$bar_location.*"
78
79gdb_test_multiple "continue" "end of record log" {
80 -re ".*Breakpoint $decimal,.*/$srcfile:$end_location.*$gdb_prompt $" {
81 pass "end of record log"
82 }
83 -re "No more reverse-execution history.* end of main .*$gdb_prompt $" {
84 pass "end of record log"
85 }
86}
This page took 0.079925 seconds and 4 git commands to generate.