[PATCH 5/57][Arm][GAS] Add support for MVE instructions: vmull{b,t}
[binutils-gdb.git] / gdb / testsuite / gdb.reverse / watch-reverse.exp
blob4cc04e81e9e6f83ebc3b91be01349b086135cf23
1 # Copyright 2008-2019 Free Software Foundation, Inc.
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.
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.
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/>.
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.
21 if ![supports_reverse] {
22     return
25 standard_testfile
27 if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
28     return -1
31 runto main
33 if [supports_process_record] {
34     # Activate process record/replay
35     gdb_test_no_output "record" "turn on process record"
38 # Test software watchpoints
39 gdb_test_no_output "set can-use-hw-watchpoints 0" "disable hw watchpoints"
41 gdb_test "break marker1" \
42     "Breakpoint $decimal at $hex: file .*$srcfile, line $decimal.*" \
43     "set breakpoint at marker1"
45 gdb_test "break marker2" \
46     "Breakpoint $decimal at $hex: file .*$srcfile, line $decimal.*" \
47     "set breakpoint at marker2"
49 gdb_continue_to_breakpoint "marker1" ".*$srcfile:.*"
51 gdb_test "watch ival3" \
52     ".*\[Ww\]atchpoint $decimal: ival3.*" \
53     "set watchpoint on ival3"
55 # Continue until first change, from -1 to 0
57 gdb_test "continue" \
58     ".*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count; ival4 = count;.*" \
59     "watchpoint hit, first time"
61 # Continue until the next change, from 0 to 1.
62 gdb_test "continue" \
63     ".*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = 1.*ival3 = count; ival4 = count;.*" \
64     "watchpoint hit, second time"
66 # Continue until the next change, from 1 to 2.
67 gdb_test "continue" \
68     ".*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 2.*ival3 = count; ival4 = count;.*" \
69     "watchpoint hit, third time"
71 # Continue until the next change, from 2 to 3.
72 gdb_test "continue" \
73     ".*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 3.*ival3 = count; ival4 = count;.*" \
74     "watchpoint hit, fourth time"
76 # Continue until the next change, from 3 to 4.
77 # Note that this one is outside the loop.
79 gdb_test "continue" \
80     ".*\[Ww\]atchpoint.*ival3.*Old value = 3.*New value = 4.*ival3 = count; ival4 = count;.*" \
81     "watchpoint hit, fifth time"
83 # Continue until we hit the finishing marker function.
84 # Make sure we hit no more watchpoints.
86 gdb_continue_to_breakpoint "marker2" ".*$srcfile:.*"
88 ###
89 ###
90 ###
92 gdb_test_no_output "set exec-direction reverse" "set reverse"
94 # Reverse until the previous change, from 4 to 3
95 # Note that this one is outside the loop
97 gdb_test "continue" \
98     ".*\[Ww\]atchpoint.*ival3.*Old value = 4.*New value = 3.*ival3 = count; ival4 = count;.*" \
99     "watchpoint hit in reverse, first time"
101 # Reverse until the previous change, from 3 to 2.
102 gdb_test "continue" \
103     ".*\[Ww\]atchpoint.*ival3.*Old value = 3.*New value = 2.*ival3 = count; ival4 = count;.*" \
104     "watchpoint hit in reverse, second time"
106 # Reverse until the previous change, from 2 to 1.
107 gdb_test "continue" \
108     ".*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 1.*ival3 = count; ival4 = count;.*" \
109     "watchpoint hit in reverse, third time"
111 # Reverse until the previous change, from 1 to 0.
112 gdb_test "continue" \
113     ".*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 0.*ival3 = count; ival4 = count;.*" \
114     "watchpoint hit in reverse, fourth time"
116 # Reverse until first change, from 0 to -1
118 gdb_test "continue" \
119     ".*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = -1.*ival3 = count; ival4 = count;.*" \
120     "watchpoint hit in reverse, fifth time"
122 gdb_test_no_output "set can-use-hw-watchpoints 1" "enable hw watchpoints"
128 gdb_test_no_output "set exec-direction forward" "set forward"
130 # Continue until first change, from -1 to 0
132 gdb_test "continue" \
133     ".*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count; ival4 = count;.*" \
134     "watchpoint hit, forward replay, first time"
136 # Continue until the next change, from 0 to 1.
137 gdb_test "continue" \
138     ".*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = 1.*ival3 = count; ival4 = count;.*" \
139     "watchpoint hit, forward replay, second time"
141 # Continue until the next change, from 1 to 2.
142 gdb_test "continue" \
143     ".*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 2.*ival3 = count; ival4 = count;.*" \
144     "watchpoint hit, forward replay, third time"
146 # Continue until the next change, from 2 to 3.
147 gdb_test "continue" \
148     ".*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 3.*ival3 = count; ival4 = count;.*" \
149     "watchpoint hit, forward replay, fourth time"
151 # Continue until the next change, from 3 to 4.
152 # Note that this one is outside the loop.
154 gdb_test "continue" \
155     ".*\[Ww\]atchpoint.*ival3.*Old value = 3.*New value = 4.*ival3 = count; ival4 = count;.*" \
156     "watchpoint hit, forward replay, fifth time"
158 # Continue until we hit the finishing marker function.
159 # Make sure we hit no more watchpoints.
161 gdb_test "continue" "marker2 .*" "replay forward to marker2"
167 gdb_test_no_output "set exec-direction reverse" "set reverse"
169 # Reverse until the previous change, from 4 to 3
170 # Note that this one is outside the loop
172 gdb_test "continue" \
173     ".*\[Ww\]atchpoint.*ival3.*Old value = 4.*New value = 3.*ival3 = count; ival4 = count;.*" \
174     "watchpoint hit in reverse, HW, first time"
176 # Reverse until the previous change, from 3 to 2.
177 gdb_test "continue" \
178     ".*\[Ww\]atchpoint.*ival3.*Old value = 3.*New value = 2.*ival3 = count; ival4 = count;.*" \
179     "watchpoint hit in reverse, HW, second time"
181 # Reverse until the previous change, from 2 to 1.
182 gdb_test "continue" \
183     ".*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 1.*ival3 = count; ival4 = count;.*" \
184     "watchpoint hit in reverse, HW, third time"
186 # Reverse until the previous change, from 1 to 0.
187 gdb_test "continue" \
188     ".*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 0.*ival3 = count; ival4 = count;.*" \
189     "watchpoint hit in reverse, HW, fourth time"
191 # Reverse until first change, from 0 to -1
193 gdb_test "continue" \
194     ".*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = -1.*ival3 = count; ival4 = count;.*" \
195     "watchpoint hit in reverse, HW, fifth time"