Update copyright year in most headers.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.reverse / watch-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# Based on a file written by Fred Fish. (fnf@cygnus.com)
17# This file is part of the GDB testsuite. It tests reverse debugging
18# with watchpoints.
19
20
21if ![target_info exists gdb,can_reverse] {
22 return
23}
24
25set testfile "watch-reverse"
26set srcfile ${testfile}.c
27set binfile ${objdir}/${subdir}/${testfile}
28
29if { [prepare_for_testing $testfile.exp $testfile $srcfile] } {
30 return -1
31}
32
33runto main
34
35if [target_info exists gdb,use_precord] {
36 # Activate process record/replay
37 gdb_test "record" "" "Turn on process record"
38 # FIXME: command ought to acknowledge, so we can test if it succeeded.
39}
40
930636d2
MS
41# Test software watchpoints
42gdb_test "set can-use-hw-watchpoints 0" "" "disable hw watchpoints"
28d41a99
MS
43
44gdb_test "break marker1" \
45 "Breakpoint $decimal at $hex: file .*$srcfile, line $decimal.*" \
46 "set breakpoint at marker1"
47
48gdb_test "break marker2" \
49 "Breakpoint $decimal at $hex: file .*$srcfile, line $decimal.*" \
50 "set breakpoint at marker2"
51
52gdb_continue_to_breakpoint "marker1" ".*/$srcfile:.*"
53
54gdb_test "watch ival3" \
55 ".*\[Ww\]atchpoint $decimal: ival3.*" \
56 "set watchpoint on ival3"
57
58# Continue until first change, from -1 to 0
59
60gdb_test "continue" \
61 ".*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count; ival4 = count;.*" \
62 "watchpoint hit, first time"
63
64# Continue until the next change, from 0 to 1.
65gdb_test "continue" \
66 ".*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = 1.*ival3 = count; ival4 = count;.*" \
67 "watchpoint hit, second time"
68
69# Continue until the next change, from 1 to 2.
70gdb_test "continue" \
71 ".*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 2.*ival3 = count; ival4 = count;.*" \
72 "watchpoint hit, third time"
73
74# Continue until the next change, from 2 to 3.
75gdb_test "continue" \
76 ".*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 3.*ival3 = count; ival4 = count;.*" \
77 "watchpoint hit, fourth time"
78
79# Continue until the next change, from 3 to 4.
80# Note that this one is outside the loop.
81
82gdb_test "continue" \
83 ".*\[Ww\]atchpoint.*ival3.*Old value = 3.*New value = 4.*ival3 = count; ival4 = count;.*" \
84 "watchpoint hit, fifth time"
85
86# Continue until we hit the finishing marker function.
87# Make sure we hit no more watchpoints.
88
89gdb_continue_to_breakpoint "marker2" ".*/$srcfile:.*"
90
91###
92###
93###
94
95# FIXME 'set exec-dir' command should give some output so we can test.
96gdb_test "set exec-direction reverse" "" "set reverse"
97
98# Reverse until the previous change, from 4 to 3
99# Note that this one is outside the loop
100
101gdb_test "continue" \
102 ".*\[Ww\]atchpoint.*ival3.*Old value = 4.*New value = 3.*ival3 = count; ival4 = count;.*" \
103 "watchpoint hit in reverse, first time"
104
105# Reverse until the previous change, from 3 to 2.
106gdb_test "continue" \
107 ".*\[Ww\]atchpoint.*ival3.*Old value = 3.*New value = 2.*ival3 = count; ival4 = count;.*" \
108 "watchpoint hit in reverse, second time"
109
110# Reverse until the previous change, from 2 to 1.
111gdb_test "continue" \
112 ".*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 1.*ival3 = count; ival4 = count;.*" \
113 "watchpoint hit in reverse, third time"
114
115# Reverse until the previous change, from 1 to 0.
116gdb_test "continue" \
117 ".*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 0.*ival3 = count; ival4 = count;.*" \
118 "watchpoint hit in reverse, fourth time"
119
120# Reverse until first change, from 0 to -1
121
122gdb_test "continue" \
123 ".*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = -1.*ival3 = count; ival4 = count;.*" \
124 "watchpoint hit in reverse, fifth time"
930636d2
MS
125
126gdb_test "set can-use-hw-watchpoints 1" "" "enable hw watchpoints"
127
128###
129###
130###
131
132# FIXME 'set exec-dir' command should give some output so we can test.
133gdb_test "set exec-direction forward" "" "set forward"
134
135# Continue until first change, from -1 to 0
136
137gdb_test "continue" \
138 ".*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count; ival4 = count;.*" \
139 "watchpoint hit, forward replay, first time"
140
141# Continue until the next change, from 0 to 1.
142gdb_test "continue" \
143 ".*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = 1.*ival3 = count; ival4 = count;.*" \
144 "watchpoint hit, forward replay, second time"
145
146# Continue until the next change, from 1 to 2.
147gdb_test "continue" \
148 ".*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 2.*ival3 = count; ival4 = count;.*" \
149 "watchpoint hit, forward replay, third time"
150
151# Continue until the next change, from 2 to 3.
152gdb_test "continue" \
153 ".*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 3.*ival3 = count; ival4 = count;.*" \
154 "watchpoint hit, forward replay, fourth time"
155
156# Continue until the next change, from 3 to 4.
157# Note that this one is outside the loop.
158
159gdb_test "continue" \
160 ".*\[Ww\]atchpoint.*ival3.*Old value = 3.*New value = 4.*ival3 = count; ival4 = count;.*" \
161 "watchpoint hit, forward replay, fifth time"
162
163# Continue until we hit the finishing marker function.
164# Make sure we hit no more watchpoints.
165
166gdb_test "continue" "marker2 .*" "replay forward to marker2"
167
168###
169###
170###
171
172# FIXME 'set exec-dir' command should give some output so we can test.
173gdb_test "set exec-direction reverse" "" "set reverse"
174
175# Reverse until the previous change, from 4 to 3
176# Note that this one is outside the loop
177
178gdb_test "continue" \
179 ".*\[Ww\]atchpoint.*ival3.*Old value = 4.*New value = 3.*ival3 = count; ival4 = count;.*" \
180 "watchpoint hit in reverse, HW, first time"
181
182# Reverse until the previous change, from 3 to 2.
183gdb_test "continue" \
184 ".*\[Ww\]atchpoint.*ival3.*Old value = 3.*New value = 2.*ival3 = count; ival4 = count;.*" \
185 "watchpoint hit in reverse, HW, second time"
186
187# Reverse until the previous change, from 2 to 1.
188gdb_test "continue" \
189 ".*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 1.*ival3 = count; ival4 = count;.*" \
190 "watchpoint hit in reverse, HW, third time"
191
192# Reverse until the previous change, from 1 to 0.
193gdb_test "continue" \
194 ".*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 0.*ival3 = count; ival4 = count;.*" \
195 "watchpoint hit in reverse, HW, fourth time"
196
197# Reverse until first change, from 0 to -1
198
199gdb_test "continue" \
200 ".*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = -1.*ival3 = count; ival4 = count;.*" \
201 "watchpoint hit in reverse, HW, fifth time"
202
This page took 0.085141 seconds and 4 git commands to generate.