Commit | Line | Data |
---|---|---|
b6ba6518 | 1 | # Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, |
0fb0cc75 | 2 | # 2000, 2002, 2003, 2007, 2008, 2009 Free Software Foundation, Inc. |
c906108c SS |
3 | |
4 | # This program is free software; you can redistribute it and/or modify | |
5 | # it under the terms of the GNU General Public License as published by | |
e22f8b7c | 6 | # the Free Software Foundation; either version 3 of the License, or |
c906108c | 7 | # (at your option) any later version. |
e22f8b7c | 8 | # |
c906108c SS |
9 | # This program is distributed in the hope that it will be useful, |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
e22f8b7c | 13 | # |
c906108c | 14 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
c906108c | 16 | |
c906108c SS |
17 | # This file was written by Rob Savoye. (rob@cygnus.com) |
18 | ||
dbc52822 | 19 | if { [prepare_for_testing break.exp "break" {break.c break1.c} {debug nowarnings}] } { |
085dd6e6 JM |
20 | return -1 |
21 | } | |
dbc52822 VP |
22 | set srcfile break.c |
23 | set srcfile1 break1.c | |
c906108c SS |
24 | # |
25 | # test simple breakpoint setting commands | |
26 | # | |
27 | ||
28 | # Test deleting all breakpoints when there are none installed, | |
29 | # GDB should not prompt for confirmation. | |
9d6f42e9 | 30 | # Note that lib/gdb.exp provides a "delete_breakpoints" proc |
c906108c SS |
31 | # for general use elsewhere. |
32 | ||
33 | send_gdb "delete breakpoints\n" | |
34 | gdb_expect { | |
35 | -re "Delete all breakpoints.*$" { | |
36 | send_gdb "y\n" | |
37 | gdb_expect { | |
38 | -re "$gdb_prompt $" { | |
39 | fail "Delete all breakpoints when none (unexpected prompt)" | |
40 | } | |
41 | timeout { fail "Delete all breakpoints when none (timeout after unexpected prompt)" } | |
42 | } | |
43 | } | |
44 | -re ".*$gdb_prompt $" { pass "Delete all breakpoints when none" } | |
45 | timeout { fail "Delete all breakpoints when none (timeout)" } | |
46 | } | |
47 | ||
48 | # | |
49 | # test break at function | |
50 | # | |
51 | gdb_test "break main" \ | |
52 | "Breakpoint.*at.* file .*$srcfile, line.*" \ | |
53 | "breakpoint function" | |
54 | ||
df763c7f DJ |
55 | # |
56 | # test break at quoted function | |
57 | # | |
58 | gdb_test "break \"marker2\"" \ | |
a1dea79a | 59 | "Breakpoint.*at.* file .*$srcfile1, line.*" \ |
df763c7f DJ |
60 | "breakpoint quoted function" |
61 | ||
c906108c SS |
62 | # |
63 | # test break at function in file | |
64 | # | |
65 | gdb_test "break $srcfile:factorial" \ | |
66 | "Breakpoint.*at.* file .*$srcfile, line.*" \ | |
67 | "breakpoint function in file" | |
68 | ||
a50d3602 EZ |
69 | set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] |
70 | ||
c906108c SS |
71 | # |
72 | # test break at line number | |
73 | # | |
e6f9e514 JB |
74 | # Note that the default source file is the last one whose source text |
75 | # was printed. For native debugging, before we've executed the | |
76 | # program, this is the file containing main, but for remote debugging, | |
77 | # it's wherever the processor was stopped when we connected to the | |
78 | # board. So, to be sure, we do a list command. | |
79 | # | |
80 | gdb_test "list main" \ | |
81 | ".*main \\(argc, argv, envp\\).*" \ | |
82 | "use `list' to establish default source file" | |
a50d3602 EZ |
83 | gdb_test "break $bp_location1" \ |
84 | "Breakpoint.*at.* file .*$srcfile, line $bp_location1\\." \ | |
c906108c SS |
85 | "breakpoint line number" |
86 | ||
87 | # | |
88 | # test duplicate breakpoint | |
89 | # | |
a50d3602 EZ |
90 | gdb_test "break $bp_location1" \ |
91 | "Note: breakpoint \[0-9\]+ also set at pc.*Breakpoint \[0-9\]+ at.* file .*$srcfile, line $bp_location1\\." \ | |
c906108c SS |
92 | "breakpoint duplicate" |
93 | ||
a50d3602 EZ |
94 | set bp_location2 [gdb_get_line_number "set breakpoint 2 here"] |
95 | ||
c906108c SS |
96 | # |
97 | # test break at line number in file | |
98 | # | |
a50d3602 EZ |
99 | gdb_test "break $srcfile:$bp_location2" \ |
100 | "Breakpoint.*at.* file .*$srcfile, line $bp_location2\\." \ | |
c906108c SS |
101 | "breakpoint line number in file" |
102 | ||
a50d3602 EZ |
103 | set bp_location3 [gdb_get_line_number "set breakpoint 3 here"] |
104 | set bp_location4 [gdb_get_line_number "set breakpoint 4 here"] | |
c906108c | 105 | |
f286b2c3 JL |
106 | # |
107 | # Test putting a break at the start of a multi-line if conditional. | |
108 | # Verify the breakpoint was put at the start of the conditional. | |
109 | # | |
110 | gdb_test "break multi_line_if_conditional" \ | |
a50d3602 | 111 | "Breakpoint.*at.* file .*$srcfile, line $bp_location3\\." \ |
f286b2c3 JL |
112 | "breakpoint at start of multi line if conditional" |
113 | ||
114 | gdb_test "break multi_line_while_conditional" \ | |
a50d3602 | 115 | "Breakpoint.*at.* file .*$srcfile, line $bp_location4\\." \ |
f286b2c3 JL |
116 | "breakpoint at start of multi line while conditional" |
117 | ||
a50d3602 EZ |
118 | set bp_location5 [gdb_get_line_number "set breakpoint 5 here"] |
119 | set bp_location6 [gdb_get_line_number "set breakpoint 6 here"] | |
120 | ||
c906108c SS |
121 | # |
122 | # check to see what breakpoints are set | |
123 | # | |
124 | if [target_info exists gdb_stub] { | |
a50d3602 | 125 | set main_line $bp_location5 |
c906108c | 126 | } else { |
a50d3602 | 127 | set main_line $bp_location6 |
c906108c SS |
128 | } |
129 | ||
085dd6e6 JM |
130 | if {$hp_aCC_compiler} { |
131 | set proto "\\(int\\)" | |
132 | } else { | |
133 | set proto "" | |
134 | } | |
82025e13 | 135 | |
a50d3602 | 136 | set bp_location7 [gdb_get_line_number "set breakpoint 7 here"] |
a1dea79a FF |
137 | set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile1] |
138 | set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile1] | |
a50d3602 | 139 | |
c906108c | 140 | gdb_test "info break" \ |
54e52265 | 141 | "Num Type\[ \]+Disp Enb Address\[ \]+What.* |
c906108c | 142 | \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$main_line.* |
a1dea79a | 143 | \[0-9\]+\[\t \]+breakpoint keep y.* in marker2 at .*$srcfile1:($bp_location8|$bp_location9).* |
a50d3602 EZ |
144 | \[0-9\]+\[\t \]+breakpoint keep y.* in factorial$proto at .*$srcfile:$bp_location7.* |
145 | \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.* | |
146 | \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.* | |
147 | \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location2.* | |
148 | \[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_if_conditional at .*$srcfile:$bp_location3.* | |
149 | \[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_while_conditional at .*$srcfile:$bp_location4" \ | |
c906108c SS |
150 | "breakpoint info" |
151 | ||
c906108c SS |
152 | # FIXME: The rest of this test doesn't work with anything that can't |
153 | # handle arguments. | |
154 | # Huh? There doesn't *appear* to be anything that passes arguments | |
155 | # below. | |
156 | if [istarget "mips-idt-*"] then { | |
157 | return | |
158 | } | |
159 | ||
160 | # | |
161 | # run until the breakpoint at main is hit. For non-stubs-using targets. | |
162 | # | |
b741e217 DJ |
163 | gdb_run_cmd |
164 | gdb_expect { | |
165 | -re "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $" { | |
166 | pass "run until function breakpoint" | |
c906108c | 167 | } |
b741e217 DJ |
168 | -re "$gdb_prompt $" { |
169 | fail "run until function breakpoint" | |
170 | } | |
171 | timeout { | |
172 | fail "run until function breakpoint (timeout)" | |
c906108c SS |
173 | } |
174 | } | |
175 | ||
176 | # | |
177 | # run until the breakpoint at a line number | |
178 | # | |
a50d3602 | 179 | gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location1.*$bp_location1\[\t \]+printf.*factorial.*" \ |
c906108c SS |
180 | "run until breakpoint set at a line number" |
181 | ||
182 | # | |
183 | # Run until the breakpoint set in a function in a file | |
184 | # | |
185 | for {set i 6} {$i >= 1} {incr i -1} { | |
a50d3602 | 186 | gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, factorial \\(value=$i\\) at .*$srcfile:$bp_location7.*$bp_location7\[\t \]+.*if .value > 1. \{.*" \ |
c906108c SS |
187 | "run until file:function($i) breakpoint" |
188 | } | |
189 | ||
df763c7f DJ |
190 | # |
191 | # Run until the breakpoint set at a quoted function | |
192 | # | |
a1dea79a | 193 | gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, (0x\[0-9a-f\]+ in )?marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*" \ |
df763c7f | 194 | "run until quoted breakpoint" |
c906108c SS |
195 | # |
196 | # run until the file:function breakpoint at a line number in a file | |
197 | # | |
a50d3602 | 198 | gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location2.*$bp_location2\[\t \]+argc = \\(argc == 12345\\);.*" \ |
c906108c SS |
199 | "run until file:linenum breakpoint" |
200 | ||
2acceee2 | 201 | # Test break at offset +1 |
a50d3602 | 202 | set bp_location10 [gdb_get_line_number "set breakpoint 10 here"] |
2acceee2 JM |
203 | |
204 | gdb_test "break +1" \ | |
a50d3602 | 205 | "Breakpoint.*at.* file .*$srcfile, line $bp_location10\\." \ |
2acceee2 JM |
206 | "breakpoint offset +1" |
207 | ||
208 | # Check to see if breakpoint is hit when stepped onto | |
209 | ||
210 | gdb_test "step" \ | |
a50d3602 | 211 | ".*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location10.*$bp_location10\[\t \]+return argc;.*breakpoint 10 here.*" \ |
2acceee2 JM |
212 | "step onto breakpoint" |
213 | ||
e1c2defa NS |
214 | # Check to see if breakpoint can be set on ending brace of function |
215 | set bp_location10a [gdb_get_line_number "set breakpoint 10a here"] | |
216 | ||
217 | gdb_test "break $bp_location10a" \ | |
218 | "Breakpoint.*at.* file .*$srcfile, line $bp_location10a\\." \ | |
219 | "setting breakpoint at }" | |
220 | ||
221 | gdb_test "continue" \ | |
222 | ".*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:$bp_location10a.*$bp_location10a\[\t \]+}.*breakpoint 10a here.*" \ | |
223 | "continue to breakpoint at }" | |
224 | ||
c906108c SS |
225 | # |
226 | # delete all breakpoints so we can start over, course this can be a test too | |
227 | # | |
228 | delete_breakpoints | |
229 | ||
230 | # | |
231 | # test temporary breakpoint at function | |
232 | # | |
233 | ||
18ac113b | 234 | gdb_test "tbreak main" "Temporary breakpoint.*at.* file .*$srcfile, line.*" "Temporary breakpoint function" |
c906108c SS |
235 | |
236 | # | |
237 | # test break at function in file | |
238 | # | |
239 | ||
18ac113b | 240 | gdb_test "tbreak $srcfile:factorial" "Temporary breakpoint.*at.* file .*$srcfile, line.*" \ |
c906108c SS |
241 | "Temporary breakpoint function in file" |
242 | ||
243 | # | |
244 | # test break at line number | |
245 | # | |
a50d3602 | 246 | send_gdb "tbreak $bp_location1\n" |
c906108c | 247 | gdb_expect { |
18ac113b | 248 | -re "Temporary breakpoint.*at.* file .*$srcfile, line $bp_location1.*$gdb_prompt $" { |
55b411d9 MR |
249 | pass "Temporary breakpoint line number #1" |
250 | } | |
251 | -re ".*$gdb_prompt $" { | |
252 | fail "Temporary breakpoint line number #1" | |
253 | } | |
254 | timeout { | |
255 | fail "Temporary breakpoint line number #1 (timeout)" | |
256 | } | |
c906108c SS |
257 | } |
258 | ||
18ac113b | 259 | gdb_test "tbreak $bp_location6" "Temporary breakpoint.*at.* file .*$srcfile, line $bp_location6.*" "Temporary breakpoint line number #2" |
c906108c SS |
260 | |
261 | # | |
262 | # test break at line number in file | |
263 | # | |
a50d3602 | 264 | send_gdb "tbreak $srcfile:$bp_location2\n" |
c906108c | 265 | gdb_expect { |
18ac113b | 266 | -re "Temporary breakpoint.*at.* file .*$srcfile, line $bp_location2.*$gdb_prompt $" { |
55b411d9 MR |
267 | pass "Temporary breakpoint line number in file #1" |
268 | } | |
269 | -re ".*$gdb_prompt $" { | |
270 | fail "Temporary breakpoint line number in file #1" | |
271 | } | |
272 | timeout { | |
273 | fail "Temporary breakpoint line number in file #1 (timeout)" | |
274 | } | |
c906108c SS |
275 | } |
276 | ||
a50d3602 | 277 | set bp_location11 [gdb_get_line_number "set breakpoint 11 here"] |
18ac113b | 278 | gdb_test "tbreak $srcfile:$bp_location11" "Temporary breakpoint.*at.* file .*$srcfile, line $bp_location11.*" "Temporary breakpoint line number in file #2" |
c906108c SS |
279 | |
280 | # | |
281 | # check to see what breakpoints are set (temporary this time) | |
282 | # | |
54e52265 | 283 | gdb_test "info break" "Num Type.*Disp Enb Address.*What.*\[\r\n\] |
085dd6e6 | 284 | \[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$main_line.*\[\r\n\] |
a50d3602 EZ |
285 | \[0-9\]+\[\t \]+breakpoint del.*y.*in factorial$proto at .*$srcfile:$bp_location7.*\[\r\n\] |
286 | \[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location1.*\[\r\n\] | |
287 | \[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location6.*\[\r\n\] | |
288 | \[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location2.*\[\r\n\] | |
289 | \[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location11.*" \ | |
085dd6e6 | 290 | "Temporary breakpoint info" |
c906108c SS |
291 | |
292 | ||
293 | #*********** | |
294 | ||
295 | # Verify that catchpoints for fork, vfork and exec don't trigger | |
296 | # inappropriately. (There are no calls to those system functions | |
297 | # in this test program.) | |
298 | # | |
299 | if ![runto_main] then { fail "break tests suppressed" } | |
300 | ||
301 | send_gdb "catch\n" | |
302 | gdb_expect { | |
303 | -re "Catch requires an event name.*$gdb_prompt $"\ | |
304 | {pass "catch requires an event name"} | |
305 | -re "$gdb_prompt $"\ | |
306 | {fail "catch requires an event name"} | |
307 | timeout {fail "(timeout) catch requires an event name"} | |
308 | } | |
309 | ||
310 | ||
311 | set name "set catch fork, never expected to trigger" | |
312 | send_gdb "catch fork\n" | |
313 | gdb_expect { | |
314 | -re "Catchpoint \[0-9\]* .fork..*$gdb_prompt $" | |
315 | {pass $name} | |
316 | -re "Catch of fork not yet implemented.*$gdb_prompt $" | |
317 | {pass $name} | |
318 | -re "$gdb_prompt $" | |
319 | {fail $name} | |
320 | timeout {fail "(timeout) $name"} | |
321 | } | |
322 | ||
323 | ||
324 | set name "set catch vfork, never expected to trigger" | |
325 | send_gdb "catch vfork\n" | |
326 | ||
327 | # If we are on HP-UX 10.20, we expect an error message to be | |
328 | # printed if we type "catch vfork" at the gdb gdb_prompt. This is | |
329 | # because on HP-UX 10.20, we cannot catch vfork events. | |
330 | ||
331 | if [istarget "hppa*-hp-hpux10.20"] then { | |
332 | gdb_expect { | |
333 | -re "Catch of vfork events not supported on HP-UX 10.20..*$gdb_prompt $" | |
334 | {pass $name} | |
335 | -re "$gdb_prompt $" | |
336 | {fail $name} | |
337 | timeout {fail "(timeout) $name"} | |
338 | } | |
339 | } else { | |
340 | gdb_expect { | |
341 | -re "Catchpoint \[0-9\]* .vfork..*$gdb_prompt $" | |
342 | {pass $name} | |
343 | -re "Catch of vfork not yet implemented.*$gdb_prompt $" | |
344 | {pass $name} | |
345 | -re "$gdb_prompt $" | |
346 | {fail $name} | |
347 | timeout {fail "(timeout) $name"} | |
348 | } | |
349 | } | |
350 | ||
351 | set name "set catch exec, never expected to trigger" | |
352 | send_gdb "catch exec\n" | |
353 | gdb_expect { | |
354 | -re "Catchpoint \[0-9\]* .exec..*$gdb_prompt $" | |
355 | {pass $name} | |
356 | -re "Catch of exec not yet implemented.*$gdb_prompt $" | |
357 | {pass $name} | |
358 | -re "$gdb_prompt $" {fail $name} | |
359 | timeout {fail "(timeout) $name"} | |
360 | } | |
361 | ||
c906108c SS |
362 | # Verify that GDB responds gracefully when asked to set a breakpoint |
363 | # on a nonexistent source line. | |
364 | # | |
365 | send_gdb "break 999\n" | |
366 | gdb_expect { | |
367 | -re "No line 999 in file .*$gdb_prompt $"\ | |
368 | {pass "break on non-existent source line"} | |
369 | -re "$gdb_prompt $"\ | |
370 | {fail "break on non-existent source line"} | |
371 | timeout {fail "(timeout) break on non-existent source line"} | |
372 | } | |
373 | ||
0fbc361c EZ |
374 | # Run to the desired default location. If not positioned here, the |
375 | # tests below don't work. | |
376 | # | |
a1dea79a | 377 | gdb_test "until $bp_location1" "main .* at .*:$bp_location1.*" "until bp_location1" |
0fbc361c EZ |
378 | |
379 | ||
c906108c SS |
380 | # Verify that GDB allows one to just say "break", which is treated |
381 | # as the "default" breakpoint. Note that GDB gets cute when printing | |
382 | # the informational message about other breakpoints at the same | |
383 | # location. We'll hit that bird with this stone too. | |
384 | # | |
385 | send_gdb "break\n" | |
386 | gdb_expect { | |
387 | -re "Breakpoint \[0-9\]*.*$gdb_prompt $"\ | |
388 | {pass "break on default location, 1st time"} | |
389 | -re "$gdb_prompt $"\ | |
390 | {fail "break on default location, 1st time"} | |
391 | timeout {fail "(timeout) break on default location, 1st time"} | |
392 | } | |
393 | ||
394 | send_gdb "break\n" | |
395 | gdb_expect { | |
396 | -re "Note: breakpoint \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\ | |
397 | {pass "break on default location, 2nd time"} | |
398 | -re "$gdb_prompt $"\ | |
399 | {fail "break on default location, 2nd time"} | |
400 | timeout {fail "(timeout) break on default location, 2nd time"} | |
401 | } | |
402 | ||
403 | send_gdb "break\n" | |
404 | gdb_expect { | |
405 | -re "Note: breakpoints \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\ | |
406 | {pass "break on default location, 3rd time"} | |
407 | -re "$gdb_prompt $"\ | |
408 | {fail "break on default location, 3rd time"} | |
409 | timeout {fail "(timeout) break on default location, 3rd time"} | |
410 | } | |
411 | ||
412 | send_gdb "break\n" | |
413 | gdb_expect { | |
414 | -re "Note: breakpoints \[0-9\]*, \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\ | |
415 | {pass "break on default location, 4th time"} | |
416 | -re "$gdb_prompt $"\ | |
417 | {fail "break on default location, 4th time"} | |
418 | timeout {fail "(timeout) break on default location, 4th time"} | |
419 | } | |
420 | ||
421 | # Verify that a "silent" breakpoint can be set, and that GDB is indeed | |
422 | # "silent" about its triggering. | |
423 | # | |
424 | if ![runto_main] then { fail "break tests suppressed" } | |
425 | ||
a50d3602 | 426 | send_gdb "break $bp_location1\n" |
c906108c | 427 | gdb_expect { |
a50d3602 | 428 | -re "Breakpoint (\[0-9\]*) at .*, line $bp_location1.*$gdb_prompt $"\ |
a1dea79a | 429 | {pass "set to-be-silent break bp_location1"} |
c906108c | 430 | -re "$gdb_prompt $"\ |
a1dea79a FF |
431 | {fail "set to-be-silent break bp_location1"} |
432 | timeout {fail "(timeout) set to-be-silent break bp_location1"} | |
c906108c SS |
433 | } |
434 | ||
435 | send_gdb "commands $expect_out(1,string)\n" | |
436 | send_gdb "silent\n" | |
437 | send_gdb "end\n" | |
438 | gdb_expect { | |
439 | -re ".*$gdb_prompt $"\ | |
a1dea79a FF |
440 | {pass "set silent break bp_location1"} |
441 | timeout {fail "(timeout) set silent break bp_location1"} | |
c906108c SS |
442 | } |
443 | ||
444 | send_gdb "info break $expect_out(1,string)\n" | |
445 | gdb_expect { | |
a50d3602 | 446 | -re "\[0-9\]*\[ \t\]*breakpoint.*:$bp_location1\r\n\[ \t\]*silent.*$gdb_prompt $"\ |
a1dea79a | 447 | {pass "info silent break bp_location1"} |
c906108c | 448 | -re "$gdb_prompt $"\ |
a1dea79a FF |
449 | {fail "info silent break bp_location1"} |
450 | timeout {fail "(timeout) info silent break bp_location1"} | |
c906108c SS |
451 | } |
452 | send_gdb "continue\n" | |
453 | gdb_expect { | |
454 | -re "Continuing.\r\n$gdb_prompt $"\ | |
a1dea79a | 455 | {pass "hit silent break bp_location1"} |
c906108c | 456 | -re "$gdb_prompt $"\ |
a1dea79a FF |
457 | {fail "hit silent break bp_location1"} |
458 | timeout {fail "(timeout) hit silent break bp_location1"} | |
c906108c SS |
459 | } |
460 | send_gdb "bt\n" | |
461 | gdb_expect { | |
a50d3602 | 462 | -re "#0 main .* at .*:$bp_location1.*$gdb_prompt $"\ |
a1dea79a | 463 | {pass "stopped for silent break bp_location1"} |
c906108c | 464 | -re "$gdb_prompt $"\ |
a1dea79a FF |
465 | {fail "stopped for silent break bp_location1"} |
466 | timeout {fail "(timeout) stopped for silent break bp_location1"} | |
c906108c SS |
467 | } |
468 | ||
469 | # Verify that GDB can at least parse a breakpoint with the | |
470 | # "thread" keyword. (We won't attempt to test here that a | |
471 | # thread-specific breakpoint really triggers appropriately. | |
472 | # The gdb.threads subdirectory contains tests for that.) | |
473 | # | |
a50d3602 EZ |
474 | set bp_location12 [gdb_get_line_number "set breakpoint 12 here"] |
475 | send_gdb "break $bp_location12 thread 999\n" | |
c906108c SS |
476 | gdb_expect { |
477 | -re "Unknown thread 999.*$gdb_prompt $"\ | |
478 | {pass "thread-specific breakpoint on non-existent thread disallowed"} | |
479 | -re "$gdb_prompt $"\ | |
480 | {fail "thread-specific breakpoint on non-existent thread disallowed"} | |
481 | timeout {fail "(timeout) thread-specific breakpoint on non-existent thread disallowed"} | |
482 | } | |
a50d3602 | 483 | send_gdb "break $bp_location12 thread foo\n" |
c906108c SS |
484 | gdb_expect { |
485 | -re "Junk after thread keyword..*$gdb_prompt $"\ | |
486 | {pass "thread-specific breakpoint on bogus thread ID disallowed"} | |
487 | -re "$gdb_prompt $"\ | |
488 | {fail "thread-specific breakpoint on bogus thread ID disallowed"} | |
489 | timeout {fail "(timeout) thread-specific breakpoint on bogus thread ID disallowed"} | |
490 | } | |
491 | ||
492 | # Verify that GDB responds gracefully to a breakpoint command with | |
493 | # trailing garbage. | |
494 | # | |
a50d3602 | 495 | send_gdb "break $bp_location12 foo\n" |
c906108c SS |
496 | gdb_expect { |
497 | -re "Junk at end of arguments..*$gdb_prompt $"\ | |
498 | {pass "breakpoint with trailing garbage disallowed"} | |
499 | -re "$gdb_prompt $"\ | |
500 | {fail "breakpoint with trailing garbage disallowed"} | |
501 | timeout {fail "(timeout) breakpoint with trailing garbage disallowed"} | |
502 | } | |
503 | ||
504 | # Verify that GDB responds gracefully to a "clear" command that has | |
505 | # no matching breakpoint. (First, get us off the current source line, | |
506 | # which we know has a breakpoint.) | |
507 | # | |
508 | send_gdb "next\n" | |
509 | gdb_expect { | |
510 | -re ".*$gdb_prompt $"\ | |
511 | {pass "step over breakpoint"} | |
512 | timeout {fail "(timeout) step over breakpoint"} | |
513 | } | |
085dd6e6 | 514 | send_gdb "clear 81\n" |
c906108c | 515 | gdb_expect { |
085dd6e6 | 516 | -re "No breakpoint at 81..*$gdb_prompt $"\ |
c906108c SS |
517 | {pass "clear line has no breakpoint disallowed"} |
518 | -re "$gdb_prompt $"\ | |
519 | {fail "clear line has no breakpoint disallowed"} | |
520 | timeout {fail "(timeout) clear line has no breakpoint disallowed"} | |
521 | } | |
522 | send_gdb "clear\n" | |
523 | gdb_expect { | |
524 | -re "No breakpoint at this line..*$gdb_prompt $"\ | |
525 | {pass "clear current line has no breakpoint disallowed"} | |
526 | -re "$gdb_prompt $"\ | |
527 | {fail "clear current line has no breakpoint disallowed"} | |
528 | timeout {fail "(timeout) clear current line has no breakpoint disallowed"} | |
529 | } | |
530 | ||
4a7bddb6 MC |
531 | # Verify that we can set and clear multiple breakpoints. |
532 | # | |
533 | # We don't test that it deletes the correct breakpoints. We do at | |
534 | # least test that it deletes more than one breakpoint. | |
535 | # | |
536 | gdb_test "break marker3" "Breakpoint.*at.*" "break marker3 #1" | |
537 | gdb_test "break marker3" "Breakpoint.*at.*" "break marker3 #2" | |
538 | gdb_test "clear marker3" {Deleted breakpoints [0-9]+ [0-9]+.*} | |
539 | ||
c906108c SS |
540 | # Verify that a breakpoint can be set via a convenience variable. |
541 | # | |
a50d3602 | 542 | send_gdb "set \$foo=$bp_location11\n" |
c906108c SS |
543 | gdb_expect { |
544 | -re "$gdb_prompt $"\ | |
a1dea79a FF |
545 | {pass "set convenience variable \$foo to bp_location11"} |
546 | timeout {fail "(timeout) set convenience variable \$foo to bp_location11"} | |
c906108c SS |
547 | } |
548 | send_gdb "break \$foo\n" | |
549 | gdb_expect { | |
a50d3602 | 550 | -re "Breakpoint (\[0-9\]*) at .*, line $bp_location11.*$gdb_prompt $"\ |
c906108c SS |
551 | {pass "set breakpoint via convenience variable"} |
552 | -re "$gdb_prompt $"\ | |
553 | {fail "set breakpoint via convenience variable"} | |
554 | timeout {fail "(timeout) set breakpoint via convenience variable"} | |
555 | } | |
556 | ||
557 | # Verify that GDB responds gracefully to an attempt to set a | |
558 | # breakpoint via a convenience variable whose type is not integer. | |
559 | # | |
085dd6e6 | 560 | send_gdb "set \$foo=81.5\n" |
c906108c SS |
561 | gdb_expect { |
562 | -re "$gdb_prompt $"\ | |
085dd6e6 JM |
563 | {pass "set convenience variable \$foo to 81.5"} |
564 | timeout {fail "(timeout) set convenience variable \$foo to 81.5"} | |
c906108c SS |
565 | } |
566 | send_gdb "break \$foo\n" | |
567 | gdb_expect { | |
568 | -re "Convenience variables used in line specs must have integer values..*$gdb_prompt $"\ | |
569 | {pass "set breakpoint via non-integer convenience variable disallowed"} | |
570 | -re "$gdb_prompt $"\ | |
571 | {fail "set breakpoint via non-integer convenience variable disallowed"} | |
572 | timeout {fail "(timeout) set breakpoint via non-integer convenience variable disallowed"} | |
573 | } | |
574 | ||
575 | # Verify that we can set and trigger a breakpoint in a user-called function. | |
576 | # | |
577 | send_gdb "break marker2\n" | |
578 | gdb_expect { | |
a50d3602 | 579 | -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location8|$bp_location9).*$gdb_prompt $"\ |
c906108c SS |
580 | {pass "set breakpoint on to-be-called function"} |
581 | -re "$gdb_prompt $"\ | |
582 | {fail "set breakpoint on to-be-called function"} | |
583 | timeout {fail "(timeout) set breakpoint on to-be-called function"} | |
584 | } | |
585 | send_gdb "print marker2(99)\n" | |
586 | gdb_expect { | |
b89667eb | 587 | -re "The program being debugged stopped while in a function called from GDB.\r\nEvaluation of the expression containing the function\r\n.marker2$proto. will be abandoned.\r\nWhen the function is done executing, GDB will silently stop..*$gdb_prompt $"\ |
c906108c SS |
588 | {pass "hit breakpoint on called function"} |
589 | -re "$gdb_prompt $"\ | |
590 | {fail "hit breakpoint on called function"} | |
591 | timeout {fail "(timeout) hit breakpoint on called function"} | |
592 | } | |
593 | ||
594 | # As long as we're stopped (breakpointed) in a called function, | |
595 | # verify that we can successfully backtrace & such from here. | |
596 | # | |
30e87cd3 ND |
597 | # In this and the following test, the _sr4export check apparently is needed |
598 | # for hppa*-*-hpux. | |
599 | # | |
600 | send_gdb "bt\n" | |
601 | gdb_expect { | |
a50d3602 | 602 | -re "#0\[ \t\]*($hex in )?marker2.*:($bp_location8|$bp_location9)\r\n#1.*_sr4export.*$gdb_prompt $"\ |
c906108c | 603 | {pass "backtrace while in called function"} |
a50d3602 | 604 | -re "#0\[ \t\]*($hex in )?marker2.*:($bp_location8|$bp_location9)\r\n#1.*function called from gdb.*$gdb_prompt $"\ |
30e87cd3 | 605 | {pass "backtrace while in called function"} |
c906108c SS |
606 | -re "$gdb_prompt $"\ |
607 | {fail "backtrace while in called function"} | |
608 | timeout {fail "(timeout) backtrace while in called function"} | |
30e87cd3 ND |
609 | } |
610 | ||
611 | # Return from the called function. For remote targets, it's important to do | |
612 | # this before runto_main, which otherwise may silently stop on the dummy | |
613 | # breakpoint inserted by GDB at the program's entry point. | |
614 | # | |
615 | send_gdb "finish\n" | |
616 | gdb_expect { | |
a50d3602 | 617 | -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.* in _sr4export.*$gdb_prompt $"\ |
085dd6e6 | 618 | {pass "finish from called function"} |
a50d3602 | 619 | -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.*function called from gdb.*$gdb_prompt $"\ |
c906108c | 620 | {pass "finish from called function"} |
a50d3602 | 621 | -re "Run till exit from .*marker2.* at .*($bp_location8|$bp_location9)\r\n.*Value returned.*$gdb_prompt $"\ |
104c1213 | 622 | {pass "finish from called function"} |
c906108c SS |
623 | -re "$gdb_prompt $"\ |
624 | {fail "finish from called function"} | |
625 | timeout {fail "(timeout) finish from called function"} | |
c906108c SS |
626 | } |
627 | ||
628 | # Verify that GDB responds gracefully to a "finish" command with | |
629 | # arguments. | |
630 | # | |
631 | if ![runto_main] then { fail "break tests suppressed" } | |
632 | ||
633 | send_gdb "finish 123\n" | |
634 | gdb_expect { | |
635 | -re "The \"finish\" command does not take any arguments.\r\n$gdb_prompt $"\ | |
636 | {pass "finish with arguments disallowed"} | |
637 | -re "$gdb_prompt $"\ | |
638 | {fail "finish with arguments disallowed"} | |
639 | timeout {fail "(timeout) finish with arguments disallowed"} | |
640 | } | |
641 | ||
642 | # Verify that GDB responds gracefully to a request to "finish" from | |
7a292a7a SS |
643 | # the outermost frame. On a stub that never exits, this will just |
644 | # run to the stubs routine, so we don't get this error... Thus the | |
645 | # second condition. | |
c906108c | 646 | # |
7a292a7a | 647 | |
c906108c SS |
648 | send_gdb "finish\n" |
649 | gdb_expect { | |
650 | -re "\"finish\" not meaningful in the outermost frame.\r\n$gdb_prompt $"\ | |
651 | {pass "finish from outermost frame disallowed"} | |
c4093a6a | 652 | -re "Run till exit from.*\r\n$gdb_prompt $" { |
7a292a7a SS |
653 | pass "finish from outermost frame disallowed" |
654 | } | |
c906108c SS |
655 | -re "$gdb_prompt $"\ |
656 | {fail "finish from outermost frame disallowed"} | |
657 | timeout {fail "(timeout) finish from outermost frame disallowed"} | |
658 | } | |
659 | ||
660 | # Verify that we can explicitly ask GDB to stop on all shared library | |
661 | # events, and that it does so. | |
662 | # | |
663 | if [istarget "hppa*-*-hpux*"] then { | |
664 | if ![runto_main] then { fail "break tests suppressed" } | |
665 | ||
666 | send_gdb "set stop-on-solib-events 1\n" | |
667 | gdb_expect { | |
668 | -re "$gdb_prompt $"\ | |
669 | {pass "set stop-on-solib-events"} | |
670 | timeout {fail "(timeout) set stop-on-solib-events"} | |
671 | } | |
672 | ||
673 | send_gdb "run\n" | |
674 | gdb_expect { | |
675 | -re ".*Start it from the beginning.*y or n. $"\ | |
676 | {send_gdb "y\n" | |
677 | gdb_expect { | |
678 | -re ".*Stopped due to shared library event.*$gdb_prompt $"\ | |
679 | {pass "triggered stop-on-solib-events"} | |
680 | -re "$gdb_prompt $"\ | |
681 | {fail "triggered stop-on-solib-events"} | |
682 | timeout {fail "(timeout) triggered stop-on-solib-events"} | |
683 | } | |
684 | } | |
685 | -re "$gdb_prompt $"\ | |
686 | {fail "rerun for stop-on-solib-events"} | |
687 | timeout {fail "(timeout) rerun for stop-on-solib-events"} | |
688 | } | |
689 | ||
690 | send_gdb "set stop-on-solib-events 0\n" | |
691 | gdb_expect { | |
692 | -re "$gdb_prompt $"\ | |
693 | {pass "reset stop-on-solib-events"} | |
694 | timeout {fail "(timeout) reset stop-on-solib-events"} | |
695 | } | |
696 | } | |
697 | ||
698 | # Hardware breakpoints are unsupported on HP-UX. Verify that GDB | |
699 | # gracefully responds to requests to create them. | |
700 | # | |
701 | if [istarget "hppa*-*-hpux*"] then { | |
702 | if ![runto_main] then { fail "break tests suppressed" } | |
703 | ||
704 | send_gdb "hbreak\n" | |
705 | gdb_expect { | |
706 | -re "No hardware breakpoint support in the target.*$gdb_prompt $"\ | |
707 | {pass "hw breaks disallowed"} | |
708 | -re "$gdb_prompt $"\ | |
709 | {fail "hw breaks disallowed"} | |
710 | timeout {fail "(timeout) hw breaks disallowed"} | |
711 | } | |
712 | ||
713 | send_gdb "thbreak\n" | |
714 | gdb_expect { | |
715 | -re "No hardware breakpoint support in the target.*$gdb_prompt $"\ | |
716 | {pass "temporary hw breaks disallowed"} | |
717 | -re "$gdb_prompt $"\ | |
718 | {fail "temporary hw breaks disallowed"} | |
719 | timeout {fail "(timeout) temporary hw breaks disallowed"} | |
720 | } | |
721 | } | |
722 | ||
723 | #******** | |
724 | ||
725 | ||
c906108c SS |
726 | # |
727 | # Test "next" over recursive function call. | |
728 | # | |
729 | ||
730 | proc test_next_with_recursion {} { | |
731 | global gdb_prompt | |
732 | global decimal | |
733 | global binfile | |
734 | ||
b741e217 DJ |
735 | gdb_test "kill" "" "kill program" "Kill the program being debugged.*y or n. $" "y" |
736 | delete_breakpoints | |
c906108c SS |
737 | |
738 | gdb_test "break factorial" "Breakpoint $decimal at .*" "break at factorial" | |
739 | ||
740 | # Run until we call factorial with 6 | |
741 | ||
b741e217 | 742 | gdb_run_cmd |
c906108c SS |
743 | gdb_expect { |
744 | -re "Break.* factorial .value=6. .*$gdb_prompt $" {} | |
745 | -re ".*$gdb_prompt $" { | |
746 | fail "run to factorial(6)"; | |
747 | gdb_suppress_tests; | |
748 | } | |
749 | timeout { fail "run to factorial(6) (timeout)" ; gdb_suppress_tests } | |
750 | } | |
751 | ||
752 | # Continue until we call factorial recursively with 5. | |
753 | ||
754 | if [gdb_test "continue" \ | |
755 | "Continuing.*Break.* factorial .value=5. .*" \ | |
756 | "continue to factorial(5)"] then { gdb_suppress_tests } | |
757 | ||
758 | # Do a backtrace just to confirm how many levels deep we are. | |
759 | ||
760 | if [gdb_test "backtrace" \ | |
761 | "#0\[ \t\]+ factorial .value=5..*" \ | |
762 | "backtrace from factorial(5)"] then { gdb_suppress_tests } | |
763 | ||
764 | # Now a "next" should position us at the recursive call, which | |
765 | # we will be performing with 4. | |
766 | ||
767 | if [gdb_test "next" \ | |
768 | ".* factorial .value - 1.;.*" \ | |
769 | "next to recursive call"] then { gdb_suppress_tests } | |
770 | ||
771 | # Disable the breakpoint at the entry to factorial by deleting them all. | |
772 | # The "next" should run until we return to the next line from this | |
773 | # recursive call to factorial with 4. | |
774 | # Buggy versions of gdb will stop instead at the innermost frame on | |
775 | # the line where we are trying to "next" to. | |
776 | ||
777 | delete_breakpoints | |
778 | ||
779 | if [istarget "mips*tx39-*"] { | |
780 | set timeout 60 | |
c906108c | 781 | } |
7a345fb3 JB |
782 | # We used to set timeout here for all other targets as well. This |
783 | # is almost certainly wrong. The proper timeout depends on the | |
784 | # target system in use, and how we communicate with it, so there | |
785 | # is no single value appropriate for all targets. The timeout | |
786 | # should be established by the Dejagnu config file(s) for the | |
787 | # board, and respected by the test suite. | |
788 | # | |
789 | # For example, if I'm running GDB over an SSH tunnel talking to a | |
790 | # portmaster in California talking to an ancient 68k board running | |
791 | # a crummy ROM monitor (a situation I can only wish were | |
792 | # hypothetical), then I need a large timeout. But that's not the | |
793 | # kind of knowledge that belongs in this file. | |
c906108c SS |
794 | |
795 | gdb_test next "\[0-9\]*\[\t \]+return \\(value\\);.*" \ | |
796 | "next over recursive call" | |
797 | ||
798 | # OK, we should be back in the same stack frame we started from. | |
799 | # Do a backtrace just to confirm. | |
800 | ||
801 | set result [gdb_test "backtrace" \ | |
802 | "#0\[ \t\]+ factorial .value=120.*\r\n#1\[ \t\]+ \[0-9a-fx\]+ in factorial .value=6..*" \ | |
803 | "backtrace from factorial(5.1)"] | |
804 | if { $result != 0 } { gdb_suppress_tests } | |
805 | ||
806 | if [target_info exists gdb,noresults] { gdb_suppress_tests } | |
7a292a7a SS |
807 | gdb_continue_to_end "recursive next test" |
808 | gdb_stop_suppressing_tests; | |
c906108c SS |
809 | } |
810 | ||
c906108c SS |
811 | test_next_with_recursion |
812 | ||
c1790a9d JL |
813 | |
814 | #******** | |
815 | ||
816 | # build a new file with optimization enabled so that we can try breakpoints | |
817 | # on targets with optimized prologues | |
818 | ||
dbc52822 | 819 | if { [prepare_for_testing break.exp "breako2" {break.c break1.c} {debug nowarnings optimize=-O2}] } { |
c1790a9d JL |
820 | return -1 |
821 | } | |
822 | ||
c1790a9d JL |
823 | # |
824 | # test break at function | |
825 | # | |
826 | gdb_test "break main" \ | |
954de43b | 827 | "Breakpoint.*at.* file .*, line.*" \ |
c1790a9d JL |
828 | "breakpoint function, optimized file" |
829 | ||
830 | # | |
831 | # test break at function | |
832 | # | |
833 | gdb_test "break marker4" \ | |
a1dea79a | 834 | "Breakpoint.*at.* file .*$srcfile1, line.*" \ |
c1790a9d JL |
835 | "breakpoint small function, optimized file" |
836 | ||
837 | # | |
838 | # run until the breakpoint at main is hit. For non-stubs-using targets. | |
839 | # | |
b741e217 DJ |
840 | gdb_run_cmd |
841 | gdb_expect { | |
842 | -re "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $" { | |
843 | pass "run until function breakpoint, optimized file" | |
c1790a9d | 844 | } |
b741e217 DJ |
845 | -re "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$gdb_prompt $" { |
846 | pass "run until function breakpoint, optimized file (code motion)" | |
847 | } | |
848 | -re "$gdb_prompt $" { | |
849 | fail "run until function breakpoint, optimized file" | |
850 | } | |
851 | timeout { | |
852 | fail "run until function breakpoint, optimized file (timeout)" | |
c1790a9d JL |
853 | } |
854 | } | |
855 | ||
856 | # | |
857 | # run until the breakpoint at a small function | |
858 | # | |
1a570b2f MS |
859 | |
860 | # | |
861 | # Add a second pass pattern. The behavior differs here between stabs | |
862 | # and dwarf for one-line functions. Stabs preserves two line symbols | |
863 | # (one before the prologue and one after) with the same line number, | |
864 | # but dwarf regards these as duplicates and discards one of them. | |
865 | # Therefore the address after the prologue (where the breakpoint is) | |
866 | # has no exactly matching line symbol, and GDB reports the breakpoint | |
867 | # as if it were in the middle of a line rather than at the beginning. | |
868 | ||
a1dea79a FF |
869 | set bp_location13 [gdb_get_line_number "set breakpoint 13 here" $srcfile1] |
870 | set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile1] | |
1a570b2f MS |
871 | send_gdb "continue\n" |
872 | gdb_expect { | |
a1dea79a | 873 | -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile1:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*" { |
1a570b2f MS |
874 | pass "run until breakpoint set at small function, optimized file" |
875 | } | |
a1dea79a | 876 | -re "Breakpoint $decimal, $hex in marker4 \\(d=177601976\\) at .*$srcfile1:$bp_location13\[\r\n\]+$bp_location13\[\t \]+void marker4.*" { |
1a570b2f MS |
877 | pass "run until breakpoint set at small function, optimized file" |
878 | } | |
a1dea79a | 879 | -re "Breakpoint $decimal, marker4 \\(d=177601976\\) at .*$srcfile1:$bp_location14\[\r\n\]+$bp_location14\[\t \]+void marker4.*" { |
f1f02ee4 | 880 | # marker4() is defined at line 46 when compiled with -DPROTOTYPES |
a1dea79a | 881 | pass "run until breakpoint set at small function, optimized file (line bp_location14)" |
f1f02ee4 | 882 | } |
1a570b2f MS |
883 | -re ".*$gdb_prompt " { |
884 | fail "run until breakpoint set at small function, optimized file" | |
885 | } | |
886 | timeout { | |
887 | fail "run until breakpoint set at small function, optimized file (timeout)" | |
888 | } | |
889 | } | |
c1790a9d | 890 | |
dbc52822 | 891 | clean_restart breako2 |
6214f497 DJ |
892 | |
893 | # | |
894 | # test that 'rbreak' on a symbol that may be from a shared library doesn't | |
895 | # cause a "Junk at end of arguments." error. | |
896 | # | |
897 | # On x86 GNU/Linux, this test will choke on e.g. __libc_start_main@plt. | |
898 | # | |
899 | # Note that this test won't necessarily choke on all targets even if | |
900 | # all the rbreak issue is present. rbreak needs to match and set a | |
901 | # breakpoint on a symbol causes 'break' to choke. | |
902 | # | |
903 | ||
904 | gdb_test "set breakpoint pending on" "" "rbreak junk pending setup" | |
905 | ||
906 | # We expect at least one breakpoint to be set when we "rbreak main". | |
907 | gdb_test "rbreak main" \ | |
908 | ".*Breakpoint.*at.* file .*$srcfile, line.*" \ | |
909 | "rbreak junk set breakpoint" | |
910 | ||
911 | # Run to a breakpoint. Fail if we see "Junk at end of arguments". | |
912 | gdb_run_cmd | |
913 | gdb_expect { | |
914 | -re "Junk at end of arguments" { | |
915 | fail "rbreak junk" | |
916 | } | |
917 | -re ".*Breakpoint \[0-9\]+,.*$gdb_prompt $" { | |
918 | pass "rbreak junk" | |
919 | } | |
920 | timeout { | |
921 | fail "rbreak junk (timeout)" | |
922 | } | |
923 | } | |
924 | ||
925 | ||
c906108c SS |
926 | # Reset the default arguments for VxWorks |
927 | if [istarget "*-*-vxworks*"] { | |
928 | set timeout 10 | |
929 | verbose "Timeout is now $timeout seconds" 2 | |
930 | send_gdb "set args main\n" | |
931 | gdb_expect -re ".*$gdb_prompt $" {} | |
932 | } |