OLD | NEW |
1 # Copyright 1999-2012 Free Software Foundation, Inc. | 1 # Copyright 1999-2012 Free Software Foundation, Inc. |
2 | 2 |
3 # This program is free software; you can redistribute it and/or modify | 3 # This program is free software; you can redistribute it and/or modify |
4 # it under the terms of the GNU General Public License as published by | 4 # it under the terms of the GNU General Public License as published by |
5 # the Free Software Foundation; either version 3 of the License, or | 5 # the Free Software Foundation; either version 3 of the License, or |
6 # (at your option) any later version. | 6 # (at your option) any later version. |
7 # | 7 # |
8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
12 # | 12 # |
13 # You should have received a copy of the GNU General Public License | 13 # You should have received a copy of the GNU General Public License |
14 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 | 15 |
16 # This file was written by Elena Zannoni (ezannoni@cygnus.com) | 16 # This file was written by Elena Zannoni (ezannoni@cygnus.com) |
17 | 17 |
18 if $tracelevel then { | |
19 strace $tracelevel | |
20 } | |
21 | |
22 | 18 |
23 # are we on a target board? If so, don't run these tests. | 19 # are we on a target board? If so, don't run these tests. |
24 # note: this is necessary because we cannot use runto_main (which would | 20 # note: this is necessary because we cannot use runto_main (which would |
25 # work for remote targets too) because of the different prompt we get | 21 # work for remote targets too) because of the different prompt we get |
26 # when using annotation level 2. | 22 # when using annotation level 2. |
27 # | 23 # |
28 if [is_remote target] then { | 24 if [is_remote target] then { |
29 return 0 | 25 return 0 |
30 } | 26 } |
31 | 27 |
(...skipping 10 matching lines...) Expand all Loading... |
42 untested annota1.exp | 38 untested annota1.exp |
43 return -1 | 39 return -1 |
44 } | 40 } |
45 | 41 |
46 | 42 |
47 gdb_exit | 43 gdb_exit |
48 gdb_start | 44 gdb_start |
49 gdb_reinitialize_dir $srcdir/$subdir | 45 gdb_reinitialize_dir $srcdir/$subdir |
50 gdb_load ${binfile} | 46 gdb_load ${binfile} |
51 | 47 |
52 if [target_info exists gdb_stub] { | |
53 gdb_step_for_stub; | |
54 } | |
55 | |
56 # | |
57 # the line at which break main will put the breakpoint | |
58 # | |
59 set main_line 32 | |
60 | |
61 # The commands we test here produce many lines of output; disable "press | 48 # The commands we test here produce many lines of output; disable "press |
62 # <return> to continue" prompts. | 49 # <return> to continue" prompts. |
63 gdb_test_no_output "set height 0" | 50 gdb_test_no_output "set height 0" |
64 | 51 |
65 # | 52 # |
66 # break at main | 53 # break at main |
67 # | 54 # |
| 55 |
| 56 set main_line [gdb_get_line_number "break main"] |
| 57 |
68 gdb_test "break main" \ | 58 gdb_test "break main" \ |
69 "Breakpoint.*at.* file .*$srcfile, line.*" \ | 59 "Breakpoint.*at.* file .*$srcfile, line $main_line\\." \ |
70 "breakpoint main" | 60 "breakpoint main" |
71 | 61 |
72 | 62 |
73 # | 63 # |
74 # NOTE: this prompt is OK only when the annotation level is > 1 | 64 # NOTE: this prompt is OK only when the annotation level is > 1 |
75 # NOTE: When this prompt is in use the gdb_test procedure cannot be used because | 65 # NOTE: When this prompt is in use the gdb_test procedure cannot be used because |
76 # it assumes that the last char after the gdb_prompt is a white space. This is n
ot | 66 # it assumes that the last char after the gdb_prompt is a white space. This is n
ot |
77 # true with this annotated prompt. So we must use send_gdb and gdb_expect. | 67 # true with this annotated prompt. So we must use send_gdb and gdb_expect. |
78 # | 68 # |
79 | 69 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 # annotate-frame-source-file-end | 126 # annotate-frame-source-file-end |
137 # annotate-frame-source-line | 127 # annotate-frame-source-line |
138 # annotate-frame-source-end | 128 # annotate-frame-source-end |
139 # annotate-source | 129 # annotate-source |
140 # annotate-frame-end | 130 # annotate-frame-end |
141 # annotate-stopped | 131 # annotate-stopped |
142 # | 132 # |
143 #exp_internal 1 | 133 #exp_internal 1 |
144 set binexp [string_to_regexp $binfile] | 134 set binexp [string_to_regexp $binfile] |
145 gdb_test_multiple "run" "run until main breakpoint" { | 135 gdb_test_multiple "run" "run until main breakpoint" { |
146 -re "\r\n\032\032post-prompt\r\nStarting program: $binexp \(\(\r\n\r\n\032\0
32frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)+\r\n\r\n\032\032sta
rting\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\
)\)*\r\n\r\n\032\032breakpoint 1\r\n\r\nBreakpoint 1, \r\n\032\032frame-begin 0
$hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)
\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*annota1
.c\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$main_l
ine\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*$srcfile:$main_line:.
*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped.*$gdb_prompt$" { | 136 -re "\r\n\032\032post-prompt\r\nStarting program: $binexp \(\r\nwarning: Ski
pping \[^\r\n\]+ .gdb_index section in \[^\r\n\]+\r\nDo \"set use-deprecated-ind
ex-sections on\" before the file is read\r\nto use the section anyway\\.\)?\(\(\
r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r
\n\032\032starting\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpo
ints-invalid\)\)*\r\n\r\n\032\032breakpoint 1\r\n\r\nBreakpoint 1, \r\n\032\032f
rame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-ar
gs\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file
\r\n.*annota1.c\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-li
ne\r\n$main_line\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*$srcfile
:$main_line:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped.*$gdb_pr
ompt$" { |
147 pass "run until main breakpoint" | 137 pass "run until main breakpoint" |
148 } | 138 } |
149 } | 139 } |
150 #exp_internal 0 | 140 #exp_internal 0 |
151 #exit 0 | 141 #exit 0 |
152 | 142 |
153 # | 143 # |
154 # Let's do a next, to get to a point where the array is initialized | 144 # Let's do a next, to get to a point where the array is initialized |
155 # We don't care about the annotated output for this operation, it is the same as | 145 # We don't care about the annotated output for this operation, it is the same as |
156 # the one produced by run above | 146 # the one produced by run above |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 gdb_test_multiple "delete 3" "delete bp 3" { | 293 gdb_test_multiple "delete 3" "delete bp 3" { |
304 -re "\r\n\032\032post-prompt\r\n$gdb_prompt$" { | 294 -re "\r\n\032\032post-prompt\r\n$gdb_prompt$" { |
305 pass "delete bp 3" | 295 pass "delete bp 3" |
306 } | 296 } |
307 } | 297 } |
308 | 298 |
309 # | 299 # |
310 # break at main, after value is initialized. This is in preparation | 300 # break at main, after value is initialized. This is in preparation |
311 # to test the annotate output for the display command. | 301 # to test the annotate output for the display command. |
312 # | 302 # |
313 gdb_test_multiple "break main" "break at 28" { | 303 gdb_test_multiple "break main" "break at main" { |
314 -re "post-prompt.*\032\032breakpoints-invalid.*Breakpoint 4 at $hex: file ${
escapedsrcfile}, line $main_line.*$gdb_prompt$" { | 304 -re "post-prompt.*\032\032breakpoints-invalid.*Breakpoint 4 at $hex: file ${
escapedsrcfile}, line $main_line.*$gdb_prompt$" { |
315 » pass "break at 28" | 305 » pass "break at main" |
316 } | 306 } |
317 -re "post-prompt.*\032\032breakpoints-invalid.*Breakpoint 4 at $hex: file .*
${srcfile}, line $main_line.*$gdb_prompt$" { | 307 -re "post-prompt.*\032\032breakpoints-invalid.*Breakpoint 4 at $hex: file .*
${srcfile}, line $main_line.*$gdb_prompt$" { |
318 setup_xfail "*-*-*" 1270 | 308 setup_xfail "*-*-*" 1270 |
319 » fail "break at 28" | 309 » fail "break at main" |
320 } | 310 } |
321 } | 311 } |
322 | 312 |
323 # | 313 # |
324 # display the value; test: | 314 # display the value; test: |
325 # annotate-display-begin | 315 # annotate-display-begin |
326 # annotate-display-number-end | 316 # annotate-display-number-end |
327 # annotate-display-format | 317 # annotate-display-format |
328 # annotate-display-expression | 318 # annotate-display-expression |
329 # annotate-display-expression-end | 319 # annotate-display-expression-end |
(...skipping 22 matching lines...) Expand all Loading... |
352 } | 342 } |
353 } | 343 } |
354 -re ".*$gdb_prompt$" { fail "re-run" } | 344 -re ".*$gdb_prompt$" { fail "re-run" } |
355 timeout { fail "re-run (timeout)" } | 345 timeout { fail "re-run (timeout)" } |
356 } | 346 } |
357 | 347 |
358 # | 348 # |
359 # Test that breakpoints-invalid is issued once and only once for | 349 # Test that breakpoints-invalid is issued once and only once for |
360 # breakpoint ignore count changes, after annotation stopped. | 350 # breakpoint ignore count changes, after annotation stopped. |
361 # | 351 # |
362 gdb_test_multiple "break 46" "break at 46" { | 352 |
363 -re "Breakpoint 5 at $hex: file .*$srcfile, line 46.*$gdb_prompt$" { | 353 set value_inc_line [gdb_get_line_number "increment value"] |
364 » pass "break at 46" | 354 |
| 355 gdb_test_multiple "break $value_inc_line" "break at value++" { |
| 356 -re "Breakpoint 5 at $hex: file .*$srcfile, line $value_inc_line.*$gdb_promp
t$" { |
| 357 » pass "break at value++" |
365 } | 358 } |
366 } | 359 } |
367 | 360 |
368 gdb_test_multiple "ignore 5 4" "ignore 5 4" { | 361 gdb_test_multiple "ignore 5 4" "ignore 5 4" { |
369 -re "Will ignore next 4 crossings of breakpoint 5.*$gdb_prompt$" { | 362 -re "Will ignore next 4 crossings of breakpoint 5.*$gdb_prompt$" { |
370 pass "ignore 5 4" | 363 pass "ignore 5 4" |
371 } | 364 } |
372 } | 365 } |
373 | 366 |
374 gdb_test_multiple "continue" "annotate ignore count change" { | 367 gdb_test_multiple "continue" "annotate ignore count change" { |
375 -re ".*$srcfile:46:.*\032\032stopped\r\n\r\n\032\032breakpoints-invalid\r\n$
gdb_prompt$" { | 368 -re ".*$srcfile:$value_inc_line:.*\032\032stopped\r\n\r\n\032\032breakpoints
-invalid\r\n$gdb_prompt$" { |
376 pass "annotate ignore count change" | 369 pass "annotate ignore count change" |
377 } | 370 } |
378 } | 371 } |
379 | 372 |
380 # check that ignore command is working, or the above can provide | 373 # check that ignore command is working, or the above can provide |
381 # misleading assurance ... | 374 # misleading assurance ... |
382 | 375 |
383 gdb_test_multiple "next" "next to exit loop" { | 376 gdb_test_multiple "next" "next to exit loop" { |
384 -re "source .*annota1.c.*$gdb_prompt$" { | 377 -re "source .*annota1.c.*$gdb_prompt$" { |
385 } | 378 } |
386 } | 379 } |
387 | 380 |
| 381 set after_loop_line [gdb_get_line_number "after loop"] |
| 382 |
388 gdb_test_multiple "next" "breakpoint ignore count" { | 383 gdb_test_multiple "next" "breakpoint ignore count" { |
389 -re ".*$srcfile:49:.*$gdb_prompt$" { | 384 -re ".*$srcfile:$after_loop_line:.*$gdb_prompt$" { |
390 pass "breakpoint ignore count" | 385 pass "breakpoint ignore count" |
391 } | 386 } |
392 } | 387 } |
393 | 388 |
394 # Get the inferior's PID for later. | 389 # Get the inferior's PID for later. |
395 | 390 |
396 set test "get inferior pid" | 391 set test "get inferior pid" |
397 set pid -1 | 392 set pid -1 |
398 gdb_test_multiple "info inferior 1" "$test" { | 393 gdb_test_multiple "info inferior 1" "$test" { |
399 -re "process (\[0-9\]*).*$gdb_prompt$" { | 394 -re "process (\[0-9\]*).*$gdb_prompt$" { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 pass "$test (not dumped)" | 440 pass "$test (not dumped)" |
446 } | 441 } |
447 | 442 |
448 proc thread_test {} { | 443 proc thread_test {} { |
449 global objdir subdir srcdir testfile | 444 global objdir subdir srcdir testfile |
450 global gdb_prompt old_gdb_prompt | 445 global gdb_prompt old_gdb_prompt |
451 set srcfile watch_thread_num.c | 446 set srcfile watch_thread_num.c |
452 set binfile ${objdir}/${subdir}/${testfile}-watch_thread_num | 447 set binfile ${objdir}/${subdir}/${testfile}-watch_thread_num |
453 set gdb_prompt $old_gdb_prompt | 448 set gdb_prompt $old_gdb_prompt |
454 | 449 |
455 if { ![get_compiler_info ${binfile}] && [gdb_compile_pthreads "${srcdir}/${s
ubdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] == "" } { | 450 if { ![get_compiler_info] && [gdb_compile_pthreads "${srcdir}/${subdir}/${sr
cfile}" "${binfile}" executable {debug nowarnings}] == "" } { |
456 | 451 |
457 gdb_exit | 452 gdb_exit |
458 gdb_start | 453 gdb_start |
459 gdb_reinitialize_dir $srcdir/$subdir | 454 gdb_reinitialize_dir $srcdir/$subdir |
460 gdb_load ${binfile} | 455 gdb_load ${binfile} |
461 if { ![runto main] } then { | 456 if { ![runto main] } then { |
462 fail "run to main" | 457 fail "run to main" |
463 return | 458 return |
464 } | 459 } |
465 | 460 |
(...skipping 20 matching lines...) Expand all Loading... |
486 } | 481 } |
487 } | 482 } |
488 } | 483 } |
489 | 484 |
490 thread_test | 485 thread_test |
491 thread_switch | 486 thread_switch |
492 | 487 |
493 # restore the original prompt for the rest of the testsuite | 488 # restore the original prompt for the rest of the testsuite |
494 | 489 |
495 set gdb_prompt $old_gdb_prompt | 490 set gdb_prompt $old_gdb_prompt |
OLD | NEW |