OLD | NEW |
1 # Copyright 1988, 1990-1992, 1994-2000, 2002-2003, 2007-2012 Free | 1 # Copyright 1988, 1990-1992, 1994-2000, 2002-2003, 2007-2012 Free |
2 # Software Foundation, Inc. | 2 # Software Foundation, Inc. |
3 | 3 |
4 # This program is free software; you can redistribute it and/or modify | 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 | 5 # it under the terms of the GNU General Public License as published by |
6 # the Free Software Foundation; either version 3 of the License, or | 6 # the Free Software Foundation; either version 3 of the License, or |
7 # (at your option) any later version. | 7 # (at your option) any later version. |
8 # | 8 # |
9 # This program is distributed in the hope that it will be useful, | 9 # This program is distributed in the hope that it will be useful, |
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 # Verify the breakpoint was put at the start of the conditional. | 108 # Verify the breakpoint was put at the start of the conditional. |
109 # | 109 # |
110 gdb_test "break multi_line_if_conditional" \ | 110 gdb_test "break multi_line_if_conditional" \ |
111 "Breakpoint.*at.* file .*$srcfile, line $bp_location3\\." \ | 111 "Breakpoint.*at.* file .*$srcfile, line $bp_location3\\." \ |
112 "breakpoint at start of multi line if conditional" | 112 "breakpoint at start of multi line if conditional" |
113 | 113 |
114 gdb_test "break multi_line_while_conditional" \ | 114 gdb_test "break multi_line_while_conditional" \ |
115 "Breakpoint.*at.* file .*$srcfile, line $bp_location4\\." \ | 115 "Breakpoint.*at.* file .*$srcfile, line $bp_location4\\." \ |
116 "breakpoint at start of multi line while conditional" | 116 "breakpoint at start of multi line while conditional" |
117 | 117 |
118 set bp_location5 [gdb_get_line_number "set breakpoint 5 here"] | |
119 set bp_location6 [gdb_get_line_number "set breakpoint 6 here"] | 118 set bp_location6 [gdb_get_line_number "set breakpoint 6 here"] |
120 | 119 |
121 # | 120 set main_line $bp_location6 |
122 # check to see what breakpoints are set | |
123 # | |
124 if [target_info exists gdb_stub] { | |
125 set main_line $bp_location5 | |
126 } else { | |
127 set main_line $bp_location6 | |
128 } | |
129 | 121 |
130 if {$hp_aCC_compiler} { | 122 if {$hp_aCC_compiler} { |
131 set proto "\\(int\\)" | 123 set proto "\\(int\\)" |
132 } else { | 124 } else { |
133 set proto "" | 125 set proto "" |
134 } | 126 } |
135 | 127 |
136 set bp_location7 [gdb_get_line_number "set breakpoint 7 here"] | 128 set bp_location7 [gdb_get_line_number "set breakpoint 7 here"] |
137 set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile1] | 129 set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile1] |
138 set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile1] | 130 set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile1] |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 "History has not yet reached .10." \ | 347 "History has not yet reached .10." \ |
356 "disable with non-existent history value" | 348 "disable with non-existent history value" |
357 gdb_test "disable \$1foo" \ | 349 gdb_test "disable \$1foo" \ |
358 "Convenience variable must have integer value.*" \ | 350 "Convenience variable must have integer value.*" \ |
359 "disable with badly formed history value" | 351 "disable with badly formed history value" |
360 | 352 |
361 # FIXME: The rest of this test doesn't work with anything that can't | 353 # FIXME: The rest of this test doesn't work with anything that can't |
362 # handle arguments. | 354 # handle arguments. |
363 # Huh? There doesn't *appear* to be anything that passes arguments | 355 # Huh? There doesn't *appear* to be anything that passes arguments |
364 # below. | 356 # below. |
365 if [istarget "mips-idt-*"] then { | |
366 return | |
367 } | |
368 | 357 |
369 # | 358 # |
370 # run until the breakpoint at main is hit. For non-stubs-using targets. | 359 # run until the breakpoint at main is hit. For non-stubs-using targets. |
371 # | 360 # |
372 gdb_run_cmd | 361 gdb_run_cmd |
373 gdb_expect { | 362 gdb_expect { |
374 -re "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*
$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $" { | 363 -re "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:$bp_location6.*
$bp_location6\[\t \]+if .argc.* \{.*$gdb_prompt $" { |
375 pass "run until function breakpoint" | 364 pass "run until function breakpoint" |
376 } | 365 } |
377 -re "$gdb_prompt $" { | 366 -re "$gdb_prompt $" { |
378 fail "run until function breakpoint" | 367 fail "run until function breakpoint" |
379 } | 368 } |
380 timeout { | 369 timeout { |
381 fail "run until function breakpoint (timeout)" | 370 fail "run until function breakpoint (timeout)" |
382 } | 371 } |
383 } | 372 } |
384 | 373 |
| 374 # Test the 'list' commands sets current file for the 'break LINENO' command. |
| 375 set bp_marker1 [gdb_get_line_number "set breakpoint 16 here" ${srcfile1}] |
| 376 gdb_test "list marker1" ".*" |
| 377 gdb_test "break $bp_marker1" "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*${src
file1}, line ${bp_marker1}\\." \ |
| 378 "break lineno" |
| 379 gdb_test_no_output {delete $bpnum} |
| 380 |
385 # | 381 # |
386 # run until the breakpoint at a line number | 382 # run until the breakpoint at a line number |
387 # | 383 # |
388 gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*,
envp=.*\\) at .*$srcfile:$bp_location1.*$bp_location1\[\t \]+printf.*factorial.
*" \ | 384 gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*,
envp=.*\\) at .*$srcfile:$bp_location1.*$bp_location1\[\t \]+printf.*factorial.
*" \ |
389 "run until breakpoint set at a line number" | 385 "run until breakpoint set at a line number" |
390 | 386 |
391 # | 387 # |
392 # Run until the breakpoint set in a function in a file | 388 # Run until the breakpoint set in a function in a file |
393 # | 389 # |
394 for {set i 6} {$i >= 1} {incr i -1} { | 390 for {set i 6} {$i >= 1} {incr i -1} { |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 # | 571 # |
576 if ![runto_main] then { fail "break tests suppressed" } | 572 if ![runto_main] then { fail "break tests suppressed" } |
577 | 573 |
578 gdb_test_multiple "break $bp_location1" \ | 574 gdb_test_multiple "break $bp_location1" \ |
579 "set to-be-silent break bp_location1" { | 575 "set to-be-silent break bp_location1" { |
580 -re "Breakpoint (\[0-9\]*) at .*, line $bp_location1.*$gdb_prompt $" { | 576 -re "Breakpoint (\[0-9\]*) at .*, line $bp_location1.*$gdb_prompt $" { |
581 pass "set to-be-silent break bp_location1" | 577 pass "set to-be-silent break bp_location1" |
582 } | 578 } |
583 } | 579 } |
584 | 580 |
585 send_gdb "commands $expect_out(1,string)\n" | 581 gdb_test "commands $expect_out(1,string)\nsilent\nend" ">end" "set silent break
bp_location1" |
586 send_gdb "silent\n" | |
587 send_gdb "end\n" | |
588 gdb_expect { | |
589 -re ".*$gdb_prompt $"\ | |
590 {pass "set silent break bp_location1"} | |
591 timeout {fail "(timeout) set silent break bp_location1"} | |
592 } | |
593 | 582 |
594 gdb_test "info break $expect_out(1,string)" \ | 583 gdb_test "info break $expect_out(1,string)" \ |
595 "\[0-9\]*\[ \t\]*breakpoint.*:$bp_location1\r\n\[ \t\]*silent.*" \ | 584 "\[0-9\]*\[ \t\]*breakpoint.*:$bp_location1\r\n\[ \t\]*silent.*" \ |
596 "info silent break bp_location1" | 585 "info silent break bp_location1" |
597 | 586 |
598 gdb_test "continue" "Continuing." \ | 587 gdb_test "continue" "Continuing." \ |
599 "hit silent break bp_location1" | 588 "hit silent break bp_location1" |
600 | 589 |
601 gdb_test "bt" "#0 main .* at .*:$bp_location1.*" \ | 590 gdb_test "bt" "#0 main .* at .*:$bp_location1.*" \ |
602 "stopped for silent break bp_location1" | 591 "stopped for silent break bp_location1" |
603 | 592 |
604 # Verify that GDB can at least parse a breakpoint with the | 593 # Verify that GDB can at least parse a breakpoint with the |
605 # "thread" keyword. (We won't attempt to test here that a | 594 # "thread" keyword. (We won't attempt to test here that a |
606 # thread-specific breakpoint really triggers appropriately. | 595 # thread-specific breakpoint really triggers appropriately. |
607 # The gdb.threads subdirectory contains tests for that.) | 596 # The gdb.threads subdirectory contains tests for that.) |
608 # | 597 # |
609 set bp_location12 [gdb_get_line_number "set breakpoint 12 here"] | 598 set bp_location12 [gdb_get_line_number "set breakpoint 12 here"] |
610 gdb_test "break $bp_location12 thread 999" "Unknown thread 999.*" \ | 599 gdb_test "break $bp_location12 thread 999" "Unknown thread 999.*" \ |
611 "thread-specific breakpoint on non-existent thread disallowed" | 600 "thread-specific breakpoint on non-existent thread disallowed" |
612 | 601 |
613 gdb_test "break $bp_location12 thread foo" \ | 602 gdb_test "break $bp_location12 thread foo" \ |
614 "Junk after thread keyword.*" \ | 603 "Junk after thread keyword.*" \ |
615 "thread-specific breakpoint on bogus thread ID disallowed" | 604 "thread-specific breakpoint on bogus thread ID disallowed" |
616 | 605 |
617 # Verify that GDB responds gracefully to a breakpoint command with | 606 # Verify that GDB responds gracefully to a breakpoint command with |
618 # trailing garbage. | 607 # trailing garbage. |
619 # | 608 # |
620 gdb_test "break $bp_location12 foo" \ | 609 gdb_test "break $bp_location12 foo" \ |
621 "Junk at end of arguments.*" \ | 610 "malformed linespec error: unexpected string, \"foo\".*" \ |
622 "breakpoint with trailing garbage disallowed" | 611 "breakpoint with trailing garbage disallowed" |
623 | 612 |
624 # Verify that GDB responds gracefully to a "clear" command that has | 613 # Verify that GDB responds gracefully to a "clear" command that has |
625 # no matching breakpoint. (First, get us off the current source line, | 614 # no matching breakpoint. (First, get us off the current source line, |
626 # which we know has a breakpoint.) | 615 # which we know has a breakpoint.) |
627 # | 616 # |
628 gdb_test "next" "marker1.*" "step over breakpoint" | 617 gdb_test "next" "marker1.*" "step over breakpoint" |
629 | 618 |
630 gdb_test "clear 81" "No breakpoint at 81.*" \ | 619 gdb_test "clear 81" "No breakpoint at 81.*" \ |
631 "clear line has no breakpoint disallowed" | 620 "clear line has no breakpoint disallowed" |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 } | 958 } |
970 } | 959 } |
971 | 960 |
972 | 961 |
973 # Reset the default arguments for VxWorks | 962 # Reset the default arguments for VxWorks |
974 if [istarget "*-*-vxworks*"] { | 963 if [istarget "*-*-vxworks*"] { |
975 set timeout 10 | 964 set timeout 10 |
976 verbose "Timeout is now $timeout seconds" 2 | 965 verbose "Timeout is now $timeout seconds" 2 |
977 gdb_test_no_output "set args main" | 966 gdb_test_no_output "set args main" |
978 } | 967 } |
OLD | NEW |