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