1 # Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1997, 1998, 1999, 2000,
2 # 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010
3 # Free Software Foundation, Inc.
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 3 of the License, or
8 # (at your option) any later version.
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.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 # test special commands (if, while, etc)
28 if { [prepare_for_testing commands.exp commands run.c {debug additional_flags=-DFAKEARGV}] } {
32 proc gdbvar_simple_if_test {} {
35 gdb_test "set \$foo = 0" "" "set foo in gdbvar_simple_if_test"
36 # All this test should do is print 0xdeadbeef once.
37 gdb_test "if \$foo == 1\np/x 0xfeedface\nelse\np/x 0xdeadbeef\nend" \
38 "\\\$\[0-9\]* = 0xdeadbeef" "gdbvar_simple_if_test #1"
39 # All this test should do is print 0xfeedface once.
40 gdb_test "if \$foo == 0\np/x 0xfeedface\nelse\np/x 0xdeadbeef\nend" \
41 "\\\$\[0-9\]* = 0xfeedface" "gdbvar_simple_if_test #2"
44 proc gdbvar_simple_while_test {} {
47 gdb_test "set \$foo = 5" "" "set foo in gdbvar_simple_while_test"
48 # This test should print 0xfeedface five times.
49 gdb_test "while \$foo > 0\np/x 0xfeedface\nset \$foo -= 1\nend" \
50 "\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" \
51 "gdbvar_simple_while_test #1"
54 proc gdbvar_complex_if_while_test {} {
57 gdb_test "set \$foo = 4" "" "set foo in gdbvar complex_if_while_test"
58 # This test should alternate between 0xdeadbeef and 0xfeedface two times.
59 gdb_test "while \$foo > 0\nset \$foo -= 1\nif \(\$foo % 2\) == 1\np/x 0xdeadbeef\nelse\np/x 0xfeedface\nend\nend" \
60 "\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" \
61 "gdbvar_complex_if_while_test #1"
64 proc progvar_simple_if_test {} {
67 if [target_info exists noargs] {
68 verbose "Skipping progvar_simple_if_test because of noargs."
72 if { ![runto factorial] } then { gdb_suppress_tests; }
73 # Don't depend upon argument passing, since most simulators don't
74 # currently support it. Bash value variable to be what we want.
75 gdb_test "p value=5" "" "set value to 5 in progvar_simple_if_test #1"
76 # All this test should do is print 0xdeadbeef once.
77 gdb_test "if value == 1\np/x 0xfeedface\nelse\np/x 0xdeadbeef\nend" \
78 "\\\$\[0-9\]* = 0xdeadbeef" \
79 "progvar_simple_if_test #1"
80 # All this test should do is print 0xfeedface once.
81 gdb_test "if value == 5\np/x 0xfeedface\nelse\np/x 0xdeadbeef\nend" \
82 "\\\$\[0-9\]* = 0xfeedface" \
83 "progvar_simple_if_test #2"
84 gdb_stop_suppressing_tests;
87 proc progvar_simple_while_test {} {
90 if [target_info exists noargs] {
91 verbose "Skipping progvar_simple_while_test because of noargs."
95 gdb_test "set args 5" "" "set args in progvar_simple_while_test"
96 if { ![runto factorial] } then { gdb_suppress_tests }
97 # Don't depend upon argument passing, since most simulators don't
98 # currently support it. Bash value variable to be what we want.
99 gdb_test "p value=5" "" "set value to 5 in progvar_simple_if_test #2"
100 # This test should print 0xfeedface five times.
101 gdb_test "while value > 0\np/x 0xfeedface\nset value -= 1\nend" \
102 "\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" \
103 "progvar_simple_while_test #1"
104 gdb_stop_suppressing_tests;
107 proc progvar_complex_if_while_test {} {
110 if [target_info exists noargs] {
111 verbose "Skipping progvar_simple_if_while_test because of noargs."
115 gdb_test "set args 4" "" "set args in progvar_complex_if_while_test"
116 if { ![runto factorial] } then { gdb_suppress_tests }
117 # Don't depend upon argument passing, since most simulators don't
118 # currently support it. Bash value variable to be what we want.
119 gdb_test "p value=4" "" "set value to 4 in progvar_simple_if_test"
120 # This test should alternate between 0xdeadbeef and 0xfeedface two times.
121 gdb_test "while value > 0\nset value -= 1\nif \(value % 2\) == 1\np/x 0xdeadbeef\nelse\np/x 0xfeedface\nend\nend" \
122 "\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" \
123 "progvar_complex_if_while_test #1"
124 gdb_stop_suppressing_tests;
127 proc if_while_breakpoint_command_test {} {
128 if [target_info exists noargs] {
129 verbose "Skipping if_while_breakpoint_command_test because of noargs."
133 gdb_test "set args 5" "" "set args in if_while_breakpoint_command_test"
134 if { ![runto factorial] } then { gdb_suppress_tests }
135 # Don't depend upon argument passing, since most simulators don't
136 # currently support it. Bash value variable to be what we want.
137 gdb_test "p value=5" "" "set value to 5 in progvar_simple_if_test"
139 gdb_test "break factorial" "Breakpoint.*at.*" "break factorial #1"
141 send_gdb "commands\n"
144 pass "commands in if_while_breakpoint_command_test"
147 fail "(timeout or eof) commands in if_while_breakpoint_command_test"
150 # This test should alternate between 0xdeadbeef and 0xfeedface two times.
151 gdb_test "while value > 0\nset value -= 1\nif \(value % 2\) == 1\np/x 0xdeadbeef\nelse\np/x 0xfeedface\nend\nend\nend" \
153 "commands part 2 in if_while_breakpoint_command_test"
154 gdb_test "continue" \
155 "\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" \
156 "if_while_breakpoint_command_test #1"
157 gdb_test "info break" \
158 "while.*set.*if.*p/x.*else.*p/x.*end.*" \
159 "info break in if_while_breakpoint_command_test"
160 gdb_stop_suppressing_tests;
163 # Test that we can run the inferior from breakpoint commands.
165 # The expected behavior is that all commands after the first "step"
166 # shall be ignored. See the gdb manual, "Break Commands",
167 # subsection "Breakpoint command lists".
169 proc infrun_breakpoint_command_test {} {
170 if [target_info exists noargs] {
171 verbose "Skipping infrun_breakpoint_command_test because of noargs."
175 gdb_test "set args 6" "" "set args in infrun_breakpoint_command_test"
176 if { ![runto factorial] } then { gdb_suppress_tests }
177 # Don't depend upon argument passing, since most simulators don't
178 # currently support it. Bash value variable to be what we want.
179 gdb_test "p value=6" "" "set value to 6 in progvar_simple_if_test #1"
181 gdb_test "break factorial if value == 5" "Breakpoint.*at.*"
183 # infrun_breakpoint_command_test - This test was broken into two parts
184 # to get around a synchronization problem in expect.
185 # part1: issue the gdb command "commands"
186 # part2: send the list of commands
187 send_gdb "commands\n"
190 pass "commands in infrun_breakpoint_command_test #1"
193 fail "(timeout or eof) commands in infrun_breakpoint_command_test"
196 gdb_test "step\nstep\nstep\nstep\nend" "" \
197 "commands in infrun_breakpoint_command_test #2"
199 gdb_test "continue" \
200 "Continuing.*.*.*Breakpoint \[0-9\]*, factorial \\(value=5\\).*at.*\[0-9\]*\[ \]*if \\(value > 1\\) \{.*\[0-9\]*\[ \]*value \\*= factorial \\(value - 1\\);.*" \
201 "continue in infrun_breakpoint_command_test"
203 gdb_stop_suppressing_tests;
206 proc breakpoint_command_test {} {
207 if [target_info exists noargs] {
208 verbose "Skipping breakpoint_command_test because of noargs."
212 gdb_test "set args 6" "" "set args in breakpoint_command_test"
213 if { ![runto factorial] } then { gdb_suppress_tests; }
214 # Don't depend upon argument passing, since most simulators don't
215 # currently support it. Bash value variable to be what we want.
216 gdb_test "p value=6" "" "set value to 6 in progvar_simple_if_test #2"
218 gdb_test "break factorial" "Breakpoint.*at.*" "break factorial #2"
219 gdb_test "commands\nprintf \"Now the value is %d\\n\", value\nend" \
220 "End with.*" "commands in breakpoint_command_test"
221 gdb_test "continue" \
222 "Breakpoint \[0-9\]*, factorial.*Now the value is 5" \
223 "continue in breakpoint_command_test"
224 gdb_test "print value" " = 5" "print value in breakpoint_command_test"
225 gdb_stop_suppressing_tests;
228 # Test a simple user defined command (with arguments)
229 proc user_defined_command_test {} {
232 gdb_test "set \$foo = 4" "" "set foo in user_defined_command_test"
234 send_gdb "define mycommand\n"
237 pass "define mycommand in user_defined_command_test"
240 fail "(timeout or eof) define mycommand in user_defined_command_test"
243 # This test should alternate between 0xdeadbeef and 0xfeedface two times.
244 gdb_test "while \$arg0 > 0\nset \$arg0 -= 1\nif \(\$arg0 % 2\) == 1\np/x 0xdeadbeef\nelse\np/x 0xfeedface\nend\nend\nend" \
246 "enter commands in user_defined_command_test"
248 gdb_test "mycommand \$foo" \
249 "\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" \
250 "execute user defined command in user_defined_command_test"
251 gdb_test "show user mycommand" \
252 " while \\\$arg0.*set.* if \\\(\\\$arg0.*p/x.* else\[^\n\].*p/x.* end\[^\n\].* end\[^\n\].*" \
253 "display user command in user_defined_command_test"
256 proc watchpoint_command_test {} {
260 if [target_info exists noargs] {
261 verbose "Skipping watchpoint_command_test because of noargs."
265 # Disable hardware watchpoints if necessary.
266 if [target_info exists gdb,no_hardware_watchpoints] {
267 gdb_test "set can-use-hw-watchpoints 0" "" ""
270 gdb_test "set args 6" "" "set args in watchpoint_command_test"
271 if { ![runto factorial] } then { return }
274 # Verify that we can create a watchpoint, and give it a commands
275 # list that continues the inferior. We set the watchpoint on a
276 # local variable, too, so that it self-deletes when the watched
277 # data goes out of scope.
279 # What should happen is: Each time the watchpoint triggers, it
280 # continues the inferior. Eventually, the watchpoint will self-
281 # delete, when the watched variable is out of scope. But by that
282 # time, the inferior should have exited. GDB shouldn't crash or
283 # anything untoward as a result of this.
287 send_gdb "watch local_var\n"
289 -re ".*\[Ww\]atchpoint (\[0-9\]*): local_var.*$gdb_prompt $" {
290 set wp_id $expect_out(1,string)
291 pass "watch local_var"
294 {fail "watch local_var"}
295 timeout {fail "(timeout) watch local_var"}
298 if {$wp_id == -1} {return}
300 send_gdb "commands $wp_id\n"
302 -re "Type commands for when breakpoint $wp_id is hit, one per line.*>" {
303 pass "begin commands on watch"
305 -re "$gdb_prompt $" {fail "begin commands on watch"}
306 timeout {fail "(timeout) begin commands on watch"}
308 send_gdb "print value\n"
310 -re ">" {pass "add print command to watch"}
311 -re "$gdb_prompt $" {fail "add print command to watch"}
312 timeout {fail "(timeout) add print command to watch"}
314 send_gdb "continue\n"
316 -re ">" {pass "add continue command to watch"}
317 -re "$gdb_prompt $" {fail "add continue command to watch"}
318 timeout {fail "(timeout) add continue command to watch"}
322 -re "$gdb_prompt $" {pass "end commands on watch"}
323 timeout {fail "(timeout) end commands on watch"}
325 send_gdb "continue\n"
327 -re "Continuing.*\[Ww\]atchpoint $wp_id deleted because the program has left the block in.*which its expression is valid.*run.c:(57|82).*$gdb_prompt $" {
328 pass "continue with watch"
330 -re "$gdb_prompt $" {fail "continue with watch"}
331 timeout {fail "(timeout) continue with watch"}
335 proc test_command_prompt_position {} {
338 if [target_info exists noargs] {
339 verbose "Skipping test_command_prompt_position because of noargs."
343 if { ![runto factorial] } then { gdb_suppress_tests; }
344 # Don't depend upon argument passing, since most simulators don't
345 # currently support it. Bash value variable to be what we want.
347 gdb_test "break factorial" "Breakpoint.*at.*" "break factorial #3"
348 gdb_test "p value=5" "" "set value to 5 in test_command_prompt_position"
349 # All this test should do is print 0xdeadbeef once.
350 gdb_test "if value == 1\np/x 0xfeedface\nelse\np/x 0xdeadbeef\nend" \
351 "\\\$\[0-9\]* = 0xdeadbeef" \
352 "if test in test_command_prompt_position"
354 # Now let's test for the correct position of the '>' in gdb's
355 # prompt for commands. It should be at the beginning of the line,
356 # and not after one space.
358 send_gdb "commands\n"
360 -re "Type commands.*End with.*\[\r\n\]>$" {
361 send_gdb "printf \"Now the value is %d\\n\", value\n"
363 -re "^printf.*value\r\n>$" {
366 -re "^end\r\n$gdb_prompt $" {
367 pass "> OK in test_command_prompt_position"
369 -re ".*$gdb_prompt $" {
370 fail "some other message in test_command_prompt_position"
373 fail "(timeout) 1 in test_command_prompt_position"
377 -re "^ >$" { fail "> not OK in test_command_prompt_position" }
378 -re ".*$gdb_prompt $" {
379 fail "wrong message in test_command_prompt_position"
382 fail "(timeout) 2 in test_command_prompt_position "
386 -re "Type commands.*End with.*\[\r\n\] >$" {
387 fail "prompt not OK in test_command_prompt_position"
389 -re ".*$gdb_prompt $" {
390 fail "commands in test_command_prompt_position"
392 timeout { fail "(timeout) 3 commands in test_command_prompt_position" }
395 gdb_stop_suppressing_tests;
400 proc deprecated_command_test {} {
401 gdb_test "maintenance deprecate blah" "Can't find command.*" \
402 "tried to deprecate non-existing command"
404 gdb_test "maintenance deprecate p \"new_p\"" "" "maintenance deprecate p \"new_p\" /1/"
406 "Warning: 'p', an alias for the command 'print' is deprecated.*Use 'new_p'.*" \
407 "p deprecated warning, with replacement"
408 gdb_test "p 5" ".\[0-9\]* = 5.*" "Deprecated warning goes away /1/"
410 gdb_test "maintenance deprecate p \"new_p\"" "" "maintenance deprecate p \"new_p\" /2/"
411 gdb_test "maintenance deprecate print \"new_print\"" ""
413 "Warning: command 'print' \\(p\\) is deprecated.*Use 'new_print'.*" \
414 "both alias and command are deprecated"
415 gdb_test "p 5" ".\[0-9\]* = 5.*" "Deprecated warning goes away /2/"
417 gdb_test "maintenance deprecate set remote memory-read-packet-size \"srm\" " \
419 "deprecate long command /1/"
420 gdb_test "set remote memory-read-packet-size" \
421 "Warning: command 'set remote memory-read-packet-size' is deprecated.*Use 'srm'.*" \
422 "long command deprecated /1/"
424 gdb_test "maintenance deprecate set remote memory-read-packet-size" \
426 "deprecate long command /2/"
427 gdb_test "set remote memory-read-packet-size" \
428 "Warning: command 'set remote memory-read-packet-size' is deprecated.*No alternative known.*" \
429 "long command deprecated with no alternative /2/"
431 gdb_test "maintenance deprecate" \
432 "\"maintenance deprecate\".*" \
433 "deprecate with no arguments"
436 proc bp_deleted_in_command_test {} {
439 if [target_info exists noargs] {
440 verbose "Skipping bp_deleted_in_command_test because of noargs."
444 gdb_test "set args 1" "" "set args in bp_deleted_in_command_test"
447 # Create a breakpoint, and associate a command-list to it, with
448 # one command that deletes this breakpoint.
449 gdb_test "break factorial" \
450 "Breakpoint \[0-9\]+ at .*: file .*/run.c, line \[0-9\]+\." \
451 "breakpoint in bp_deleted_in_command_test"
453 send_gdb "commands\n"
455 -re "Type commands for when breakpoint .* is hit, one per line.*>" {
456 pass "begin commands in bp_deleted_in_command_test"
458 -re "$gdb_prompt $" {fail "begin commands in bp_deleted_in_command_test"}
459 timeout {fail "(timeout) begin commands bp_deleted_in_command_test"}
463 -re ">" {pass "add silent command"}
464 -re "$gdb_prompt $" {fail "add silent command"}
465 timeout {fail "(timeout) add silent command"}
467 send_gdb "clear factorial\n"
469 -re ">" {pass "add clear command"}
470 -re "$gdb_prompt $" {fail "add clear command"}
471 timeout {fail "(timeout) add clear command"} }
472 send_gdb "printf \"factorial command-list executed\\n\"\n"
474 -re ">" {pass "add printf command"}
475 -re "$gdb_prompt $" {fail "add printf command"}
476 timeout {fail "(timeout) add printf command"}
480 -re ">" {pass "add cont command"}
481 -re "$gdb_prompt $" {fail "add cont command"}
482 timeout {fail "(timeout) add cont command"} }
485 -re "$gdb_prompt $" {pass "end commands"}
486 timeout {fail "(timeout) end commands"}
491 -re ".*factorial command-list executed.*$gdb_prompt $" {
492 pass "run factorial until breakpoint"
494 -re ".*$gdb_prompt $" {
495 fail "run factorial until breakpoint"
497 default { fail "(timeout) run factorial until breakpoint" }
498 timeout { fail "(timeout) run factorial until breakpoint" }
502 proc temporary_breakpoint_commands {} {
505 if [target_info exists noargs] {
506 verbose "Skipping temporary_breakpoint_commands because of noargs."
510 gdb_test "set args 1" "" "set args in temporary_breakpoint_commands"
513 # Create a temporary breakpoint, and associate a commands list to it.
514 # This test will verify that this commands list is executed when the
516 gdb_test "tbreak factorial" \
517 "Temporary breakpoint \[0-9\]+ at .*: file .*/run.c, line \[0-9\]+\." \
518 "breakpoint in temporary_breakpoint_commands"
520 send_gdb "commands\n"
522 -re "Type commands for when breakpoint .* is hit, one per line.*>" {
523 pass "begin commands in bp_deleted_in_command_test"
525 -re "$gdb_prompt $" {fail "begin commands in bp_deleted_in_command_test"}
526 timeout {fail "(timeout) begin commands bp_deleted_in_command_test"}
530 -re ">" {pass "add silent tbreak command"}
531 -re "$gdb_prompt $" {fail "add silent tbreak command"}
532 timeout {fail "(timeout) add silent tbreak command"}
534 send_gdb "printf \"factorial tbreak commands executed\\n\"\n"
536 -re ">" {pass "add printf tbreak command"}
537 -re "$gdb_prompt $" {fail "add printf tbreak command"}
538 timeout {fail "(timeout) add printf tbreak command"}
542 -re ">" {pass "add cont tbreak command"}
543 -re "$gdb_prompt $" {fail "add cont tbreak command"}
544 timeout {fail "(timeout) add cont tbreak command"} }
547 -re "$gdb_prompt $" {pass "end tbreak commands"}
548 timeout {fail "(timeout) end tbreak commands"}
553 -re ".*factorial tbreak commands executed.*$gdb_prompt $" {
554 pass "run factorial until temporary breakpoint"
556 timeout { fail "(timeout) run factorial until temporary breakpoint" }
560 # Test that GDB can handle $arg0 outside of user functions without
562 proc stray_arg0_test { } {
563 gdb_test "print \$arg0" \
564 "\\\$\[0-9\]* = void" \
567 gdb_test "if 1 == 1\nprint \$arg0\nend" \
568 "\\\$\[0-9\]* = void" \
571 gdb_test "print \$arg0 = 1" \
575 gdb_test "print \$arg0" \
580 # Test that GDB is able to source a file with an indented comment.
581 proc source_file_with_indented_comment {} {
582 set fd [open "file1" w]
590 gdb_test "source file1" "Done!" "source file with indented comment"
593 # Test that GDB can handle arguments when sourcing files recursively.
594 # If the arguments are overwritten with ####### then the test has failed.
595 proc recursive_source_test {} {
596 set fd [open "file1" w]
602 set fd [open "file2" w]
605 echo 1: <<<$arg0>>>\n
607 echo 2: <<<$arg0>>>\n
611 set fd [open "file3" w]
614 #################################################################"
617 gdb_test "source file1" \
618 "1: <<<qwerty>>>\[\r\n]+in file3\[\r\n]+2: <<<qwerty>>>" \
619 "recursive source test"
626 proc gdb_test_no_prompt { command result msg } {
629 set msg "$command - $msg"
630 set result "^[string_to_regexp $command]\r\n$result$"
631 gdb_test_multiple $command $msg {
644 proc if_commands_test {} {
647 gdb_test "set \$tem = 1" "" "set \$tem in if_commands_test"
649 set test "if_commands_test 1"
650 gdb_test_no_prompt "if \$tem == 2" { >} $test
651 gdb_test_no_prompt "break main" { >} $test
652 gdb_test_no_prompt "else" { >} $test
653 gdb_test_no_prompt "break factorial" { >} $test
654 gdb_test_no_prompt "commands" { >} $test
655 gdb_test_no_prompt "silent" { >} $test
656 gdb_test_no_prompt "set \$tem = 3" { >} $test
657 gdb_test_no_prompt "continue" { >} $test
658 gdb_test_multiple "end" "first end - $test" {
660 pass "first end - $test"
663 fail "first end - $test"
666 gdb_test_multiple "end" "second end - $test" {
667 -re "Breakpoint \[0-9\]+ at .*: file .*/run.c, line \[0-9\]+\.\r\n$gdb_prompt $" {
668 pass "second end - $test"
670 -re "Undefined command: \"silent\".*$gdb_prompt $" {
671 fail "second end - $test"
675 set test "if_commands_test 2"
676 gdb_test_no_prompt "if \$tem == 1" { >} $test
677 gdb_test_no_prompt "break main" { >} $test
678 gdb_test_no_prompt "else" { >} $test
679 gdb_test_no_prompt "break factorial" { >} $test
680 gdb_test_no_prompt "commands" { >} $test
681 gdb_test_no_prompt "silent" { >} $test
682 gdb_test_no_prompt "set \$tem = 3" { >} $test
683 gdb_test_no_prompt "continue" { >} $test
684 gdb_test_multiple "end" "first end - $test" {
686 pass "first end - $test"
689 fail "first end - $test"
692 gdb_test_multiple "end" "second end - $test" {
693 -re "Breakpoint \[0-9\]+ at .*: file .*/run.c, line \[0-9\]+\.\r\n$gdb_prompt $" {
694 pass "second end - $test"
699 proc redefine_hook_test {} {
702 gdb_test "define one\nend" \
706 gdb_test "define hook-one\necho hibob\\n\nend" \
710 gdb_test_multiple "define one" "redefine one" {
711 -re "Redefine command .one.. .y or n. $" {
717 pass "define one in redefine_hook_test"
720 fail "(timeout or eof) define one in redefine_hook_test"
726 "enter commands for one redefinition in redefine_hook_test"
730 "execute one command in redefine_hook_test"
733 proc redefine_backtrace_test {} {
736 gdb_test_multiple "define backtrace" "define backtrace" {
737 -re "Really redefine built-in.*$" {
743 pass "define backtrace in redefine_backtrace_test"
746 fail "(timeout or eof) define backtrace in redefine_backtrace_test"
749 gdb_test "echo hibob\\n\nend" \
751 "enter commands in redefine_backtrace_test"
753 gdb_test "backtrace" \
755 "execute backtrace command in redefine_backtrace_test"
758 "execute bt command in redefine_backtrace_test"
761 gdbvar_simple_if_test
762 gdbvar_simple_while_test
763 gdbvar_complex_if_while_test
764 progvar_simple_if_test
765 progvar_simple_while_test
766 progvar_complex_if_while_test
767 if_while_breakpoint_command_test
768 infrun_breakpoint_command_test
769 breakpoint_command_test
770 user_defined_command_test
771 watchpoint_command_test
772 test_command_prompt_position
773 deprecated_command_test
774 bp_deleted_in_command_test
775 temporary_breakpoint_commands
777 source_file_with_indented_comment
778 recursive_source_test
781 # This one should come last, as it redefines "backtrace".
782 redefine_backtrace_test