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