* lib/gdb.exp (gdb_test): Between $pattern and $prompt, expect
[binutils-gdb.git] / gdb / testsuite / gdb.base / watchpoint.exp
1 # Copyright (C) 1992 Free Software Foundation, Inc.
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 2 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, write to the Free Software
15 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
16
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
19
20 # This file was written by Fred Fish. (fnf@cygnus.com)
21
22 if $tracelevel then {
23 strace $tracelevel
24 }
25
26 set prms_id 0
27 set bug_id 0
28
29 set binfile "watchpoint"
30 set srcfile $binfile.c
31
32 if ![file exists $objdir/$subdir/$binfile] then {
33 perror "$objdir/$subdir/$binfile does not exist."
34 return 0
35 }
36
37
38 # Prepare for watchpoint tests by setting up two breakpoints and one
39 # watchpoint.
40 #
41 # We use breakpoints at marker functions to get past all the startup code,
42 # so we can get to the watchpoints in a reasonable amount of time from a
43 # known starting point.
44 #
45 # For simplicity, so we always know how to reference specific breakpoints or
46 # watchpoints by number, we expect a particular ordering and numbering of
47 # each in the combined breakpoint/watchpoint table, as follows:
48 #
49 # Number What Where
50 # 1 Breakpoint marker1()
51 # 2 Breakpoint marker2()
52 # 3 Watchpoint ival3
53
54 proc initialize {} {
55 global prompt
56 global hex
57 global decimal
58 global srcfile
59
60 send "break marker1\n"
61 expect {
62 -re "Breakpoint 1 at $hex: file .*$srcfile, line $decimal.*$prompt $" {}
63 -re ".*$prompt $" { fail "set breakpoint at marker1" ; return 0 }
64 timeout { fail "set breakpoint at marker1 (timeout)" ; return 0 }
65 }
66
67 send "break marker2\n"
68 expect {
69 -re "Breakpoint 2 at $hex: file .*$srcfile, line $decimal.*$prompt $" {}
70 -re ".*$prompt $" { fail "set breakpoint at marker2" ; return 0 }
71 timeout { fail "set breakpoint at marker2 (timeout)" ; return 0 }
72 }
73
74 send "info break\n"
75 expect {
76 -re "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*\r\n$prompt $" { }
77 -re ".*$prompt $" { fail "breakpoints not setup right" ; return 0 }
78 timeout { fail "info break (timeout)" ; return 0 }
79 }
80
81 send "watch ival3\n"
82 expect {
83 -re ".*\[Ww\]atchpoint 3: ival3\r\n$prompt $" { pass "set watchpoint" }
84 -re ".*$prompt $" { fail "set watchpoint on ival3" ; return 0 }
85 timeout { fail "set watchpoint on ival3 (timeout)" ; return 0 }
86 }
87
88 # "info watch" is the same as "info break"
89
90 send "info watch\n"
91 expect {
92 -re "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*\r\n3\[ \]*.*watchpoint.*ival3\r\n$prompt $" {
93 pass "watchpoint found in watchpoint/breakpoint table"
94 }
95 -re ".*$prompt $" { fail "watchpoint/breakpoint not set" ; return 0 }
96 timeout { fail "info break (timeout)" ; return 0 }
97 }
98
99 # After installing the watchpoint, we disable it until we are ready
100 # to use it. This allows the test program to run at full speed until
101 # we get to the first marker function.
102
103 send "disable 3\n"
104 expect {
105 -re "disable 3\r\n$prompt $" { pass "watchpoint disabled" }
106 -re ".*$prompt $" { fail "watchpoint not disabled" ; return 0 }
107 timeout { fail "watchpoint not disabled (timeout)" ; return 0 }
108 }
109
110 return 1
111 }
112
113 #
114 # Test simple watchpoint.
115 #
116
117 proc test_simple_watchpoint {} {
118 global prompt
119 global hex
120 global decimal
121
122 # Ensure that the watchpoint is disabled when we startup.
123
124 send "disable 3\n"
125 expect {
126 -re "disable 3\r\n$prompt $" { }
127 -re ".*$prompt $" { fail "watchpoint not disabled" ; return 0 }
128 timeout { fail "watchpoint not disabled (timeout)" ; return 0 }
129 }
130
131 # Run until we get to the first marker function.
132
133 send "run\n"
134 expect {
135 -re "The program .* has been started already.* \(y or n\) $" {
136 send "y\n"
137 exp_continue
138 }
139 -re "Starting program.*Breakpoint 1, marker1 .*$prompt $" {}
140 -re ".*$prompt $" { fail "run until marker1 function hit" ; return }
141 timeout { fail "run until marker1 function hit (timeout)" ; return }
142 }
143
144 # After reaching the marker function, enable the watchpoint.
145
146 send "enable 3\n"
147 expect {
148 -re "enable 3\r\n$prompt $" { pass "watchpoint enabled" }
149 -re ".*$prompt $" { fail "watchpoint not enabled" ; return }
150 timeout { fail "watchpoint not enabled (timeout)" ; return }
151 }
152
153 gdb_test "break func1" "Breakpoint.*at"
154 gdb_test "set \\\$func1_breakpoint_number = \\\$bpnum" ""
155
156 gdb_test "continue" "Continuing.*Breakpoint \[0-9\]*, func1" \
157 "continue to breakpoint at func1"
158
159 # Continue until the first change, from -1 to 0
160
161 send "cont\n"
162 expect {
163 -re "Continuing.*Watchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count; ival4 = count;.*$prompt $" {
164 pass "watchpoint hit, first time"
165 }
166 -re "Continuing.*Watchpoint.*ival3.*Old value = -1.*New value = 0.*for .count = 0; count < 4; count\[+)\]+ \{.*$prompt $" {
167 # setup_xfail "m68*-*-sunos*" 1836
168 fail "missed first watchpoint"
169 return
170 }
171 -re "Continuing.*Breakpoint.*func1.*$prompt $" {
172 setup_xfail "m68*-*-*" 2597
173 fail "thought it hit breakpoint at func1 twice"
174 gdb_test "delete \\\$func1_breakpoint_number" ""
175 gdb_test "continue" "\
176 Continuing.*Watchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count;" \
177 "watchpoint hit, first time"
178 }
179 -re ".*$prompt $" { fail "missed first watchpoint" ; return }
180 timeout { fail "run to first watchpoint (timeout)" ; return }
181 eof { fail "run to first watchpoint (eof)" ; return }
182 }
183
184 gdb_test "delete \\\$func1_breakpoint_number" ""
185
186 # Continue until the next change, from 0 to 1.
187
188 send "cont\n"
189 expect {
190 -re "Continuing.*Watchpoint.*ival3.*Old value = 0.*New value = 1.*ival3 = count; ival4 = count;.*$prompt $" {
191 pass "watchpoint hit, second time"
192 }
193 -re ".*$prompt $" { fail "missed second watchpoint" ; return }
194 timeout { fail "run to second watchpoint (timeout)" ; return }
195 }
196
197 # Continue until the next change, from 1 to 2.
198
199 send "cont\n"
200 expect {
201 -re "Continuing.*Watchpoint.*ival3.*Old value = 1.*New value = 2.*ival3 = count; ival4 = count;.*$prompt $" {
202 pass "watchpoint hit, third time"
203 }
204 -re ".*$prompt $" { fail "missed third watchpoint" ; return }
205 timeout { fail "run to third watchpoint (timeout)" ; return }
206 }
207
208 # Continue until the next change, from 2 to 3.
209
210 send "cont\n"
211 expect {
212 -re "Continuing.*Watchpoint.*ival3.*Old value = 2.*New value = 3.*ival3 = count; ival4 = count;.*$prompt $" {
213 pass "watchpoint hit, fourth time"
214 }
215 -re ".*$prompt $" { fail "missed fourth watchpoint" ; return }
216 timeout { fail "run to fourth watchpoint (timeout)" ; return }
217 }
218
219 # Continue until the next change, from 3 to 4.
220 # Note that this one is outside the loop.
221
222 send "cont\n"
223 expect {
224 -re "Continuing.*Watchpoint.*ival3.*Old value = 3.*New value = 4.*ival3 = count; ival4 = count;.*$prompt $" {
225 pass "watchpoint hit, fifth time"
226 }
227 -re ".*$prompt $" { fail "missed fifth watchpoint" ; return }
228 timeout { fail "run to fifth watchpoint (timeout)" ; return }
229 }
230
231 # Continue until we hit the finishing marker function.
232 # Make sure we hit no more watchpoints.
233
234 # This used to fail for a29k-amd-udi (PR 2421), but has been fixed.
235 send "cont\n"
236 expect {
237 -re "Continuing.*Breakpoint.*marker2 \(\).*$prompt $" { }
238 -re "Continuing.*Watchpoint.*ival3.*$prompt $" {
239 fail "hit a disabled watchpoint" ; return
240 }
241 -re ".*$prompt $" { fail "marker2 function missed" ; return }
242 timeout { fail "run to marker2 function (timeout)" ; return }
243 }
244
245 # Disable the watchpoint so we run at full speed until we exit.
246
247 send "disable 3\n"
248 expect {
249 -re "disable 3\r\n$prompt $" { pass "watchpoint disabled" }
250 -re ".*$prompt $" { fail "watchpoint not disabled" ; return }
251 timeout { fail "watchpoint not disabled (timeout)" ; return }
252 }
253
254 # Run until process exits.
255
256 send "cont\n"
257 expect {
258 -re "Continuing.*Program exited normally.*$prompt $" { }
259 -re ".*$prompt $" { fail "watchpoints not removed" ; return }
260 timeout { fail "looking for process exit (timeout)" }
261 }
262 }
263
264 # Test disabling watchpoints.
265
266 proc test_disabling_watchpoints {} {
267 global prompt
268 global binfile
269 global srcfile
270 global decimal
271 global hex
272
273 # Ensure that the watchpoint is disabled when we startup.
274
275 send "disable 3\n"
276 expect {
277 -re "disable 3\r\n$prompt $" { }
278 -re ".*$prompt $" { fail "watchpoint not disabled" ; return 0 }
279 timeout { fail "watchpoint not disabled (timeout)" ; return 0 }
280 }
281
282 # Run until we get to the first marker function.
283
284 send "run\n"
285 expect {
286 -re "The program .* has been started already.* \(y or n\) $" {
287 send "y\n"
288 exp_continue
289 }
290 -re "Starting program.*Breakpoint 1, marker1 .*$prompt $" {}
291 -re ".*$prompt $" { fail "run until marker1 function hit" ; return }
292 timeout { fail "run until marker1 function hit (timeout)" ; return }
293 }
294
295 # After reaching the marker function, enable the watchpoint.
296
297 send "enable 3\n"
298 expect {
299 -re "enable 3\r\n$prompt $" { pass "watchpoint enabled" }
300 -re ".*$prompt $" { fail "watchpoint not enabled" ; return }
301 timeout { fail "watchpoint not enabled (timeout)" ; return }
302 }
303
304 # Continue until the first change, from -1 to 0
305 # Don't check the old value, because on VxWorks the variable value
306 # will not have been reinitialized.
307 send "cont\n"
308 expect {
309 -re "Continuing.*Watchpoint.*ival3.*Old value = .*New value = 0.*ival3 = count; ival4 = count;.*$prompt $" {
310 pass "watchpoint hit, first time"
311 }
312 -re "Continuing.*Watchpoint.*ival3.*Old value = .*New value = 0.*for .count = 0; count < 4; count\[+)]+ \{.*$prompt $" {
313 # setup_xfail "m68*-*-sunos*" 1836
314 fail "missed first watchpoint"
315 return
316 }
317 -re ".*$prompt $" { fail "missed first watchpoint" ; return }
318 timeout { fail "run to first watchpoint (timeout)" ; return }
319 }
320
321 # Continue until the next change, from 0 to 1.
322
323 send "cont\n"
324 expect {
325 -re "Continuing.*Watchpoint.*ival3.*Old value = 0.*New value = 1.*ival3 = count; ival4 = count;.*$prompt $" {
326 pass "watchpoint hit, second time"
327 }
328 -re ".*$prompt $" { fail "missed second watchpoint" ; return }
329 timeout { fail "run to second watchpoint (timeout)" ; return }
330 }
331
332 # Disable the watchpoint but leave breakpoints
333
334 send "disable 3\n"
335 expect {
336 -re "disable 3\r\n$prompt $" { }
337 -re ".*$prompt $" { fail "watchpoint not disabled" ; return 0 }
338 timeout { fail "watchpoint not disabled (timeout)" ; return 0 }
339 }
340
341 # Check watchpoint list, looking for the entry that confirms the
342 # watchpoint is disabled.
343
344 send "info watchpoints\n"
345 expect {
346 -re "3\[ \]*.*watchpoint\[ \]*keep\[ \]*n\[ \]*ival3\r\n.*$prompt $" {
347 pass "watchpoint disabled in table"
348 }
349 -re ".*$prompt $" {
350 fail "disabled watchpoint not found in table"
351 }
352 timeout { fail "info watchpoints (timeout)" }
353 }
354
355 # Continue until we hit the finishing marker function.
356 # Make sure we hit no more watchpoints.
357
358 send "cont\n"
359 expect {
360 -re "Continuing.*Breakpoint.*marker2 \[)(\]+.*$prompt $" {
361 pass "disabled watchpoint skipped"
362 }
363 -re "Continuing.*Watchpoint.*ival3.*$prompt $" {
364 fail "hit a disabled watchpoint" ; return
365 }
366 -re ".*$prompt $" { fail "marker2 function missed" ; return }
367 timeout { fail "run to marker2 function (timeout)" ; return }
368 }
369
370 send "cont\n"
371 expect {
372 -re "Continuing.*Program exited normally.*$prompt $" { }
373 -re ".*$prompt $" { fail "watchpoints not removed" ; return }
374 timeout { fail "looking for process exit (timeout)" }
375 }
376 }
377
378 # Test stepping and other mundane operations with watchpoints enabled
379 proc test_stepping {} {
380 global prompt
381
382 if [runto marker1] then {
383 gdb_test "watch ival2" ".*\[Ww\]atchpoint \[0-9\]*: ival2"
384
385 # Well, let's not be too mundane. It should be a *bit* of a challenge
386 gdb_test "break func2 if 0" "Breakpoint.*at"
387 gdb_test "p \\\$func2_breakpoint_number = \\\$bpnum" "="
388
389 # The HPPA has a problem here.
390 if [ istarget "hppa*-*-*" ] then {
391 # Don't actually try doing the call, if we do we can't continue.
392 setup_xfail "*-*-*"
393 fail "calling function with watchpoint enabled"
394 } else {
395 # The problem is that GDB confuses stepping through the call
396 # dummy with hitting the breakpoint at the end of the call dummy.
397 # Will be fixed once all architectures define
398 # CALL_DUMMY_BREAKPOINT_OFFSET.
399 setup_xfail "*-*-*"
400 # This doesn't occur if the call dummy starts with a call,
401 # because we are out of the dummy by the first time the inferior
402 # stops.
403 clear_xfail "m68*-*-*"
404 clear_xfail "i*86*-*-*"
405 clear_xfail "vax-*-*"
406 # The following architectures define CALL_DUMMY_BREAKPOINT_OFFSET.
407 clear_xfail "alpha-*-*"
408 clear_xfail "mips*-*-*"
409 clear_xfail "sparc-*-*"
410 gdb_test "p func1 ()" "= 73" \
411 "calling function with watchpoint enabled"
412 }
413
414 #
415 # "finish" brings us back to main.
416 # On some targets (e.g. alpha) gdb will stop from the finish in midline
417 # of the marker1 call. This is due to register restoring code on
418 # the alpha and might be caused by stack adjustment instructions
419 # on other targets. In this case we will step once more.
420 #
421 send "finish\n"
422 expect {
423 -re "Run.*exit from.*marker1.*main.* at" { }
424 default { fail "finish from marker1" ; return }
425 }
426 expect {
427 -re "marker1 \[)(\]+;.*$prompt $" {
428 send "step\n"
429 exp_continue
430 }
431 -re "func1 \[)(\]+;.*$prompt $" {
432 pass "finish from marker1"
433 }
434 -re ".*$prompt $" {
435 fail "finish from marker1"
436 }
437 default { fail "finish from marker1" ; return }
438 }
439
440 gdb_test "next" "for \[(\]+count = 0"
441
442 # Now test that "until" works. It's a bit tricky to test
443 # "until", because compilers don't always arrange the code
444 # exactly the same way, and we might get slightly different
445 # sequences of statements. But the following should be true
446 # (if not it is a compiler or a debugger bug): The user who
447 # does "until" at every statement of a loop should end up
448 # stepping through the loop once, and the debugger should not
449 # stop for any of the remaining iterations.
450
451 gdb_test "until" "ival1 = count"
452 gdb_test "until" "ival3 = count"
453 send "until\n"
454 expect {
455 -re "(for \[(\]+count = 0|\}).*$prompt $" {
456 gdb_test "until" "ival1 = count; /. Outside loop ./"
457 }
458 -re "ival1 = count; /. Outside loop ./.*$prompt $" {
459 pass "until out of loop"
460 }
461 -re ".*$prompt $" {
462 fail "until out of loop"
463 }
464 default { fail "until out of loop" ; return }
465 }
466
467 gdb_test "step" "ival2 = count"
468 }
469 }
470
471 # Test stepping and other mundane operations with watchpoints enabled
472 proc test_watchpoint_triggered_in_syscall {} {
473 global prompt
474 global timeout
475
476 set saved_timeout $timeout
477
478 # Run until we get to the first marker function.
479 set x 0
480 set y 0
481 set testname "Watch buffer passed to read syscall"
482 if [runto marker2] then {
483 gdb_test "watch buf\\\[0\\\]" ".*\[Ww\]atchpoint \[0-9\]*: buf"
484 gdb_test "watch buf\\\[1\\\]" ".*\[Ww\]atchpoint \[0-9\]*: buf"
485 gdb_test "watch buf\\\[2\\\]" ".*\[Ww\]atchpoint \[0-9\]*: buf"
486 gdb_test "watch buf\\\[3\\\]" ".*\[Ww\]atchpoint \[0-9\]*: buf"
487 gdb_test "watch buf\\\[4\\\]" ".*\[Ww\]atchpoint \[0-9\]*: buf"
488 gdb_test "break marker4" ".*Breakpoint.*"
489
490 send "set doread = 1\n"
491 expect {
492 -re ".*$prompt $" { }
493 timeout { fail "set doread" ; return }
494 }
495
496 # Sometimes our string never gets to GDB?!? dejagnu bug? Whatever
497 # the cause we'll set a reasonably short timeout and resend our
498 # string again if we timeout.
499 set timeout 10
500 send "continue\n"
501 send "123\n"
502 expect {
503 -re ".*Watchpoint.*buf\\\[0\\\].*Old value = 0.*New value = 49\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
504 -re ".*Watchpoint.*buf\\\[1\\\].*Old value = 0.*New value = 50\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
505 -re ".*Watchpoint.*buf\\\[2\\\].*Old value = 0.*New value = 51\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
506 -re ".*Watchpoint.*buf\\\[3\\\].*Old value = 0.*New value = 10\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
507 -re ".*$prompt $" { }
508 timeout {
509 set timeout $saved_timeout
510 send "123\n"
511 exp_continue
512 }
513 }
514
515 # Restore the timeout value.
516 set timeout $saved_timeout
517
518 # Examine the values in buf to see how many watchpoints we
519 # should have printed.
520 send "print buf\[0\]\n"
521 expect {
522 -re ".*= 49.*$prompt $" { set y [expr $y+1] }
523 -re ".*= 0" { }
524 default { fail "bogus value in buf[0]" }
525 timeout { fail "retrieving contents of buf variable (timeout) }
526 }
527 send "print buf\[1\]\n"
528 expect {
529 -re ".*= 50.*$prompt $" { set y [expr $y+1] }
530 -re ".*= 0" { }
531 default { fail "bogus value in buf[1]" }
532 timeout { fail "retrieving contents of buf variable (timeout) }
533 }
534 send "print buf\[2\]\n"
535 expect {
536 -re ".*= 51.*$prompt $" { set y [expr $y+1] }
537 -re ".*= 0" { }
538 default { fail "bogus value in buf[2]" }
539 timeout { fail "retrieving contents of buf variable (timeout) }
540 }
541 send "print buf\[3\]\n"
542 expect {
543 -re ".*= 10.*$prompt $" { set y [expr $y+1] }
544 -re ".*= 0" { }
545 default { fail "bogus value in buf[3]" }
546 timeout { fail "retrieving contents of buf variable (timeout) }
547 }
548
549 # Did we find what we were looking for? If not, flunk it.
550 if [expr $x==$y] then { pass $testname } else { fail "$testname: Only triggered $x watchpoints, expected $y."}
551
552 # Continue until we hit the finishing marker function.
553 # Make sure we hit no more watchpoints.
554
555 send "cont\n"
556 expect {
557 -re "Continuing.*Breakpoint.*marker4 \[)(\]+.*$prompt $" {
558 pass "disabled watchpoint skipped"
559 }
560 -re "Continuing.*Watchpoint.*$prompt $" {
561 fail "hit suprious watchpoint" ; return
562 }
563 -re ".*$prompt $" { fail "marker4 function missed" ; return }
564 timeout { fail "run to marker4 function (timeout)" ; return }
565 }
566
567 # Disable everything so we can finish the program at full speed
568 send "disable\n"
569 expect {
570 -re ".*$prompt $" { }
571 timeout { fail "disabling breakpoints (timeout)" }
572 }
573
574 send "cont\n"
575 expect {
576 -re "Continuing.*Program exited normally.*$prompt $" { }
577 -re ".*$prompt $" { fail "watchpoints not removed" ; return }
578 timeout { fail "looking for process exit (timeout)" }
579 }
580 }
581 }
582
583 # Do a simple test of of watching through a pointer when the pointer
584 # itself changes. Should add some more complicated stuff here.
585
586 proc test_complex_watchpoint {} {
587 global prompt
588
589 set testname "Test complex watchpoint"
590 if [runto marker4] then {
591 gdb_test "watch ptr1->val" ".*\[Ww\]atchpoint \[0-9\]*: ptr1->val"
592 gdb_test "break marker5" ".*Breakpoint.*"
593
594 send "cont\n"
595 expect {
596 -re "Continuing.*Watchpoint.*ptr1->val.*Old value = 1.*New value = 2.*$prompt $" { pass $testname }
597 default { fail $testname ; return }
598 }
599
600 # Continue until we hit the marker5 function.
601 # Make sure we hit no more watchpoints.
602
603 send "cont\n"
604 expect {
605 -re "Continuing.*Breakpoint.*marker5 \[)(\]+.*$prompt $" {
606 pass "did not trigger wrong watchpoint"
607 }
608 -re "Continuing.*Watchpoint.*$prompt $" {
609 fail "hit wrong watchpoint" ; return
610 }
611 -re ".*$prompt $" { fail "marker5 function missed" ; return }
612 timeout { fail "run to marker5 function (timeout)" ; return }
613 }
614
615 # Disable everything so we can finish the program at full speed
616 send "disable\n"
617 expect {
618 -re ".*$prompt $" { }
619 timeout { fail "disabling breakpoints (timeout)" }
620 }
621
622 send "cont\n"
623 expect {
624 -re "Continuing.*Program exited normally.*$prompt $" { }
625 -re ".*$prompt $" { fail "watchpoints not removed" ; return }
626 timeout { fail "looking for process exit (timeout)" }
627 }
628 }
629 }
630
631 # Start with a fresh gdb.
632
633 gdb_exit
634 gdb_start
635 gdb_reinitialize_dir $srcdir/$subdir
636 gdb_load $objdir/$subdir/$binfile
637
638 if [initialize] then {
639
640 # Preserve the old timeout, and set a new one that should be
641 # sufficient to step from marker1 to marker2 with watchpoints
642 # set anywhere.
643
644 set timeoutsave $timeout
645 set timeout 60
646
647 test_simple_watchpoint
648
649 # The IDT/sim monitor only has 8 (!) open files, of which it uses
650 # 4 (!). So we have to make sure one program exits before
651 # starting another one.
652 if [istarget "mips-idt-*"] then {
653 gdb_exit
654 gdb_start
655 gdb_reinitialize_dir $srcdir/$subdir
656 gdb_load $objdir/$subdir/$binfile
657 initialize
658 }
659
660 if [istarget "a29k-*-udi"] then {
661 # FIXME: If PR 2415 is fixed, this is not needed.
662 gdb_target_udi
663 gdb_load $objdir/$subdir/$binfile
664 }
665
666 test_disabling_watchpoints
667
668 # See above.
669 if [istarget "mips-idt-*"] then {
670 gdb_exit
671 gdb_start
672 gdb_reinitialize_dir $srcdir/$subdir
673 gdb_load $objdir/$subdir/$binfile
674 initialize
675 }
676
677 test_stepping
678
679 # See above.
680 if [istarget "mips-idt-*"] then {
681 gdb_exit
682 gdb_start
683 gdb_reinitialize_dir $srcdir/$subdir
684 gdb_load $objdir/$subdir/$binfile
685 initialize
686 }
687
688 # This test hasn't been tested on anything but the PA.
689 if [istarget "hppa*-*-*"] then {
690 test_watchpoint_triggered_in_syscall
691 }
692
693 # See above.
694 if [istarget "mips-idt-*"] then {
695 gdb_exit
696 gdb_start
697 gdb_reinitialize_dir $srcdir/$subdir
698 gdb_load $objdir/$subdir/$binfile
699 initialize
700 }
701
702 # This test hasn't been tested on anything but the PA.
703 if [istarget "hppa*-*-*"] then {
704 test_complex_watchpoint
705 }
706
707 # Restore the preserved old timeout value.
708
709 set timeout $timeoutsave
710 }
711
712 if [istarget "a29k-*-udi"] then {
713 # FIXME: If PR 2415 is fixed, this is not needed.
714 gdb_target_udi
715 }