OLD | NEW |
1 # Copyright 1992, 1994-2000, 2007-2012 Free Software Foundation, Inc. | 1 # Copyright 1992-2013 Free Software Foundation, Inc. |
2 | 2 |
3 # This program is free software; you can redistribute it and/or modify | 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 | 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 | 5 # the Free Software Foundation; either version 3 of the License, or |
6 # (at your option) any later version. | 6 # (at your option) any later version. |
7 # | 7 # |
8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
12 # | 12 # |
13 # You should have received a copy of the GNU General Public License | 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/>. | 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 | 15 |
16 # This file was written by Fred Fish. (fnf@cygnus.com) | 16 # This file was written by Fred Fish. (fnf@cygnus.com) |
17 | 17 |
18 | 18 |
19 set testfile "watchpoint" | 19 standard_testfile |
20 set srcfile ${testfile}.c | |
21 set binfile ${objdir}/${subdir}/${testfile} | |
22 | 20 |
23 if [get_compiler_info] { | 21 if [get_compiler_info] { |
24 return -1 | 22 return -1 |
25 } | 23 } |
26 | 24 |
27 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
ug}] != "" } { | 25 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
ug}] != "" } { |
28 untested watchpoint.exp | 26 untested watchpoint.exp |
29 return -1 | 27 return -1 |
30 } | 28 } |
31 | 29 |
(...skipping 16 matching lines...) Expand all Loading... |
48 # 2 Breakpoint marker2() | 46 # 2 Breakpoint marker2() |
49 # 3 Watchpoint ival3 | 47 # 3 Watchpoint ival3 |
50 | 48 |
51 proc initialize {} { | 49 proc initialize {} { |
52 global gdb_prompt | 50 global gdb_prompt |
53 global hex | 51 global hex |
54 global decimal | 52 global decimal |
55 global srcfile | 53 global srcfile |
56 | 54 |
57 if [gdb_test "break marker1" "Breakpoint 1 at $hex: file .*$srcfile, line $d
ecimal.*" "set breakpoint at marker1" ] { | 55 if [gdb_test "break marker1" "Breakpoint 1 at $hex: file .*$srcfile, line $d
ecimal.*" "set breakpoint at marker1" ] { |
58 return 0; | 56 return 0 |
59 } | 57 } |
60 | 58 |
61 | 59 |
62 if [gdb_test "break marker2" "Breakpoint 2 at $hex: file .*$srcfile, line $d
ecimal.*" "set breakpoint at marker2" ] { | 60 if [gdb_test "break marker2" "Breakpoint 2 at $hex: file .*$srcfile, line $d
ecimal.*" "set breakpoint at marker2" ] { |
63 return 0; | 61 return 0 |
64 } | 62 } |
65 | 63 |
66 | 64 |
67 if [gdb_test "info break" "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint
.*marker2.*" "info break in watchpoint.exp" ] { | 65 if [gdb_test "info break" "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint
.*marker2.*" "info break in watchpoint.exp" ] { |
68 return 0; | 66 return 0 |
69 } | 67 } |
70 | 68 |
71 gdb_test "watch ival3" ".*\[Ww\]atchpoint 3: ival3.*" "set watchpoint on iva
l3" | 69 gdb_test "watch ival3" ".*\[Ww\]atchpoint 3: ival3.*" "set watchpoint on iva
l3" |
72 | 70 |
73 if [gdb_test "info watch" "3\[ \]*.*watchpoint.*ival3" "watchpoint found in
watchpoint/breakpoint table" ] { | 71 if [gdb_test "info watch" "3\[ \]*.*watchpoint.*ival3" "watchpoint found in
watchpoint/breakpoint table" ] { |
74 return 0; | 72 return 0 |
75 } | 73 } |
76 | 74 |
77 | 75 |
78 # After installing the watchpoint, we disable it until we are ready | 76 # After installing the watchpoint, we disable it until we are ready |
79 # to use it. This allows the test program to run at full speed until | 77 # to use it. This allows the test program to run at full speed until |
80 # we get to the first marker function. | 78 # we get to the first marker function. |
81 | 79 |
82 if [gdb_test "disable 3" "disable 3\[\r\n\]+" "disable watchpoint" ] { | 80 if [gdb_test "disable 3" "disable 3\[\r\n\]+" "disable watchpoint" ] { |
83 return 0; | 81 return 0 |
84 } | 82 } |
85 | 83 |
86 | 84 |
87 return 1 | 85 return 1 |
88 } | 86 } |
89 | 87 |
90 # | 88 # |
91 # Test simple watchpoint. | 89 # Test simple watchpoint. |
92 # | 90 # |
93 | 91 |
94 proc test_simple_watchpoint {} { | 92 proc test_simple_watchpoint {} { |
95 global gdb_prompt | 93 global gdb_prompt |
96 global hex | 94 global hex |
97 global decimal | 95 global decimal |
98 | 96 |
99 # Ensure that the watchpoint is disabled when we startup. | 97 # Ensure that the watchpoint is disabled when we startup. |
100 | 98 |
101 if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint in test_s
imple_watchpoint" ] { | 99 if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint in test_s
imple_watchpoint" ] { |
102 return 0; | 100 return 0 |
103 } | 101 } |
104 | 102 |
105 # Run until we get to the first marker function. | 103 # Run until we get to the first marker function. |
106 | 104 |
107 gdb_run_cmd | 105 gdb_run_cmd |
108 set timeout 600 | 106 set timeout 600 |
109 set test "run to marker1 in test_simple_watchpoint" | 107 set test "run to marker1 in test_simple_watchpoint" |
110 set retcode [gdb_test_multiple "" $test { | 108 set retcode [gdb_test_multiple "" $test { |
111 -re "Breakpoint 1, marker1 .*$gdb_prompt $" { | 109 -re "Breakpoint 1, marker1 .*$gdb_prompt $" { |
112 pass $test | 110 pass $test |
113 } | 111 } |
114 }] | 112 }] |
115 | 113 |
116 if { $retcode != 0 } { | 114 if { $retcode != 0 } { |
117 return | 115 return |
118 } | 116 } |
119 | 117 |
120 # After reaching the marker function, enable the watchpoint. | 118 # After reaching the marker function, enable the watchpoint. |
121 | 119 |
122 if [gdb_test "enable 3" "^enable 3\[\r\n\]+" "enable watchpoint" ] { | 120 if [gdb_test "enable 3" "^enable 3\[\r\n\]+" "enable watchpoint" ] { |
123 return ; | 121 return |
124 } | 122 } |
125 | 123 |
126 | 124 |
127 gdb_test "break func1" "Breakpoint.*at.*" | 125 gdb_test "break func1" "Breakpoint.*at.*" |
128 gdb_test_no_output "set \$func1_breakpoint_number = \$bpnum" | 126 gdb_test_no_output "set \$func1_breakpoint_number = \$bpnum" |
129 | 127 |
130 gdb_test "continue" "Continuing.*Breakpoint \[0-9\]*, func1.*" \ | 128 gdb_test "continue" "Continuing.*Breakpoint \[0-9\]*, func1.*" \ |
131 "continue to breakpoint at func1" | 129 "continue to breakpoint at func1" |
132 | 130 |
133 # Continue until the first change, from -1 to 0 | 131 # Continue until the first change, from -1 to 0 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 178 |
181 # Continue until we hit the finishing marker function. | 179 # Continue until we hit the finishing marker function. |
182 # Make sure we hit no more watchpoints. | 180 # Make sure we hit no more watchpoints. |
183 | 181 |
184 gdb_test "cont" "Continuing.*Breakpoint.*marker2 \(\).*" \ | 182 gdb_test "cont" "Continuing.*Breakpoint.*marker2 \(\).*" \ |
185 "continue to marker2" | 183 "continue to marker2" |
186 | 184 |
187 # Disable the watchpoint so we run at full speed until we exit. | 185 # Disable the watchpoint so we run at full speed until we exit. |
188 | 186 |
189 if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "watchpoint disabled" ] { | 187 if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "watchpoint disabled" ] { |
190 return ; | 188 return |
191 } | 189 } |
192 | 190 |
193 | 191 |
194 # Run until process exits. | 192 # Run until process exits. |
195 | 193 |
196 if [target_info exists gdb,noresults] { return } | 194 if [target_info exists gdb,noresults] { return } |
197 | 195 |
198 gdb_continue_to_end "continue to exit in test_simple_watchpoint" | 196 gdb_continue_to_end "continue to exit in test_simple_watchpoint" |
199 } | 197 } |
200 | 198 |
201 # Test disabling watchpoints. | 199 # Test disabling watchpoints. |
202 | 200 |
203 proc test_disabling_watchpoints {} { | 201 proc test_disabling_watchpoints {} { |
204 global gdb_prompt | 202 global gdb_prompt |
205 global binfile | 203 global binfile |
206 global srcfile | 204 global srcfile |
207 global decimal | 205 global decimal |
208 global hex | 206 global hex |
209 | 207 |
210 gdb_test "info watch" "\[0-9]+\[ \]*.*watchpoint.*ival3.*" "watchpoints foun
d in watchpoint/breakpoint table" | 208 gdb_test "info watch" "\[0-9]+\[ \]*.*watchpoint.*ival3.*" "watchpoints foun
d in watchpoint/breakpoint table" |
211 | 209 |
212 # Ensure that the watchpoint is disabled when we startup. | 210 # Ensure that the watchpoint is disabled when we startup. |
213 | 211 |
214 if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint in test_d
isabling_watchpoints" ] { | 212 if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint in test_d
isabling_watchpoints" ] { |
215 return 0; | 213 return 0 |
216 } | 214 } |
217 | 215 |
218 | 216 |
219 # Run until we get to the first marker function. | 217 # Run until we get to the first marker function. |
220 | 218 |
221 gdb_run_cmd | 219 gdb_run_cmd |
222 set timeout 600 | 220 set timeout 600 |
223 set test "run to marker1 in test_disabling_watchpoints" | 221 set test "run to marker1 in test_disabling_watchpoints" |
224 set retcode [gdb_test_multiple "" $test { | 222 set retcode [gdb_test_multiple "" $test { |
225 -re "Breakpoint 1, marker1 .*$gdb_prompt $" { | 223 -re "Breakpoint 1, marker1 .*$gdb_prompt $" { |
226 pass $test | 224 pass $test |
227 } | 225 } |
228 }] | 226 }] |
229 | 227 |
230 if { $retcode != 0 } { | 228 if { $retcode != 0 } { |
231 return | 229 return |
232 } | 230 } |
233 | 231 |
234 # After reaching the marker function, enable the watchpoint. | 232 # After reaching the marker function, enable the watchpoint. |
235 | 233 |
236 if [gdb_test "enable 3" "^enable 3\[\r\n\]+" "watchpoint enabled" ] { | 234 if [gdb_test "enable 3" "^enable 3\[\r\n\]+" "watchpoint enabled" ] { |
237 return ; | 235 return |
238 } | 236 } |
239 | 237 |
240 | 238 |
241 # Continue until the first change, from -1 to 0 | 239 # Continue until the first change, from -1 to 0 |
242 # Don't check the old value, because on VxWorks the variable value | 240 # Don't check the old value, because on VxWorks the variable value |
243 # will not have been reinitialized. | 241 # will not have been reinitialized. |
244 gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = .*New value
= 0.*ival3 = count; ival4 = count;.*" "watchpoint hit in test_disabling_watchpo
ints, first time" | 242 gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = .*New value
= 0.*ival3 = count; ival4 = count;.*" "watchpoint hit in test_disabling_watchpo
ints, first time" |
245 | 243 |
246 # Continue until the next change, from 0 to 1. | 244 # Continue until the next change, from 0 to 1. |
247 gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 0.*New valu
e = 1.*ival3 = count; ival4 = count;.*" "watchpoint hit in test_disabling_watchp
oints, second time" | 245 gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 0.*New valu
e = 1.*ival3 = count; ival4 = count;.*" "watchpoint hit in test_disabling_watchp
oints, second time" |
248 | 246 |
249 # Disable the watchpoint but leave breakpoints | 247 # Disable the watchpoint but leave breakpoints |
250 | 248 |
251 if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint #2 in tes
t_disabling_watchpoints" ] { | 249 if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint #2 in tes
t_disabling_watchpoints" ] { |
252 return 0; | 250 return 0 |
253 } | 251 } |
254 | 252 |
255 | 253 |
256 # Check watchpoint list, looking for the entry that confirms the | 254 # Check watchpoint list, looking for the entry that confirms the |
257 # watchpoint is disabled. | 255 # watchpoint is disabled. |
258 gdb_test "info watchpoints" "\[0-9]+\[ \]*.*watchpoint\[ \]*keep\[ \]*n\[ \]
*ival3\r\n.*" "watchpoint disabled in table" | 256 gdb_test "info watchpoints" "\[0-9]+\[ \]*.*watchpoint\[ \]*keep\[ \]*n\[ \]
*ival3\r\n.*" "watchpoint disabled in table" |
259 | 257 |
260 # Continue until we hit the finishing marker function. | 258 # Continue until we hit the finishing marker function. |
261 # Make sure we hit no more watchpoints. | 259 # Make sure we hit no more watchpoints. |
262 gdb_test "cont" "Continuing.*Breakpoint.*marker2 \\(\\).*" \ | 260 gdb_test "cont" "Continuing.*Breakpoint.*marker2 \\(\\).*" \ |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 gdb_test "step" "ival2 = count.*" "step to ival2 assignment" | 335 gdb_test "step" "ival2 = count.*" "step to ival2 assignment" |
338 } | 336 } |
339 } | 337 } |
340 | 338 |
341 # Test stepping and other mundane operations with watchpoints enabled | 339 # Test stepping and other mundane operations with watchpoints enabled |
342 proc test_watchpoint_triggered_in_syscall {} { | 340 proc test_watchpoint_triggered_in_syscall {} { |
343 global gdb_prompt | 341 global gdb_prompt |
344 | 342 |
345 # These tests won't work without printf support. | 343 # These tests won't work without printf support. |
346 if [gdb_skip_stdio_test "watchpoints triggered in syscall"] { | 344 if [gdb_skip_stdio_test "watchpoints triggered in syscall"] { |
347 » return; | 345 » return |
348 } | 346 } |
349 # Run until we get to the first marker function. | 347 # Run until we get to the first marker function. |
350 set x 0 | 348 set x 0 |
351 set y 0 | 349 set y 0 |
352 set testname "Watch buffer passed to read syscall" | 350 set testname "Watch buffer passed to read syscall" |
353 if [runto marker2] then { | 351 if [runto marker2] then { |
354 gdb_test "watch buf\[0\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[0\\\]" | 352 gdb_test "watch buf\[0\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[0\\\]" |
355 gdb_test "watch buf\[1\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[1\\\]" | 353 gdb_test "watch buf\[1\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[1\\\]" |
356 gdb_test "watch buf\[2\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[2\\\]" | 354 gdb_test "watch buf\[2\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[2\\\]" |
357 gdb_test "watch buf\[3\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[3\\\]" | 355 gdb_test "watch buf\[3\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[3\\\]" |
358 gdb_test "watch buf\[4\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[4\\\]" | 356 gdb_test "watch buf\[4\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[4\\\]" |
359 gdb_test "break marker4" ".*Breakpoint.*" | 357 gdb_test "break marker4" ".*Breakpoint.*" |
360 | 358 |
361 gdb_test_no_output "set doread = 1" | 359 gdb_test_no_output "set doread = 1" |
362 | 360 |
363 # If we send gdb "123\n" before gdb has switched the tty, then it goes | 361 # If we send gdb "123\n" before gdb has switched the tty, then it goes |
364 # to gdb, not the inferior, and we lose. So that is why we have | 362 # to gdb, not the inferior, and we lose. So that is why we have |
365 # watchpoint.c prompt us, so we can wait for that prompt. | 363 # watchpoint.c prompt us, so we can wait for that prompt. |
366 | 364 |
367 » send_gdb "continue\n"; | 365 » send_gdb "continue\n" |
368 gdb_expect { | 366 gdb_expect { |
369 -re "Continuing\\.\r\ntype stuff for buf now:" { | 367 -re "Continuing\\.\r\ntype stuff for buf now:" { |
370 pass "continue to read" | 368 pass "continue to read" |
371 } | 369 } |
372 default { | 370 default { |
373 » » fail "continue to read"; | 371 » » fail "continue to read" |
374 » » return ; | 372 » » return |
375 } | 373 } |
376 } | 374 } |
377 | 375 |
378 set test "sent 123" | 376 set test "sent 123" |
379 gdb_test_multiple "123" $test { | 377 gdb_test_multiple "123" $test { |
380 -re ".*\[Ww\]atchpoint.*buf\\\[0\\\].*Old value = 0.*New value = 49\
[^\n\]*\n" { set x [expr $x+1] ; exp_continue } | 378 -re ".*\[Ww\]atchpoint.*buf\\\[0\\\].*Old value = 0.*New value = 49\
[^\n\]*\n" { set x [expr $x+1] ; exp_continue } |
381 -re ".*\[Ww\]atchpoint.*buf\\\[1\\\].*Old value = 0.*New value = 50\
[^\n\]*\n" { set x [expr $x+1] ; exp_continue } | 379 -re ".*\[Ww\]atchpoint.*buf\\\[1\\\].*Old value = 0.*New value = 50\
[^\n\]*\n" { set x [expr $x+1] ; exp_continue } |
382 -re ".*\[Ww\]atchpoint.*buf\\\[2\\\].*Old value = 0.*New value = 51\
[^\n\]*\n" { set x [expr $x+1] ; exp_continue } | 380 -re ".*\[Ww\]atchpoint.*buf\\\[2\\\].*Old value = 0.*New value = 51\
[^\n\]*\n" { set x [expr $x+1] ; exp_continue } |
383 -re ".*\[Ww\]atchpoint.*buf\\\[3\\\].*Old value = 0.*New value = 10\
[^\n\]*\n" { set x [expr $x+1] ; exp_continue } | 381 -re ".*\[Ww\]atchpoint.*buf\\\[3\\\].*Old value = 0.*New value = 10\
[^\n\]*\n" { set x [expr $x+1] ; exp_continue } |
384 -re ".*$gdb_prompt $" { pass $test } | 382 -re ".*$gdb_prompt $" { pass $test } |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+.pc.*" \ | 596 ".*watchpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+.pc.*" \ |
599 "watchpoint `\$pc' is enabled" | 597 "watchpoint `\$pc' is enabled" |
600 | 598 |
601 gdb_test_no_output "delete \$bpnum" "delete watchpoint `\$pc'" | 599 gdb_test_no_output "delete \$bpnum" "delete watchpoint `\$pc'" |
602 } | 600 } |
603 | 601 |
604 proc test_watch_location {} { | 602 proc test_watch_location {} { |
605 gdb_breakpoint [gdb_get_line_number "func5 breakpoint here"] | 603 gdb_breakpoint [gdb_get_line_number "func5 breakpoint here"] |
606 gdb_continue_to_breakpoint "func5 breakpoint here" | 604 gdb_continue_to_breakpoint "func5 breakpoint here" |
607 | 605 |
| 606 gdb_test "watch -location nullptr->p->x" \ |
| 607 "Cannot access memory at address 0x0" |
| 608 |
608 gdb_test "watch -location *x" "atchpoint .*: .*" "watch -location .x" | 609 gdb_test "watch -location *x" "atchpoint .*: .*" "watch -location .x" |
609 | 610 |
610 gdb_test "continue" \ | 611 gdb_test "continue" \ |
611 "Continuing.*\[Ww\]atchpoint .*: .*New value = 27.*" \ | 612 "Continuing.*\[Ww\]atchpoint .*: .*New value = 27.*" \ |
612 "continue with watch -location" | 613 "continue with watch -location" |
613 | 614 |
614 gdb_test_no_output "delete \$bpnum" "delete watch -location" | 615 gdb_test_no_output "delete \$bpnum" "delete watch -location" |
615 } | 616 } |
616 | 617 |
617 # Tests watching areas larger than a word. | 618 # Tests watching areas larger than a word. |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 gdb_test "watch ival3 if count > 1" \ | 808 gdb_test "watch ival3 if count > 1" \ |
808 "Watchpoint \[0-9\]*: ival3.*" \ | 809 "Watchpoint \[0-9\]*: ival3.*" \ |
809 "set slow conditional watch" | 810 "set slow conditional watch" |
810 | 811 |
811 gdb_test "continue" \ | 812 gdb_test "continue" \ |
812 "Watchpoint \[0-9\]*: ival3.*Old value = 1.*New value = 2.*" \ | 813 "Watchpoint \[0-9\]*: ival3.*Old value = 1.*New value = 2.*" \ |
813 "trigger slow conditional watch" | 814 "trigger slow conditional watch" |
814 | 815 |
815 gdb_test_no_output "delete \$bpnum" "delete watch ival3" | 816 gdb_test_no_output "delete \$bpnum" "delete watch ival3" |
816 | 817 |
| 818 gdb_test "watch ival3 if count > 1 thread 1 " \ |
| 819 "Watchpoint \[0-9\]*: ival3.*" \ |
| 820 "set slow condition watch w/thread" |
| 821 |
| 822 gdb_test_no_output "delete \$bpnum" "delete watch w/condition and thread" |
| 823 |
817 # We've explicitly disabled hardware watches. Verify that GDB | 824 # We've explicitly disabled hardware watches. Verify that GDB |
818 # refrains from using them. | 825 # refrains from using them. |
819 # | 826 # |
820 gdb_test "rwatch ival3" \ | 827 gdb_test "rwatch ival3" \ |
821 » "Expression cannot be implemented with read/access watchpoint..*" \ | 828 » "Can't set read/access watchpoint when hardware watchpoints are disabled
." \ |
822 "rwatch disallowed when can-set-hw-watchpoints cleared" | 829 "rwatch disallowed when can-set-hw-watchpoints cleared" |
| 830 gdb_test "awatch ival3" \ |
| 831 "Can't set read/access watchpoint when hardware watchpoints are disabled
." \ |
| 832 "awatch disallowed when can-set-hw-watchpoints cleared" |
| 833 |
823 | 834 |
824 # Re-enable hardware watchpoints if necessary. | 835 # Re-enable hardware watchpoints if necessary. |
825 if ![target_info exists gdb,no_hardware_watchpoints] { | 836 if ![target_info exists gdb,no_hardware_watchpoints] { |
826 gdb_test_no_output "set can-use-hw-watchpoints 1" "" | 837 gdb_test_no_output "set can-use-hw-watchpoints 1" "" |
827 } | 838 } |
828 } | 839 } |
829 | 840 |
830 proc test_watchpoint_in_big_blob {} { | 841 proc test_watchpoint_in_big_blob {} { |
831 global gdb_prompt | 842 global gdb_prompt |
832 | 843 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 # watchpoint automatically in this case, this match | 876 # watchpoint automatically in this case, this match |
866 # should be removed. | 877 # should be removed. |
867 pass $test | 878 pass $test |
868 } | 879 } |
869 } | 880 } |
870 } | 881 } |
871 | 882 |
872 gdb_test_no_output "delete \$bpnum" "delete watch buf" | 883 gdb_test_no_output "delete \$bpnum" "delete watch buf" |
873 } | 884 } |
874 | 885 |
| 886 proc test_watch_register_location {} { |
| 887 global no_hw |
| 888 |
| 889 if {!$no_hw && ![target_info exists gdb,no_hardware_watchpoints]} { |
| 890 # Non-memory read/access watchpoints are not supported, they would |
| 891 # require software read/access watchpoint support (which is not |
| 892 # currently available). |
| 893 gdb_test "rwatch \$pc" \ |
| 894 "Expression cannot be implemented with read/access watchpoint..*" \ |
| 895 "rwatch disallowed for register based expression" |
| 896 gdb_test "awatch \$pc" \ |
| 897 "Expression cannot be implemented with read/access watchpoint..*" \ |
| 898 "awatch disallowed for register based expression" |
| 899 } |
| 900 } |
| 901 |
875 # Start with a fresh gdb. | 902 # Start with a fresh gdb. |
876 | 903 |
877 set prev_timeout $timeout | 904 set prev_timeout $timeout |
878 set timeout 600 | 905 set timeout 600 |
879 verbose "Timeout now 600 sec.\n" | 906 verbose "Timeout now 600 sec.\n" |
880 | 907 |
881 test_no_hw_watchpoints | 908 test_no_hw_watchpoints |
882 | 909 |
883 proc do_tests {} { | 910 proc do_tests {} { |
884 global testfile | 911 global testfile |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 test_watchpoint_in_big_blob | 953 test_watchpoint_in_big_blob |
927 | 954 |
928 test_constant_watchpoint | 955 test_constant_watchpoint |
929 | 956 |
930 test_disable_enable_software_watchpoint | 957 test_disable_enable_software_watchpoint |
931 | 958 |
932 test_watch_location | 959 test_watch_location |
933 | 960 |
934 test_wide_location_1 | 961 test_wide_location_1 |
935 test_wide_location_2 | 962 test_wide_location_2 |
| 963 |
| 964 test_watch_register_location |
936 } | 965 } |
937 | 966 |
938 # On targets that can do hardware watchpoints, run the tests twice: | 967 # On targets that can do hardware watchpoints, run the tests twice: |
939 # once with hardware watchpoints enabled; another with hardware | 968 # once with hardware watchpoints enabled; another with hardware |
940 # watchpoints force-disabled. | 969 # watchpoints force-disabled. |
941 | 970 |
942 do_tests | 971 do_tests |
943 if ![target_info exists gdb,no_hardware_watchpoints] { | 972 if ![target_info exists gdb,no_hardware_watchpoints] { |
944 with_test_prefix "no-hw" { | 973 with_test_prefix "no-hw" { |
945 set no_hw 1 | 974 set no_hw 1 |
946 do_tests | 975 do_tests |
947 } | 976 } |
948 } | 977 } |
949 | 978 |
950 # Restore old timeout | 979 # Restore old timeout |
951 set timeout $prev_timeout | 980 set timeout $prev_timeout |
952 verbose "Timeout now $timeout sec.\n" | 981 verbose "Timeout now $timeout sec.\n" |
OLD | NEW |