1 # Copyright (C) 1992, 1994, 1997 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 2 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, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
20 # This file was written by Fred Fish. (fnf@cygnus.com)
26 if { [skip_hp_tests] } then { continue }
31 set testfile "watch-hp"
32 set srcfile ${testfile}.c
33 set binfile ${objdir}/${subdir}/${testfile}
34 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
35 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
38 if [get_compiler_info ${binfile}] {
41 if { $gcc_compiled } then { continue }
43 # Prepare for watchpoint tests by setting up two breakpoints and one
46 # We use breakpoints at marker functions to get past all the startup code,
47 # so we can get to the watchpoints in a reasonable amount of time from a
48 # known starting point.
50 # For simplicity, so we always know how to reference specific breakpoints or
51 # watchpoints by number, we expect a particular ordering and numbering of
52 # each in the combined breakpoint/watchpoint table, as follows:
55 # 1 Breakpoint marker1()
56 # 2 Breakpoint marker2()
65 if [gdb_test "break marker1" "Breakpoint 1 at $hex: file .*$srcfile, line $decimal.*" "set breakpoint at marker1" ] {
70 if [gdb_test "break marker2" "Breakpoint 2 at $hex: file .*$srcfile, line $decimal.*" "set breakpoint at marker2" ] {
75 if [gdb_test "info break" "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*" "info break in watchpoint.exp" ] {
79 # ??rehrauer: To fix DTS #CHFts23014, in which setting a watchpoint
80 # before running can cause the inferior to croak on HP-UX 10.30 and
81 # 11.0 for reasons as yet unknown, we've disabled the ability to set
82 # watches without a running inferior. Verify the restriction.
84 send_gdb "watch ival3\n"
86 -re ".*can't do that without a running program; try \"break main\", \"run\" first.*$gdb_prompt $" {
87 pass "set watchpoint on ival3"
89 -re ".*$gdb_prompt $" { fail "set watchpoint on ival3" }
90 timeout { fail "set watchpoint on ival3 (timeout)" }
94 # if [gdb_test "watch ival3" ".*\[Ww\]atchpoint 3: ival3" "set watchpoint on ival3" ] {
99 # "info watch" is the same as "info break"
101 # if [gdb_test "info watch" "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*\r\n3\[ \]*.*watchpoint.*ival3" "watchpoint found in watchpoint/breakpoint table" ] {
106 # After installing the watchpoint, we disable it until we are ready
107 # to use it. This allows the test program to run at full speed until
108 # we get to the first marker function.
110 # if [gdb_test "disable 3" "disable 3\[\r\n\]+" "disable watchpoint" ] {
119 # Test simple watchpoint.
122 proc test_simple_watchpoint {} {
127 # Ensure that the watchpoint is disabled when we startup.
129 # if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint in test_simple_watchpoint" ] {
134 # Run until we get to the first marker function.
139 -re "Breakpoint 1, marker1 .*$gdb_prompt $" {
140 pass "run to marker1 in test_simple_watchpoint"
142 -re ".*$gdb_prompt $" {
143 fail "run to marker1 in test_simple_watchpoint"
147 fail "run to marker1 in test_simple_watchpoint (timeout)"
151 #************************
153 # ??rehrauer: To fix DTS #CHFts23014, in which setting a watchpoint
154 # before running can cause the inferior to croak on HP-UX 10.30 and
155 # 11.0 for reasons as yet unknown, we've disabled the ability to set
156 # watches without a running inferior. The following testpoints used
157 # to be in [initialize].
159 send_gdb "watch ival3\n"
161 -re ".*\[Ww\]atchpoint 3: ival3\r\n$gdb_prompt $" {
162 pass "set watchpoint on ival3"
164 -re ".*$gdb_prompt $" { fail "set watchpoint on ival3" }
165 timeout { fail "set watchpoint on ival3 (timeout)" }
168 # "info watch" is the same as "info break"
170 send_gdb "info watch\n"
172 -re "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*\r\n3\[ \]*.*watchpoint.*ival3\r\n$gdb_prompt $" {
173 pass "watchpoint found in watchpoint/breakpoint table"
175 -re ".*$gdb_prompt $" {
176 fail "watchpoint found in watchpoint/breakpoint table"
179 fail "watchpoint found in watchpoint/breakpoint table"
183 # After installing the watchpoint, we disable it until we are ready
184 # to use it. This allows the test program to run at full speed until
185 # we get to the first marker function.
187 send_gdb "disable 3\n"
189 -re "disable 3\[\r\n\]+$gdb_prompt $" { pass "disable watchpoint" }
190 -re ".*$gdb_prompt $" { fail "disable watchpoint" }
191 timeout { fail "disable watchpoint (timeout)" }
194 # After reaching the marker function, enable the watchpoint.
196 if [gdb_test "enable 3" "^enable 3\[\r\n\]+" "enable watchpoint" ] {
201 gdb_test "break func1" "Breakpoint.*at.*"
202 gdb_test "set \$func1_breakpoint_number = \$bpnum" ""
204 gdb_test "continue" "Continuing.*Breakpoint \[0-9\]*, func1.*" \
205 "continue to breakpoint at func1"
207 # Continue until the first change, from -1 to 0
211 -re "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count; ival4 = count;.*$gdb_prompt $" {
212 pass "watchpoint hit, first time"
214 -re "Continuing.*Breakpoint.*func1.*$gdb_prompt $" {
215 setup_xfail "m68*-*-*" 2597
216 fail "thought it hit breakpoint at func1 twice"
217 gdb_test "delete \$func1_breakpoint_number" ""
218 gdb_test "continue" "\
219 Continuing.*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count;" \
220 "watchpoint hit, first time"
222 -re ".*$gdb_prompt $" { fail "watchpoint hit, first time" ; return }
223 timeout { fail "watchpoint hit, first time (timeout)" ; return }
224 eof { fail "watchpoint hit, first time (eof)" ; return }
227 gdb_test "delete \$func1_breakpoint_number" ""
229 # Continue until the next change, from 0 to 1.
230 gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = 1.*ival3 = count; ival4 = count;.*" "watchpoint hit, second time"
232 # Continue until the next change, from 1 to 2.
233 gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 2.*ival3 = count; ival4 = count;.*" "watchpoint hit, third time"
235 # Continue until the next change, from 2 to 3.
236 gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 3.*ival3 = count; ival4 = count;.*" "watchpoint hit, fourth time"
238 # Continue until the next change, from 3 to 4.
239 # Note that this one is outside the loop.
241 gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 3.*New value = 4.*ival3 = count; ival4 = count;.*" "watchpoint hit, fifth time"
243 # Continue until we hit the finishing marker function.
244 # Make sure we hit no more watchpoints.
246 gdb_test "cont" "Continuing.*Breakpoint.*marker2 \(\).*" \
247 "continue to marker2"
249 # Disable the watchpoint so we run at full speed until we exit.
251 if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "watchpoint disabled" ] {
256 # Run until process exits.
258 if [target_info exists gdb,noresults] { return }
260 gdb_test "cont" "Continuing.*Program exited normally.*" \
261 "continue to exit in test_simple_watchpoint"
264 # Test disabling watchpoints.
266 proc test_disabling_watchpoints {} {
273 # Ensure that the watchpoint is disabled when we startup.
275 if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint in test_disabling_watchpoints" ] {
280 # Run until we get to the first marker function.
285 -re "Breakpoint 1, marker1 .*$gdb_prompt $" {
286 pass "run to marker1 in test_disabling_watchpoints"
288 -re ".*$gdb_prompt $" {
289 fail "run to marker1 in test_disabling_watchpoints"
293 fail "run to marker1 in test_disabling_watchpoints (timeout)"
298 # After reaching the marker function, enable the watchpoint.
300 if [gdb_test "enable 3" "^enable 3\[\r\n\]+" "watchpoint enabled" ] {
305 # Continue until the first change, from -1 to 0
306 # Don't check the old value, because on VxWorks the variable value
307 # will not have been reinitialized.
308 gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = .*New value = 0.*ival3 = count; ival4 = count;.*" "watchpoint hit in test_disabling_watchpoints, first time"
310 # Continue until the next change, from 0 to 1.
311 gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = 1.*ival3 = count; ival4 = count;.*" "watchpoint hit in test_disabling_watchpoints, second time"
313 # Disable the watchpoint but leave breakpoints
315 if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint #2 in test_disabling_watchpoints" ] {
320 # Check watchpoint list, looking for the entry that confirms the
321 # watchpoint is disabled.
322 gdb_test "info watchpoints" "3\[ \]*.*watchpoint\[ \]*keep\[ \]*n\[ \]*ival3\r\n.*" "watchpoint disabled in table"
324 # Continue until we hit the finishing marker function.
325 # Make sure we hit no more watchpoints.
326 gdb_test "cont" "Continuing.*Breakpoint.*marker2 \\(\\).*" \
327 "disabled watchpoint skipped"
329 if [target_info exists gdb,noresults] { return }
331 gdb_test "cont" "Continuing.*Program exited normally.*" \
332 "continue to exit in test_disabling_watchpoints"
335 # Test stepping and other mundane operations with watchpoints enabled
336 proc test_stepping {} {
339 if [runto marker1] then {
340 gdb_test "watch ival2" ".*\[Ww\]atchpoint \[0-9\]*: ival2"
342 # Well, let's not be too mundane. It should be a *bit* of a challenge
343 gdb_test "break func2 if 0" "Breakpoint.*at.*"
344 gdb_test "p \$func2_breakpoint_number = \$bpnum" " = .*"
346 # The HPPA has a problem here if it's not using hardware watchpoints
347 if {[ istarget "hppa*-*-*" ] && ![ istarget "hppa*-*-*bsd*" ]} then {
348 # Don't actually try doing the call, if we do we can't continue.
350 fail "calling function with watchpoint enabled"
352 # The problem is that GDB confuses stepping through the call
353 # dummy with hitting the breakpoint at the end of the call dummy.
354 # Will be fixed once all architectures define
355 # CALL_DUMMY_BREAKPOINT_OFFSET.
357 # This doesn't occur if the call dummy starts with a call,
358 # because we are out of the dummy by the first time the inferior
360 clear_xfail "d10v*-*-*"
361 clear_xfail "m68*-*-*"
362 clear_xfail "i*86*-*-*"
363 clear_xfail "vax-*-*"
364 # The following architectures define CALL_DUMMY_BREAKPOINT_OFFSET.
365 clear_xfail "alpha-*-*"
366 clear_xfail "mips*-*-*"
367 clear_xfail "sparc-*-*"
368 clear_xfail "hppa*-*-*bsd*"
369 # It works with the generic inferior function calling code too.
370 clear_xfail "mn10200*-*-*"
371 clear_xfail "mn10300*-*-*"
372 gdb_test "p func1 ()" "= 73" \
373 "calling function with watchpoint enabled"
377 # "finish" brings us back to main.
378 # On some targets (e.g. alpha) gdb will stop from the finish in midline
379 # of the marker1 call. This is due to register restoring code on
380 # the alpha and might be caused by stack adjustment instructions
381 # on other targets. In this case we will step once more.
386 -re "Run.*exit from.*marker1.* at" { }
387 default { fail "finish from marker1" ; return }
391 -re "marker1 \\(\\);.*$gdb_prompt $" {
395 -re "func1 \\(\\);.*$gdb_prompt $" {
396 pass "finish from marker1"
398 -re ".*$gdb_prompt $" {
399 fail "finish from marker1"
401 default { fail "finish from marker1" ; return }
404 gdb_test "next" "for \\(count = 0.*" "next to `for' in watchpoint.exp"
406 # Now test that "until" works. It's a bit tricky to test
407 # "until", because compilers don't always arrange the code
408 # exactly the same way, and we might get slightly different
409 # sequences of statements. But the following should be true
410 # (if not it is a compiler or a debugger bug): The user who
411 # does "until" at every statement of a loop should end up
412 # stepping through the loop once, and the debugger should not
413 # stop for any of the remaining iterations.
415 gdb_test "until" "ival1 = count.*" "until to ival1 assignment"
416 gdb_test "until" "ival3 = count.*" "until to ival3 assignment"
419 -re "(for \\(count = 0|\}).*$gdb_prompt $" {
420 gdb_test "until" "ival1 = count; /. Outside loop ./" \
423 -re "ival1 = count; /. Outside loop ./.*$gdb_prompt $" {
424 pass "until out of loop"
426 -re ".*$gdb_prompt $" {
427 fail "until out of loop"
429 default { fail "until out of loop" ; return }
432 gdb_test "step" "ival2 = count.*" "step to ival2 assignment"
436 # Test stepping and other mundane operations with watchpoints enabled
437 proc test_watchpoint_triggered_in_syscall {} {
440 if [target_info exists gdb,noinferiorio] {
441 verbose "Skipping test_watchpoint_triggered_in_syscall due to noinferiorio"
444 # Run until we get to the first marker function.
447 set testname "Watch buffer passed to read syscall"
448 if [runto marker2] then {
449 gdb_test "watch buf\[0\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[0\\\]"
450 gdb_test "watch buf\[1\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[1\\\]"
451 gdb_test "watch buf\[2\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[2\\\]"
452 gdb_test "watch buf\[3\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[3\\\]"
453 gdb_test "watch buf\[4\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[4\\\]"
454 gdb_test "break marker4" ".*Breakpoint.*"
456 gdb_test "set doread = 1" ""
458 # If we send_gdb "123\n" before gdb has switched the tty, then it goes
459 # to gdb, not the inferior, and we lose. So that is why we have
460 # watchpoint.c prompt us, so we can wait for that prompt.
461 send_gdb "continue\n";
463 -re "Continuing\\.\r\ntype stuff for buf now:" {
464 pass "continue to read"
467 fail "continue to read";
474 -re ".*\[Ww\]atchpoint.*buf\\\[0\\\].*Old value = 0.*New value = 49\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
475 -re ".*\[Ww\]atchpoint.*buf\\\[1\\\].*Old value = 0.*New value = 50\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
476 -re ".*\[Ww\]atchpoint.*buf\\\[2\\\].*Old value = 0.*New value = 51\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
477 -re ".*\[Ww\]atchpoint.*buf\\\[3\\\].*Old value = 0.*New value = 10\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
478 -re ".*$gdb_prompt $" { pass "sent 123" }
479 timeout { fail "sent 123 (timeout)" }
482 # Examine the values in buf to see how many watchpoints we
483 # should have printed.
484 send_gdb "print buf\[0\]\n"
486 -re ".*= 49.*$gdb_prompt $" { set y [expr $y+1]; pass "print buf\[0\]"}
487 -re ".*= 0.*$gdb_prompt $" { pass "print buf\[0\]"}
488 -re ".*$gdb_prompt $" { fail "print buf\[0\]"}
489 default { fail "print buf\[0\]"}
491 send_gdb "print buf\[1\]\n"
493 -re ".*= 50.*$gdb_prompt $" { set y [expr $y+1]; pass "print buf\[1\]"}
494 -re ".*= 0.*$gdb_prompt $" { pass "print buf\[1\]"}
495 -re ".*$gdb_prompt $" { fail "print buf\[1\]"}
496 default { fail "print buf\[1\]"}
498 send_gdb "print buf\[2\]\n"
500 -re ".*= 51.*$gdb_prompt $" { set y [expr $y+1]; pass "print buf\[2\]"}
501 -re ".*= 0.*$gdb_prompt $" { pass "print buf\[2\]"}
502 -re ".*$gdb_prompt $" { fail "print buf\[2\]"}
503 default { fail "print buf\[2\]"}
505 send_gdb "print buf\[3\]\n"
507 -re ".*= 10.*$gdb_prompt $" { set y [expr $y+1]; pass "print buf\[3\]"}
508 -re ".*= 0.*$gdb_prompt $" { pass "print buf\[3\]"}
509 -re ".*$gdb_prompt $" { fail "print buf\[3\]" }
510 default { fail "print buf\[3\]" }
513 # Did we find what we were looking for? If not, flunk it.
514 if [expr $x==$y] then { pass $testname } else { fail "$testname (only triggered $x watchpoints, expected $y)"}
516 # Continue until we hit the finishing marker function.
517 # Make sure we hit no more watchpoints.
518 gdb_test "cont" "Continuing.*Breakpoint.*marker4 \\(\\).*" \
519 "continue to marker4"
521 # Disable everything so we can finish the program at full speed
522 gdb_test "disable" "" "disable in test_watchpoint_triggered_in_syscall"
524 if [target_info exists gdb,noresults] { return }
526 gdb_test "cont" "Continuing.*Program exited normally.*" \
527 "continue to exit in test_watchpoint_triggered_in_syscall"
531 # Do a simple test of of watching through a pointer when the pointer
532 # itself changes. Should add some more complicated stuff here.
534 proc test_complex_watchpoint {} {
537 if [runto marker4] then {
538 gdb_test "watch ptr1->val" ".*\[Ww\]atchpoint \[0-9\]*: ptr1->val"
539 gdb_test "break marker5" ".*Breakpoint.*"
541 gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ptr1->val.*Old value = 1.*New value = 2.*" "Test complex watchpoint"
543 # Continue until we hit the marker5 function.
544 # Make sure we hit no more watchpoints.
546 gdb_test "cont" "Continuing.*Breakpoint.*marker5 \\(\\).*" \
547 "did not trigger wrong watchpoint"
548 #********************
549 # Test watches of things declared locally in a function.
550 # In particular, test that a watch of stack-based things
551 # is deleted when the stack-based things go out of scope.
553 gdb_test "disable" "" "disable in test_complex_watchpoint"
554 gdb_test "break marker6" ".*Breakpoint.*"
555 gdb_test "cont" "Continuing.*Breakpoint.*marker6 \\(\\).*" \
556 "continue to marker6"
557 gdb_test "break func2" ".*Breakpoint.*"
558 gdb_test "cont" "Continuing.*func2.*"
560 # Test a watch of a single stack-based variable, whose scope
561 # is the function we're now in. This should auto-delete when
562 # execution exits the scope of the watchpoint.
564 gdb_test "watch local_a" ".*\[Ww\]atchpoint \[0-9\]*: local_a" "set local watch"
565 gdb_test "cont" "\[Ww\]atchpoint.*local_a.*" "trigger local watch"
566 gdb_test "cont" "Continuing.*Watchpoint .* deleted because the program has left the block in.*which its expression is valid.*" "self-delete local watch"
568 # after func2 returned, gdb stopped and deleted the watchpoint
569 # we're now in main, let's get to func2
570 gdb_test "cont" "Continuing.*func2.*"
572 # We should be in "func2" again now. Test a watch of an
573 # expression which includes both a stack-based local and
574 # something whose scope is larger than this invocation
575 # of "func2". This should also auto-delete.
577 gdb_test "watch local_a + ival5" ".*\[Ww\]atchpoint \[0-9\]*: local_a . ival5" \
578 "set partially local watch"
579 gdb_test "cont" "Continuing.*\[Ww\]atchpoint .*: local_a . ival5.*" \
580 "trigger1 partially local watch"
581 gdb_test "cont" "Continuing.*\[Ww\]atchpoint .*: local_a . ival5.*" \
582 "trigger2 partially local watch"
583 gdb_test "cont" "Continuing.*\[Ww\]atchpoint .* deleted because the program has left the block in.*which its expression is valid.*" \
584 "self-delete partially local watch"
586 # after func2 returned, gdb stopped and deleted the watchpoint
587 # we're now in main, let's get to func2
588 gdb_test "cont" "Continuing.*func2.*"
590 # We should be in "func2" again now. Test a watch of a
591 # static (non-stack-based) local. Since this has scope
592 # across any invocations of "func2", it should not auto-
595 gdb_test "watch static_b" ".*\[Ww\]atchpoint \[0-9\]*: static_b" \
596 "set static local watch"
597 gdb_test "cont" "Continuing.*\[Ww\]atchpoint .*: static_b.*" \
598 "trigger static local watch"
599 gdb_test "cont" "Continuing.*marker6 \\(\\).*" \
600 "continue after trigger static local watch"
601 gdb_test "info break" ".*watchpoint.*static_b.*" \
602 "static local watch did not self-delete"
604 # We should be in "recurser" now. Test a watch of a stack-
605 # based local. Symbols mentioned in a watchpoint are bound
606 # at watchpoint-creation. Thus, a watch of a stack-based
607 # local to a recursing function should be bound only to that
608 # one invocation, and should not trigger for other invocations.
610 gdb_test "tbreak recurser" ".*Breakpoint.*"
611 gdb_test "cont" "Continuing.*recurser.*"
612 gdb_test "watch local_x" ".*\[Ww\]atchpoint \[0-9\]*: local_x" \
613 "set local watch in recursive call"
614 gdb_test "cont" "Continuing.*\[Ww\]atchpoint .*: local_x.*New value = 2.*" \
615 "trigger local watch in recursive call"
616 gdb_test "cont" "Continuing.*\[Ww\]atchpoint .* deleted because the program has left the block in.*which its expression is valid.*" \
617 "self-delete local watch in recursive call"
623 # Disable everything so we can finish the program at full speed
624 gdb_test "disable" "" "disable in test_complex_watchpoint"
626 if [target_info exists gdb,noresults] { return }
629 gdb_test "cont" "Continuing.*Program exited normally.*" \
630 "continue to exit in test_complex_watchpoint"
634 # Start with a fresh gdb.
637 gdb_reinitialize_dir $srcdir/$subdir
640 verbose "Timeout now 600 sec.\n"
642 if [initialize] then {
644 test_simple_watchpoint
646 # The IDT/sim monitor only has 8 (!) open files, of which it uses
647 # 4 (!). So we have to make sure one program exits before
648 # starting another one.
649 if [istarget "mips-idt-*"] then {
652 gdb_reinitialize_dir $srcdir/$subdir
657 test_disabling_watchpoints
660 if [istarget "mips-idt-*"] then {
663 gdb_reinitialize_dir $srcdir/$subdir
668 if ![target_info exists gdb,cannot_call_functions] {
672 if [istarget "mips-idt-*"] then {
675 gdb_reinitialize_dir $srcdir/$subdir
681 # Only enabled for some targets merely because it has not been tested
683 # On sparc-sun-sunos4.1.3, GDB was running all the way to the marker4
684 # breakpoint before stopping for the watchpoint. I don't know why.
685 if {[istarget "hppa*-*-*"]} then {
686 test_watchpoint_triggered_in_syscall
690 if [istarget "mips-idt-*"] then {
693 gdb_reinitialize_dir $srcdir/$subdir
698 # Only enabled for some targets merely because it has not been tested
700 if {[istarget "hppa*-*-*"] || \
701 [istarget "sparc*-*-sunos*"] || \
702 [istarget "m32r-*-*"]} then {
703 test_complex_watchpoint
707 # Verify that a user can force GDB to use "slow" watchpoints.
708 # (This proves rather little on kernels that don't support
709 # fast watchpoints, but still...)
711 if ![runto_main] then { fail "watch tests suppressed" }
713 send_gdb "set can-use-hw-watchpoints 0\n"
716 {pass "disable fast watches"}
717 timeout {fail "(timeout) disable fast watches"}
719 send_gdb "show can-use-hw-watchpoints\n"
721 -re "Debugger's willingness to use watchpoint hardware is 0.*$gdb_prompt $"\
722 {pass "show disable fast watches"}
724 {fail "show disable fast watches"}
725 timeout {fail "(timeout) show disable fast watches"}
727 send_gdb "watch ival3 if count > 1\n"
729 -re "Watchpoint \[0-9\]*: ival3.*$gdb_prompt $"\
730 {pass "set slow conditional watch"}
732 {fail "set slow conditional watch"}
733 timeout {fail "(timeout) set slow conditional watch"}
735 send_gdb "continue\n"
737 -re "Watchpoint \[0-9\]*: ival3.*Old value = 1.*New value = 2.*$gdb_prompt $"\
738 {pass "trigger slow conditional watch"}
740 {fail "trigger slow conditional watch"}
741 timeout {fail "(timeout) trigger slow conditional watch"}
744 # We've explicitly disabled hardware watches. Verify that GDB
747 send_gdb "rwatch ival3\n"
749 -re "Expression cannot be implemented with read/access watchpoint..*$gdb_prompt $"\
750 {pass "rwatch disallowed when can-set-hw-watchpoints cleared"}
752 {fail "rwatch disallowed when can-set-hw-watchpoints cleared"}
753 timeout {fail "(timeout) rwatch disallowed when can-use-hw-watchpoints cleared"}
756 # Read- and access watchpoints are unsupported on HP-UX. Verify
757 # that GDB gracefully responds to requests to create them.
759 if [istarget "hppa*-*-hpux*"] then {
760 send_gdb "set can-use-hw-watchpoints 1\n"
763 {pass "enable fast watches"}
764 timeout {fail "(timeout) enable fast watches"}
766 send_gdb "rwatch ival3\n"
768 -re "Target does not have this type of hardware watchpoint support.*$gdb_prompt $"\
769 {pass "read watches disallowed"}
771 {fail "read watches disallowed"}
772 timeout {fail "(timeout) read watches disallowed"}
775 send_gdb "awatch ival3\n"
777 -re "Target does not have this type of hardware watchpoint support.*$gdb_prompt $"\
778 {pass "access watches disallowed"}
780 {fail "access watches disallowed"}
781 timeout {fail "(timeout) access watches disallowed"}