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