Commit | Line | Data |
---|---|---|
c906108c SS |
1 | # Copyright (C) 1992, 1994, 1997, 1998 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 testfile "watchpoint" | |
30 | set srcfile ${testfile}.c | |
31 | set binfile ${objdir}/${subdir}/${testfile} | |
32 | ||
33 | ||
34 | if [get_compiler_info ${binfile}] { | |
35 | return -1 | |
36 | } | |
37 | ||
38 | # if we are on HPUX and we are not compiled with gcc, then skip these tests. | |
39 | ||
40 | if [istarget hppa*-*-hpux*] { | |
41 | if {!$gcc_compiled} { | |
42 | continue | |
43 | } | |
44 | } | |
45 | ||
46 | ||
47 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { | |
48 | gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." | |
49 | } | |
50 | ||
51 | # Prepare for watchpoint tests by setting up two breakpoints and one | |
52 | # watchpoint. | |
53 | # | |
54 | # We use breakpoints at marker functions to get past all the startup code, | |
55 | # so we can get to the watchpoints in a reasonable amount of time from a | |
56 | # known starting point. | |
57 | # | |
58 | # For simplicity, so we always know how to reference specific breakpoints or | |
59 | # watchpoints by number, we expect a particular ordering and numbering of | |
60 | # each in the combined breakpoint/watchpoint table, as follows: | |
61 | # | |
62 | # Number What Where | |
63 | # 1 Breakpoint marker1() | |
64 | # 2 Breakpoint marker2() | |
65 | # 3 Watchpoint ival3 | |
66 | ||
67 | proc initialize {} { | |
68 | global gdb_prompt | |
69 | global hex | |
70 | global decimal | |
71 | global srcfile | |
72 | ||
73 | if [gdb_test "break marker1" "Breakpoint 1 at $hex: file .*$srcfile, line $decimal.*" "set breakpoint at marker1" ] { | |
74 | return 0; | |
75 | } | |
76 | ||
77 | ||
78 | if [gdb_test "break marker2" "Breakpoint 2 at $hex: file .*$srcfile, line $decimal.*" "set breakpoint at marker2" ] { | |
79 | return 0; | |
80 | } | |
81 | ||
82 | ||
83 | if [gdb_test "info break" "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*" "info break in watchpoint.exp" ] { | |
84 | return 0; | |
85 | } | |
86 | ||
87 | ||
88 | if [gdb_test "watch ival3" ".*\[Ww\]atchpoint 3: ival3" "set watchpoint on ival3" ] { | |
89 | return 0; | |
90 | } | |
91 | ||
92 | ||
93 | # "info watch" is the same as "info break" | |
94 | ||
95 | if [gdb_test "info watch" "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*\r\n3\[ \]*.*watchpoint.*ival3" "watchpoint found in watchpoint/breakpoint table" ] { | |
96 | return 0; | |
97 | } | |
98 | ||
99 | ||
100 | # After installing the watchpoint, we disable it until we are ready | |
101 | # to use it. This allows the test program to run at full speed until | |
102 | # we get to the first marker function. | |
103 | ||
104 | if [gdb_test "disable 3" "disable 3\[\r\n\]+" "disable watchpoint" ] { | |
105 | return 0; | |
106 | } | |
107 | ||
108 | ||
109 | return 1 | |
110 | } | |
111 | ||
112 | # | |
113 | # Test simple watchpoint. | |
114 | # | |
115 | ||
116 | proc test_simple_watchpoint {} { | |
117 | global gdb_prompt | |
118 | global hex | |
119 | global decimal | |
120 | ||
121 | # Ensure that the watchpoint is disabled when we startup. | |
122 | ||
123 | if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint in test_simple_watchpoint" ] { | |
124 | return 0; | |
125 | } | |
126 | ||
127 | ||
128 | # Run until we get to the first marker function. | |
129 | ||
130 | gdb_run_cmd | |
131 | set timeout 600 | |
132 | gdb_expect { | |
133 | -re "Breakpoint 1, marker1 .*$gdb_prompt $" { | |
134 | pass "run to marker1 in test_simple_watchpoint" | |
135 | } | |
136 | -re ".*$gdb_prompt $" { | |
137 | fail "run to marker1 in test_simple_watchpoint" | |
138 | return | |
139 | } | |
140 | timeout { | |
141 | fail "run to marker1 in test_simple_watchpoint (timeout)" | |
142 | return | |
143 | } | |
144 | } | |
145 | ||
146 | # After reaching the marker function, enable the watchpoint. | |
147 | ||
148 | if [gdb_test "enable 3" "^enable 3\[\r\n\]+" "enable watchpoint" ] { | |
149 | return ; | |
150 | } | |
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_gdb "cont\n" | |
162 | gdb_expect { | |
163 | -re "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count; ival4 = count;.*$gdb_prompt $" { | |
164 | pass "watchpoint hit, first time" | |
165 | } | |
166 | -re "Continuing.*Breakpoint.*func1.*$gdb_prompt $" { | |
167 | setup_xfail "m68*-*-*" 2597 | |
168 | fail "thought it hit breakpoint at func1 twice" | |
169 | gdb_test "delete \$func1_breakpoint_number" "" | |
170 | gdb_test "continue" "\ | |
171 | Continuing.*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count;" \ | |
172 | "watchpoint hit, first time" | |
173 | } | |
174 | -re ".*$gdb_prompt $" { fail "watchpoint hit, first time" ; return } | |
175 | timeout { fail "watchpoint hit, first time (timeout)" ; return } | |
176 | eof { fail "watchpoint hit, first time (eof)" ; return } | |
177 | } | |
178 | ||
179 | gdb_test "delete \$func1_breakpoint_number" "" | |
180 | ||
181 | # Continue until the next change, from 0 to 1. | |
182 | gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 0.*New value = 1.*ival3 = count; ival4 = count;.*" "watchpoint hit, second time" | |
183 | ||
184 | # Continue until the next change, from 1 to 2. | |
185 | gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 1.*New value = 2.*ival3 = count; ival4 = count;.*" "watchpoint hit, third time" | |
186 | ||
187 | # Continue until the next change, from 2 to 3. | |
188 | gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 2.*New value = 3.*ival3 = count; ival4 = count;.*" "watchpoint hit, fourth time" | |
189 | ||
190 | # Continue until the next change, from 3 to 4. | |
191 | # Note that this one is outside the loop. | |
192 | ||
193 | gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = 3.*New value = 4.*ival3 = count; ival4 = count;.*" "watchpoint hit, fifth time" | |
194 | ||
195 | # Continue until we hit the finishing marker function. | |
196 | # Make sure we hit no more watchpoints. | |
197 | ||
198 | gdb_test "cont" "Continuing.*Breakpoint.*marker2 \(\).*" \ | |
199 | "continue to marker2" | |
200 | ||
201 | # Disable the watchpoint so we run at full speed until we exit. | |
202 | ||
203 | if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "watchpoint disabled" ] { | |
204 | return ; | |
205 | } | |
206 | ||
207 | ||
208 | # Run until process exits. | |
209 | ||
210 | if [target_info exists gdb,noresults] { return } | |
211 | ||
212 | gdb_test "cont" "Continuing.*Program exited normally.*" \ | |
213 | "continue to exit in test_simple_watchpoint" | |
214 | } | |
215 | ||
216 | # Test disabling watchpoints. | |
217 | ||
218 | proc test_disabling_watchpoints {} { | |
219 | global gdb_prompt | |
220 | global binfile | |
221 | global srcfile | |
222 | global decimal | |
223 | global hex | |
224 | ||
225 | # Ensure that the watchpoint is disabled when we startup. | |
226 | ||
227 | if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint in test_disabling_watchpoints" ] { | |
228 | return 0; | |
229 | } | |
230 | ||
231 | ||
232 | # Run until we get to the first marker function. | |
233 | ||
234 | gdb_run_cmd | |
235 | set timeout 600 | |
236 | gdb_expect { | |
237 | -re "Breakpoint 1, marker1 .*$gdb_prompt $" { | |
238 | pass "run to marker1 in test_disabling_watchpoints" | |
239 | } | |
240 | -re ".*$gdb_prompt $" { | |
241 | fail "run to marker1 in test_disabling_watchpoints" | |
242 | return | |
243 | } | |
244 | timeout { | |
245 | fail "run to marker1 in test_disabling_watchpoints (timeout)" | |
246 | return | |
247 | } | |
248 | } | |
249 | ||
250 | # After reaching the marker function, enable the watchpoint. | |
251 | ||
252 | if [gdb_test "enable 3" "^enable 3\[\r\n\]+" "watchpoint enabled" ] { | |
253 | return ; | |
254 | } | |
255 | ||
256 | ||
257 | # Continue until the first change, from -1 to 0 | |
258 | # Don't check the old value, because on VxWorks the variable value | |
259 | # will not have been reinitialized. | |
260 | gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = .*New value = 0.*ival3 = count; ival4 = count;.*" "watchpoint hit in test_disabling_watchpoints, first time" | |
261 | ||
262 | # Continue until the next change, from 0 to 1. | |
263 | 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" | |
264 | ||
265 | # Disable the watchpoint but leave breakpoints | |
266 | ||
267 | if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint #2 in test_disabling_watchpoints" ] { | |
268 | return 0; | |
269 | } | |
270 | ||
271 | ||
272 | # Check watchpoint list, looking for the entry that confirms the | |
273 | # watchpoint is disabled. | |
274 | gdb_test "info watchpoints" "3\[ \]*.*watchpoint\[ \]*keep\[ \]*n\[ \]*ival3\r\n.*" "watchpoint disabled in table" | |
275 | ||
276 | # Continue until we hit the finishing marker function. | |
277 | # Make sure we hit no more watchpoints. | |
278 | gdb_test "cont" "Continuing.*Breakpoint.*marker2 \\(\\).*" \ | |
279 | "disabled watchpoint skipped" | |
280 | ||
281 | if [target_info exists gdb,noresults] { return } | |
282 | ||
283 | gdb_test "cont" "Continuing.*Program exited normally.*" \ | |
284 | "continue to exit in test_disabling_watchpoints" | |
285 | } | |
286 | ||
287 | # Test stepping and other mundane operations with watchpoints enabled | |
288 | proc test_stepping {} { | |
289 | global gdb_prompt | |
290 | ||
291 | if [runto marker1] then { | |
292 | gdb_test "watch ival2" ".*\[Ww\]atchpoint \[0-9\]*: ival2" | |
293 | ||
294 | # Well, let's not be too mundane. It should be a *bit* of a challenge | |
295 | gdb_test "break func2 if 0" "Breakpoint.*at.*" | |
296 | gdb_test "p \$func2_breakpoint_number = \$bpnum" " = .*" | |
297 | ||
298 | # The HPPA has a problem here if it's not using hardware watchpoints | |
299 | if {[ istarget "hppa*-*-*" ] && ![ istarget "hppa*-*-*bsd*" ]} then { | |
300 | # Don't actually try doing the call, if we do we can't continue. | |
301 | setup_xfail "*-*-*" | |
302 | fail "calling function with watchpoint enabled" | |
303 | } else { | |
304 | # The problem is that GDB confuses stepping through the call | |
305 | # dummy with hitting the breakpoint at the end of the call dummy. | |
306 | # Will be fixed once all architectures define | |
307 | # CALL_DUMMY_BREAKPOINT_OFFSET. | |
308 | setup_xfail "*-*-*" | |
309 | # This doesn't occur if the call dummy starts with a call, | |
310 | # because we are out of the dummy by the first time the inferior | |
311 | # stops. | |
312 | clear_xfail "d10v*-*-*" | |
313 | clear_xfail "m68*-*-*" | |
314 | clear_xfail "i*86*-*-*" | |
315 | clear_xfail "vax-*-*" | |
316 | # The following architectures define CALL_DUMMY_BREAKPOINT_OFFSET. | |
317 | clear_xfail "alpha-*-*" | |
318 | clear_xfail "mips*-*-*" | |
319 | clear_xfail "sparc-*-*" | |
320 | clear_xfail "hppa*-*-*bsd*" | |
321 | # It works with the generic inferior function calling code too. | |
322 | clear_xfail "mn10200*-*-*" | |
323 | clear_xfail "mn10300*-*-*" | |
324 | gdb_test "p func1 ()" "= 73" \ | |
325 | "calling function with watchpoint enabled" | |
326 | } | |
327 | ||
328 | # | |
329 | # "finish" brings us back to main. | |
330 | # On some targets (e.g. alpha) gdb will stop from the finish in midline | |
331 | # of the marker1 call. This is due to register restoring code on | |
332 | # the alpha and might be caused by stack adjustment instructions | |
333 | # on other targets. In this case we will step once more. | |
334 | # | |
335 | ||
336 | send_gdb "finish\n" | |
337 | gdb_expect { | |
338 | -re "Run.*exit from.*marker1.* at" { } | |
339 | default { fail "finish from marker1" ; return } | |
340 | } | |
341 | ||
342 | gdb_expect { | |
343 | -re "marker1 \\(\\);.*$gdb_prompt $" { | |
344 | send_gdb "step\n" | |
345 | exp_continue | |
346 | } | |
347 | -re "func1 \\(\\);.*$gdb_prompt $" { | |
348 | pass "finish from marker1" | |
349 | } | |
350 | -re ".*$gdb_prompt $" { | |
351 | fail "finish from marker1" | |
352 | } | |
353 | default { fail "finish from marker1" ; return } | |
354 | } | |
355 | ||
356 | gdb_test "next" "for \\(count = 0.*" "next to `for' in watchpoint.exp" | |
357 | ||
358 | # Now test that "until" works. It's a bit tricky to test | |
359 | # "until", because compilers don't always arrange the code | |
360 | # exactly the same way, and we might get slightly different | |
361 | # sequences of statements. But the following should be true | |
362 | # (if not it is a compiler or a debugger bug): The user who | |
363 | # does "until" at every statement of a loop should end up | |
364 | # stepping through the loop once, and the debugger should not | |
365 | # stop for any of the remaining iterations. | |
366 | ||
367 | gdb_test "until" "ival1 = count.*" "until to ival1 assignment" | |
368 | gdb_test "until" "ival3 = count.*" "until to ival3 assignment" | |
369 | send_gdb "until\n" | |
370 | gdb_expect { | |
371 | -re "(for \\(count = 0|\}).*$gdb_prompt $" { | |
372 | gdb_test "until" "ival1 = count; /. Outside loop ./" \ | |
373 | "until out of loop" | |
374 | } | |
375 | -re "ival1 = count; /. Outside loop ./.*$gdb_prompt $" { | |
376 | pass "until out of loop" | |
377 | } | |
378 | -re ".*$gdb_prompt $" { | |
379 | fail "until out of loop" | |
380 | } | |
381 | default { fail "until out of loop" ; return } | |
382 | } | |
383 | ||
384 | gdb_test "step" "ival2 = count.*" "step to ival2 assignment" | |
385 | } | |
386 | } | |
387 | ||
388 | # Test stepping and other mundane operations with watchpoints enabled | |
389 | proc test_watchpoint_triggered_in_syscall {} { | |
390 | global gdb_prompt | |
391 | ||
392 | if [target_info exists gdb,noinferiorio] { | |
393 | verbose "Skipping test_watchpoint_triggered_in_syscall due to noinferiorio" | |
394 | return | |
395 | } | |
396 | # Run until we get to the first marker function. | |
397 | set x 0 | |
398 | set y 0 | |
399 | set testname "Watch buffer passed to read syscall" | |
400 | if [runto marker2] then { | |
401 | gdb_test "watch buf\[0\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[0\\\]" | |
402 | gdb_test "watch buf\[1\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[1\\\]" | |
403 | gdb_test "watch buf\[2\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[2\\\]" | |
404 | gdb_test "watch buf\[3\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[3\\\]" | |
405 | gdb_test "watch buf\[4\]" ".*\[Ww\]atchpoint \[0-9\]*: buf\\\[4\\\]" | |
406 | gdb_test "break marker4" ".*Breakpoint.*" | |
407 | ||
408 | gdb_test "set doread = 1" "" | |
409 | ||
410 | # If we send_gdb "123\n" before gdb has switched the tty, then it goes | |
411 | # to gdb, not the inferior, and we lose. So that is why we have | |
412 | # watchpoint.c prompt us, so we can wait for that prompt. | |
413 | send_gdb "continue\n"; | |
414 | gdb_expect { | |
415 | -re "Continuing\\.\r\ntype stuff for buf now:" { | |
416 | pass "continue to read" | |
417 | } | |
418 | default { | |
419 | fail "continue to read"; | |
420 | return ; | |
421 | } | |
422 | } | |
423 | ||
424 | send_gdb "123\n" | |
425 | gdb_expect { | |
426 | -re ".*\[Ww\]atchpoint.*buf\\\[0\\\].*Old value = 0.*New value = 49\[^\n\]*\n" { set x [expr $x+1] ; exp_continue } | |
427 | -re ".*\[Ww\]atchpoint.*buf\\\[1\\\].*Old value = 0.*New value = 50\[^\n\]*\n" { set x [expr $x+1] ; exp_continue } | |
428 | -re ".*\[Ww\]atchpoint.*buf\\\[2\\\].*Old value = 0.*New value = 51\[^\n\]*\n" { set x [expr $x+1] ; exp_continue } | |
429 | -re ".*\[Ww\]atchpoint.*buf\\\[3\\\].*Old value = 0.*New value = 10\[^\n\]*\n" { set x [expr $x+1] ; exp_continue } | |
430 | -re ".*$gdb_prompt $" { pass "sent 123" } | |
431 | timeout { fail "sent 123 (timeout)" } | |
432 | } | |
433 | ||
434 | # Examine the values in buf to see how many watchpoints we | |
435 | # should have printed. | |
436 | send_gdb "print buf\[0\]\n" | |
437 | gdb_expect { | |
438 | -re ".*= 49.*$gdb_prompt $" { set y [expr $y+1]; pass "print buf\[0\]"} | |
439 | -re ".*= 0.*$gdb_prompt $" { pass "print buf\[0\]"} | |
440 | -re ".*$gdb_prompt $" { fail "print buf\[0\]"} | |
441 | default { fail "print buf\[0\]"} | |
442 | } | |
443 | send_gdb "print buf\[1\]\n" | |
444 | gdb_expect { | |
445 | -re ".*= 50.*$gdb_prompt $" { set y [expr $y+1]; pass "print buf\[1\]"} | |
446 | -re ".*= 0.*$gdb_prompt $" { pass "print buf\[1\]"} | |
447 | -re ".*$gdb_prompt $" { fail "print buf\[1\]"} | |
448 | default { fail "print buf\[1\]"} | |
449 | } | |
450 | send_gdb "print buf\[2\]\n" | |
451 | gdb_expect { | |
452 | -re ".*= 51.*$gdb_prompt $" { set y [expr $y+1]; pass "print buf\[2\]"} | |
453 | -re ".*= 0.*$gdb_prompt $" { pass "print buf\[2\]"} | |
454 | -re ".*$gdb_prompt $" { fail "print buf\[2\]"} | |
455 | default { fail "print buf\[2\]"} | |
456 | } | |
457 | send_gdb "print buf\[3\]\n" | |
458 | gdb_expect { | |
459 | -re ".*= 10.*$gdb_prompt $" { set y [expr $y+1]; pass "print buf\[3\]"} | |
460 | -re ".*= 0.*$gdb_prompt $" { pass "print buf\[3\]"} | |
461 | -re ".*$gdb_prompt $" { fail "print buf\[3\]" } | |
462 | default { fail "print buf\[3\]" } | |
463 | } | |
464 | ||
465 | # Did we find what we were looking for? If not, flunk it. | |
466 | if [expr $x==$y] then { pass $testname } else { fail "$testname (only triggered $x watchpoints, expected $y)"} | |
467 | ||
468 | # Continue until we hit the finishing marker function. | |
469 | # Make sure we hit no more watchpoints. | |
470 | gdb_test "cont" "Continuing.*Breakpoint.*marker4 \\(\\).*" \ | |
471 | "continue to marker4" | |
472 | ||
473 | # Disable everything so we can finish the program at full speed | |
474 | gdb_test "disable" "" "disable in test_watchpoint_triggered_in_syscall" | |
475 | ||
476 | if [target_info exists gdb,noresults] { return } | |
477 | ||
478 | gdb_test "cont" "Continuing.*Program exited normally.*" \ | |
479 | "continue to exit in test_watchpoint_triggered_in_syscall" | |
480 | } | |
481 | } | |
482 | ||
483 | # Do a simple test of of watching through a pointer when the pointer | |
484 | # itself changes. Should add some more complicated stuff here. | |
485 | ||
486 | proc test_complex_watchpoint {} { | |
487 | global gdb_prompt | |
488 | ||
489 | if [runto marker4] then { | |
490 | gdb_test "watch ptr1->val" ".*\[Ww\]atchpoint \[0-9\]*: ptr1->val" | |
491 | gdb_test "break marker5" ".*Breakpoint.*" | |
492 | ||
493 | gdb_test "cont" "Continuing.*\[Ww\]atchpoint.*ptr1->val.*Old value = 1.*New value = 2.*" "Test complex watchpoint" | |
494 | ||
495 | # Continue until we hit the marker5 function. | |
496 | # Make sure we hit no more watchpoints. | |
497 | ||
498 | gdb_test "cont" "Continuing.*Breakpoint.*marker5 \\(\\).*" \ | |
499 | "did not trigger wrong watchpoint" | |
500 | ||
501 | # Disable everything so we can finish the program at full speed | |
502 | gdb_test "disable" "" "disable in test_complex_watchpoint" | |
503 | ||
504 | if [target_info exists gdb,noresults] { return } | |
505 | ||
506 | ||
507 | gdb_test "cont" "Continuing.*Program exited normally.*" \ | |
508 | "continue to exit in test_complex_watchpoint" | |
509 | } | |
510 | } | |
511 | ||
512 | # Start with a fresh gdb. | |
513 | ||
514 | gdb_start | |
515 | gdb_reinitialize_dir $srcdir/$subdir | |
516 | gdb_load $binfile | |
517 | set timeout 600 | |
518 | verbose "Timeout now 600 sec.\n" | |
519 | ||
520 | if [initialize] then { | |
521 | ||
522 | test_simple_watchpoint | |
523 | ||
524 | # The IDT/sim monitor only has 8 (!) open files, of which it uses | |
525 | # 4 (!). So we have to make sure one program exits before | |
526 | # starting another one. | |
527 | if [istarget "mips-idt-*"] then { | |
528 | gdb_exit | |
529 | gdb_start | |
530 | gdb_reinitialize_dir $srcdir/$subdir | |
531 | gdb_load $binfile | |
532 | initialize | |
533 | } | |
534 | ||
535 | test_disabling_watchpoints | |
536 | ||
537 | # See above. | |
538 | if [istarget "mips-idt-*"] then { | |
539 | gdb_exit | |
540 | gdb_start | |
541 | gdb_reinitialize_dir $srcdir/$subdir | |
542 | gdb_load $binfile | |
543 | initialize | |
544 | } | |
545 | ||
546 | if ![target_info exists gdb,cannot_call_functions] { | |
547 | test_stepping | |
548 | ||
549 | # See above. | |
550 | if [istarget "mips-idt-*"] then { | |
551 | gdb_exit | |
552 | gdb_start | |
553 | gdb_reinitialize_dir $srcdir/$subdir | |
554 | gdb_load $binfile | |
555 | initialize | |
556 | } | |
557 | } | |
558 | ||
559 | # Only enabled for some targets merely because it has not been tested | |
560 | # elsewhere. | |
561 | # On sparc-sun-sunos4.1.3, GDB was running all the way to the marker4 | |
562 | # breakpoint before stopping for the watchpoint. I don't know why. | |
563 | if {[istarget "hppa*-*-*"]} then { | |
564 | test_watchpoint_triggered_in_syscall | |
565 | } | |
566 | ||
567 | # See above. | |
568 | if [istarget "mips-idt-*"] then { | |
569 | gdb_exit | |
570 | gdb_start | |
571 | gdb_reinitialize_dir $srcdir/$subdir | |
572 | gdb_load $binfile | |
573 | initialize | |
574 | } | |
575 | ||
576 | # Only enabled for some targets merely because it has not been tested | |
577 | # elsewhere. | |
578 | if {[istarget "hppa*-*-*"] || \ | |
579 | [istarget "sparc*-*-sunos*"] || \ | |
580 | [istarget "m32r-*-*"]} then { | |
581 | test_complex_watchpoint | |
582 | } | |
583 | } |