diff options
Diffstat (limited to 'gdb/testsuite')
34 files changed, 521 insertions, 411 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 1c7c090..a06f49d 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +Sun Feb 23 19:56:02 1997 Bob Manson <manson@charmed.cygnus.com> + + * config/vr4300.exp: New file. + + * gdb.*/*.exp: Call gdb_expect instead of expect. + + * lib/gdb.exp(gdb_expect): New function. + Thu Feb 20 13:57:01 1997 Bob Manson <manson@charmed.cygnus.com> * lib/gdb.exp(gdb_init): New function. diff --git a/gdb/testsuite/config/.Sanitize b/gdb/testsuite/config/.Sanitize index 6484edb..0be60aa 100644 --- a/gdb/testsuite/config/.Sanitize +++ b/gdb/testsuite/config/.Sanitize @@ -62,6 +62,7 @@ slite.exp udi.exp unix.exp unknown.exp +vr4300.exp vx.exp vxworks.exp vxworks29k.exp diff --git a/gdb/testsuite/config/sparclet-old.exp b/gdb/testsuite/config/sparclet-old.exp index 41f5c2f..0b4e4e8 100644 --- a/gdb/testsuite/config/sparclet-old.exp +++ b/gdb/testsuite/config/sparclet-old.exp @@ -69,18 +69,18 @@ proc gdb_run_cmd {} { send_gdb "target $protocol udp [target_info netport]\n"; } - expect { - -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" { + gdb_expect { + -re "A program is being debug.*Kill it.*y or n. $" { send_gdb "y\n" exp_continue } - -i $gdb_spawn_id -re "Remote target.*$gdb_prompt $" { } - -i $gdb_spawn_id -re ".*SPARCLET appears to be alive.*$gdb_prompt $" { + -re "Remote target.*$gdb_prompt $" { } + -re ".*SPARCLET appears to be alive.*$gdb_prompt $" { if $verbose>1 then { send_user "Set target to $targetname\n" } } - -i $gdb_spawn_id timeout { + timeout { set timeout 10 verbose "Timeout is now $timeout seconds" 2 perror "Couldn't set SPARCLET target." @@ -89,36 +89,36 @@ proc gdb_run_cmd {} { } send_gdb "disable\n"; - expect { - -i $gdb_spawn_id -re ".*$gdb_prompt $" { + gdb_expect { + -re ".*$gdb_prompt $" { verbose "Breakpoints disabled" 2 } - -i $gdb_spawn_id timeout { + timeout { perror "(timeout) disabling breakpoints"; return -1 } - -i $gdb_spawn_id default { + default { perror "error disabling breakpoints"; } } send_gdb "run\n"; - expect { - -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" { + gdb_expect { + -re "A program is being debug.*Kill it.*y or n. $" { send_gdb "y\n" exp_continue } - -i $gdb_spawn_id -re "The program being debugged .*y or n. $" { + -re "The program being debugged .*y or n. $" { send_gdb "y\n" exp_continue } - -i $gdb_spawn_id -re ".*Starting program:.*$" { + -re ".*Starting program:.*$" { verbose "Starting remote stub succeeded" } - -i $gdb_spawn_id timeout { + timeout { perror "(timeout) starting the remote stub" ; return -1 } - -i $gdb_spawn_id default { + default { perror "error starting the remote stub"; } } @@ -127,34 +127,34 @@ proc gdb_run_cmd {} { sleep 1; send_gdb "" verbose "Sent ^C^C" - expect { - -i $gdb_spawn_id -re ".*Give up .and stop debugging it.*$" { + gdb_expect { + -re ".*Give up .and stop debugging it.*$" { send_gdb "y\n" exp_continue } - -i $gdb_spawn_id -re ".*$gdb_prompt $" { + -re ".*$gdb_prompt $" { verbose "interrupting remote stub succeeded" } - -i $gdb_spawn_id timeout { + timeout { perror "(timeout) interrupting the remote stub"; return -1 } - -i $gdb_spawn_id default { + default { perror "error interrupting the remote stub"; } } if [target_info exists gdb_serial] { send_gdb "target remote [target_info gdb_serial]\n" - expect { - -i $gdb_spawn_id -re ".*Kill it?.*y or n.*" { + gdb_expect { + -re ".*Kill it?.*y or n.*" { send_gdb "y\n"; exp_continue } - -i $gdb_spawn_id -re ".*$gdb_prompt $" { + -re ".*$gdb_prompt $" { verbose "connected to stub at [target_info gdb_serial]" 2 } - -i $gdb_spawn_id timeout { + timeout { set timeout 10 verbose "Timeout is now $timeout seconds" 2 perror "Couldn't set remote target." @@ -164,15 +164,15 @@ proc gdb_run_cmd {} { } send_gdb "enable\n"; - expect { - -i $gdb_spawn_id -re ".*$gdb_prompt $" { + gdb_expect { + -re ".*$gdb_prompt $" { verbose "Breakpoints enabled" 2 } - -i $gdb_spawn_id timeout { + timeout { perror "(timeout) enabling breakpoints"; return -1 } - -i $gdb_spawn_id default { + default { perror "error enabling breakpoints"; } } @@ -206,18 +206,18 @@ proc gdb_load { arg } { # get the stub-based loader for faster loading send_gdb "file [target_info gdb_loader]\n" - expect { - -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" { + gdb_expect { + -re "A program is being debug.*Kill it.*y or n. $" { send_gdb "y\n" exp_continue } - -i $gdb_spawn_id -re "Load new symbol table.*y or n. $" { + -re "Load new symbol table.*y or n. $" { send_gdb "y\n" exp_continue } - -i $gdb_spawn_id -re "Reading symbols from.*done..*$gdb_prompt $" {} - -i $gdb_spawn_id -re "$gdb_prompt $" { perror "GDB couldn't find loader" } - -i $gdb_spawn_id timeout { + -re "Reading symbols from.*done..*$gdb_prompt $" {} + -re "$gdb_prompt $" { perror "GDB couldn't find loader" } + timeout { perror "(timeout) read symbol file" ; return -1 } @@ -234,14 +234,14 @@ proc gdb_load { arg } { set targetname [target_info netport]; send_gdb "target $protocol udp [target_info netport]\n"; } - expect { - -i $gdb_spawn_id -re "Remote target.*$gdb_prompt $" { } - -i $gdb_spawn_id -re ".*SPARCLET appears to be alive.*$gdb_prompt $" { + gdb_expect { + -re "Remote target.*$gdb_prompt $" { } + -re ".*SPARCLET appears to be alive.*$gdb_prompt $" { if $verbose>1 then { send_user "Set target to $targetname\n" } } - -i $gdb_spawn_id timeout { + timeout { set timeout 10 verbose "Timeout is now $timeout seconds" 2 perror "Couldn't set SPARCLET target." @@ -250,23 +250,23 @@ proc gdb_load { arg } { } send_gdb "run\n"; - expect { - -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" { + gdb_expect { + -re "A program is being debug.*Kill it.*y or n. $" { send_gdb "y\n" exp_continue } - -i $gdb_spawn_id -re "The program being debugged .*y or n. $" { + -re "The program being debugged .*y or n. $" { send_gdb "y\n" exp_continue } - -i $gdb_spawn_id -re ".*Starting program:.*loader.*$" { + -re ".*Starting program:.*loader.*$" { verbose "Starting loader succeeded" } - -i $gdb_spawn_id timeout { + timeout { perror "(timeout) starting the loader" ; return -1 } - -i $gdb_spawn_id default { + default { perror "error starting the loader"; } } @@ -275,19 +275,19 @@ proc gdb_load { arg } { sleep 1; send_gdb "" verbose "Sent ^C^C" - expect { - -i $gdb_spawn_id -re ".*Give up .and stop debugging it.*$" { + gdb_expect { + -re ".*Give up .and stop debugging it.*$" { send_gdb "y\n" exp_continue } - -i $gdb_spawn_id -re ".*$gdb_prompt $" { + -re ".*$gdb_prompt $" { verbose "Running loader succeeded" } - -i $gdb_spawn_id timeout { + timeout { perror "(timeout) interrupting the loader" ; return -1 } - -i $gdb_spawn_id default { + default { perror "error interrupting the loader"; } } @@ -295,18 +295,18 @@ proc gdb_load { arg } { # Now ready to actually load the file: send_gdb "file $arg\n" - expect { - -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" { + gdb_expect { + -re "A program is being debug.*Kill it.*y or n. $" { send_gdb "y\n" exp_continue } - -i $gdb_spawn_id -re "Load new symbol table.*y or n. $" { + -re "Load new symbol table.*y or n. $" { send_gdb "y\n" exp_continue } - -i $gdb_spawn_id -re "Reading symbols from.*done..*$gdb_prompt $" {} - -i $gdb_spawn_id -re "$gdb_prompt $" { perror "GDB couldn't read file" } - -i $gdb_spawn_id timeout { + -re "Reading symbols from.*done..*$gdb_prompt $" {} + -re "$gdb_prompt $" { perror "GDB couldn't read file" } + timeout { perror "(timeout) read symbol file" ; return -1 } @@ -314,15 +314,15 @@ proc gdb_load { arg } { if [target_info exists gdb_serial] { send_gdb "target remote [target_info gdb_serial]\n" - expect { - -i $gdb_spawn_id -re ".*Kill it?.*y or n.*" { + gdb_expect { + -re ".*Kill it?.*y or n.*" { send_gdb "y\n"; exp_continue } - -i $gdb_spawn_id -re ".*$gdb_prompt $" { + -re ".*$gdb_prompt $" { verbose "Set remote target to [target_info serial]" 2 } - -i $gdb_spawn_id timeout { + timeout { set timeout 10 verbose "Timeout is now $timeout seconds" 2 perror "Couldn't set remote target." @@ -339,18 +339,18 @@ proc gdb_load { arg } { verbose "Loading $arg into $GDB" 2 set timeout 1200 verbose "Timeout is now $timeout seconds" 2 - expect { - -i $gdb_spawn_id -re "Loading.*$gdb_prompt $" { + gdb_expect { + -re "Loading.*$gdb_prompt $" { verbose "Loaded $arg into $GDB" 1 set timeout 60 verbose "Timeout is now $timeout seconds" 2 } - -i $gdb_spawn_id -re "$gdb_prompt $" { + -re "$gdb_prompt $" { if $verbose>1 then { perror "GDB couldn't load." } } - -i $gdb_spawn_id timeout { + timeout { if $verbose>1 then { perror "Timed out trying to load $arg." } @@ -379,18 +379,18 @@ proc gdb_load { arg } { send_gdb "target $protocol udp [target_info netport]\n"; } - expect { - -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" { + gdb_expect { + -re "A program is being debug.*Kill it.*y or n. $" { send_gdb "y\n" exp_continue } - -i $gdb_spawn_id -re "Remote target.*$gdb_prompt $" { } - -i $gdb_spawn_id -re ".*SPARCLET appears to be alive.*$gdb_prompt $" { + -re "Remote target.*$gdb_prompt $" { } + -re ".*SPARCLET appears to be alive.*$gdb_prompt $" { if $verbose>1 then { send_user "Set target to $targetname\n" } } - -i $gdb_spawn_id timeout { + timeout { set timeout 10 verbose "Timeout is now $timeout seconds" 2 perror "Couldn't set SPARCLET target." @@ -399,23 +399,23 @@ proc gdb_load { arg } { } send_gdb "run\n"; - expect { - -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" { + gdb_expect { + -re "A program is being debug.*Kill it.*y or n. $" { send_gdb "y\n" exp_continue } - -i $gdb_spawn_id -re "The program being debugged .*y or n. $" { + -re "The program being debugged .*y or n. $" { send_gdb "y\n" exp_continue } - -i $gdb_spawn_id -re ".*Starting program:.*$" { + -re ".*Starting program:.*$" { verbose "Starting remote stub succeeded" } - -i $gdb_spawn_id timeout { + timeout { perror "(timeout) starting the remote stub" ; return -1 } - -i $gdb_spawn_id default { + default { perror "error starting the remote stub"; } } @@ -424,34 +424,34 @@ proc gdb_load { arg } { sleep 1; send_gdb "" verbose "Sent ^C^C" - expect { - -i $gdb_spawn_id -re ".*Give up .and stop debugging it.*$" { + gdb_expect { + -re ".*Give up .and stop debugging it.*$" { send_gdb "y\n" exp_continue } - -i $gdb_spawn_id -re ".*$gdb_prompt $" { + -re ".*$gdb_prompt $" { verbose "interrupting remote stub succeeded" } - -i $gdb_spawn_id timeout { + timeout { perror "(timeout) interrupting the remote stub"; return -1 } - -i $gdb_spawn_id default { + default { perror "error interrupting the remote stub"; } } if [target_info exists gdb_serial] { send_gdb "target remote [target_info gdb_serial]\n" - expect { - -i $gdb_spawn_id -re ".*Kill it?.*y or n.*" { + gdb_expect { + -re ".*Kill it?.*y or n.*" { send_gdb "y\n"; exp_continue } - -i $gdb_spawn_id -re ".*$gdb_prompt $" { + -re ".*$gdb_prompt $" { verbose "connected to stub at [target_info gdb_serial]" 2 } - -i $gdb_spawn_id timeout { + timeout { set timeout 10 verbose "Timeout is now $timeout seconds" 2 perror "Couldn't set remote target." diff --git a/gdb/testsuite/config/sparclet.exp b/gdb/testsuite/config/sparclet.exp index dc6199d..6c7832e 100644 --- a/gdb/testsuite/config/sparclet.exp +++ b/gdb/testsuite/config/sparclet.exp @@ -47,9 +47,9 @@ proc gdb_start { } { if [target_info exists baud] { send_gdb "set remotebaud [target_info baud]\n" - expect { - -i $gdb_spawn_id -re ".*$gdb_prompt" { } - -i $gdb_spawn_id default { + gdb_expect { + -re ".*$gdb_prompt" { } + default { perror "Error setting baud rate." return -1; } @@ -74,31 +74,31 @@ proc gdb_sparclet_startup { } { set is_running_stub 0; send_gdb "target sparclet [target_info serial]\n"; - expect { - -i $gdb_spawn_id -re ".*already.*y or n." { + gdb_expect { + -re ".*already.*y or n." { gdb_send "y\n"; exp_continue; } - -i $gdb_spawn_id -re "Remote target.*connected to.*$gdb_prompt" { } - -i $gdb_spawn_id timeout { + -re "Remote target.*connected to.*$gdb_prompt" { } + timeout { verbose "timed out, checking if stub is already running" set timeout 10 send_gdb "\003"; - expect { - -i $gdb_spawn_id -re ".*$gdb_prompt" { + gdb_expect { + -re ".*$gdb_prompt" { } - -i $gdb_spawn_id default { + default { perror "sparclet board isn't responding"; return -1; } } send_gdb "target remote [target_info gdb_serial]\n"; - expect { - -i $gdb_spawn_id -re ".*Remote debugging.*$gdb_prompt" { + gdb_expect { + -re ".*Remote debugging.*$gdb_prompt" { verbose "stub is already running" set is_running_stub 1; } - -i $gdb_spawn_id default { + default { perror "sparclet board isn't responding"; return -1; } @@ -114,27 +114,27 @@ proc gdb_sparclet_startup { } { } set loader "loader"; send_gdb "file $loader\n"; - expect { - -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" { + gdb_expect { + -re "A program is being debug.*Kill it.*y or n. $" { send_gdb "y\n" exp_continue } - -i $gdb_spawn_id -re "Load new symbol table.*y or n. $" { + -re "Load new symbol table.*y or n. $" { send_gdb "y\n" exp_continue } - -i $gdb_spawn_id -re "Reading symbols from.*done..*$gdb_prompt $" {} - -i $gdb_spawn_id -re "$gdb_prompt $" { perror "GDB couldn't find loader" } - -i $gdb_spawn_id timeout { + -re "Reading symbols from.*done..*$gdb_prompt $" {} + -re "$gdb_prompt $" { perror "GDB couldn't find loader" } + timeout { perror "(timeout) read symbol file" ; return -1 } } send_gdb "target [target_info gdb_protocol] [target_info serial]\n"; - expect { - -i $gdb_spawn_id -re "Remote target.*connected to.*$gdb_prompt" { } - -i $gdb_spawn_id default { + gdb_expect { + -re "Remote target.*connected to.*$gdb_prompt" { } + default { perror "Error reconnecting to sparclet."; return -1; } @@ -144,18 +144,18 @@ proc gdb_sparclet_startup { } { verbose "Loading $loader into $GDB" 2 set timeout 1200 verbose "Timeout is now $timeout seconds" 2 - expect { - -i $gdb_spawn_id -re "Loading.*$gdb_prompt $" { + gdb_expect { + -re "Loading.*$gdb_prompt $" { verbose "Loaded $loader into $GDB" 1 set timeout 60 verbose "Timeout is now $timeout seconds" 2 } - -i $gdb_spawn_id -re "$gdb_prompt $" { + -re "$gdb_prompt $" { if $verbose>1 then { perror "GDB couldn't load." } } - -i $gdb_spawn_id timeout { + timeout { if $verbose>1 then { perror "Timed out trying to load $arg." } @@ -163,23 +163,23 @@ proc gdb_sparclet_startup { } { } send_gdb "run\n"; - expect { - -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" { + gdb_expect { + -re "A program is being debug.*Kill it.*y or n. $" { send_gdb "y\n" exp_continue } - -i $gdb_spawn_id -re "The program being debugged .*y or n. $" { + -re "The program being debugged .*y or n. $" { send_gdb "y\n" exp_continue } - -i $gdb_spawn_id -re ".*Starting program:.*loader.*$" { + -re ".*Starting program:.*loader.*$" { verbose "Starting loader succeeded" } - -i $gdb_spawn_id timeout { + timeout { perror "(timeout) starting the loader" ; return -1 } - -i $gdb_spawn_id default { + default { perror "error starting the loader"; } } @@ -188,19 +188,19 @@ proc gdb_sparclet_startup { } { sleep 1; send_gdb "" verbose "Sent ^C^C" - expect { - -i $gdb_spawn_id -re ".*Give up .and stop debugging it.*$" { + gdb_expect { + -re ".*Give up .and stop debugging it.*$" { send_gdb "y\n" exp_continue } - -i $gdb_spawn_id -re ".*$gdb_prompt $" { + -re ".*$gdb_prompt $" { verbose "Running loader succeeded" } - -i $gdb_spawn_id timeout { + timeout { perror "(timeout) interrupting the loader" ; return -1 } - -i $gdb_spawn_id default { + default { perror "error interrupting the loader"; } } @@ -217,16 +217,16 @@ proc gdb_run_cmd { args } { gdb_breakpoint exit; send_gdb "set \$fp=0\n"; - expect { - -i $gdb_spawn_id -re ".*$gdb_prompt" { } + gdb_expect { + -re ".*$gdb_prompt" { } } send_gdb "jump start\n"; - expect { - -i $gdb_spawn_id -re ".*y or n. $" { + gdb_expect { + -re ".*y or n. $" { send_gdb "y\n" } - -i $gdb_spawn_id -re "Continuing at.*\[\r\n\]" { } - -i $gdb_spawn_id default { + -re "Continuing at.*\[\r\n\]" { } + default { return "failed" } } @@ -258,18 +258,18 @@ proc gdb_load { arg } { } send_gdb "file $arg\n" - expect { - -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" { + gdb_expect { + -re "A program is being debug.*Kill it.*y or n. $" { send_gdb "y\n" exp_continue } - -i $gdb_spawn_id -re "Load new symbol table.*y or n. $" { + -re "Load new symbol table.*y or n. $" { send_gdb "y\n" exp_continue } - -i $gdb_spawn_id -re "Reading symbols from.*done..*$gdb_prompt $" {} - -i $gdb_spawn_id -re "$gdb_prompt $" { perror "GDB couldn't read file" } - -i $gdb_spawn_id timeout { + -re "Reading symbols from.*done..*$gdb_prompt $" {} + -re "$gdb_prompt $" { perror "GDB couldn't read file" } + timeout { perror "(timeout) read symbol file" ; return -1 } @@ -277,15 +277,15 @@ proc gdb_load { arg } { if [target_info exists gdb_serial] { send_gdb "target remote [target_info gdb_serial]\n" - expect { - -i $gdb_spawn_id -re ".*Kill it?.*y or n.*" { + gdb_expect { + -re ".*Kill it?.*y or n.*" { send_gdb "y\n"; exp_continue } - -i $gdb_spawn_id -re ".*$gdb_prompt $" { + -re ".*$gdb_prompt $" { verbose "Set remote target to [target_info serial]" 2 } - -i $gdb_spawn_id timeout { + timeout { set timeout 10 verbose "Timeout is now $timeout seconds" 2 perror "Couldn't set remote target." @@ -302,27 +302,27 @@ proc gdb_load { arg } { verbose "Loading $arg into $GDB" 2 set timeout 1200 verbose "Timeout is now $timeout seconds" 2 - expect { - -i $gdb_spawn_id -re "Loading.*$gdb_prompt $" { + gdb_expect { + -re "Loading.*$gdb_prompt $" { verbose "Loaded $arg into $GDB" 1 set timeout 60 verbose "Timeout is now $timeout seconds" 2 } - -i $gdb_spawn_id -re "$gdb_prompt $" { + -re "$gdb_prompt $" { if $verbose>1 then { perror "GDB couldn't load." } } - -i $gdb_spawn_id timeout { + timeout { if $verbose>1 then { perror "Timed out trying to load $arg." } } } send_gdb "list main\n"; - expect { - -i $gdb_spawn_id -re ".*$gdb_prompt" { } - -i $gdb_spawn_id default { + gdb_expect { + -re ".*$gdb_prompt" { } + default { perror "command for list main never completed"; return -1; } diff --git a/gdb/testsuite/config/udi.exp b/gdb/testsuite/config/udi.exp index 1f4fcb2..0c32de5 100644 --- a/gdb/testsuite/config/udi.exp +++ b/gdb/testsuite/config/udi.exp @@ -33,10 +33,10 @@ proc gdb_target_udi { } { set targetname [target_info mondfe,name]; # set targets hostname - send "target udi $targetname\n" + send_gdb "target udi $targetname\n" set timeout 60 verbose "Timeout is now $timeout seconds" 2 - expect { + gdb_expect { -re "target udi $targetname\[\r\n\]+" { exp_continue } diff --git a/gdb/testsuite/config/vr4300.exp b/gdb/testsuite/config/vr4300.exp new file mode 100644 index 0000000..1a2f7a9 --- /dev/null +++ b/gdb/testsuite/config/vr4300.exp @@ -0,0 +1 @@ +load_lib ../config/monitor.exp diff --git a/gdb/testsuite/gdb.base/a1-selftest.exp b/gdb/testsuite/gdb.base/a1-selftest.exp index 128e302..c7f395d 100644 --- a/gdb/testsuite/gdb.base/a1-selftest.exp +++ b/gdb/testsuite/gdb.base/a1-selftest.exp @@ -53,7 +53,7 @@ proc do_steps_and_nexts {} { for {set count 0} {$count < 20} {incr count} { send "list\n" - expect { + gdb_expect { -re ".*symarg = NULL.*$gdb_prompt $" { set description "step over symarg initialization" set command "step" @@ -144,7 +144,7 @@ proc do_steps_and_nexts {} { } } send "$command\n" - expect { + gdb_expect { -re ".*No such file or directory.\r\n$gdb_prompt $" { fail "$description (no source available)" } @@ -167,6 +167,7 @@ proc test_with_self { executable } { global det_file global decimal global timeout + global gdb_spawn_id # load yourself into the debugger # This can take a relatively long time, particularly for testing where @@ -220,7 +221,7 @@ proc test_with_self { executable } { set description "run until breakpoint at main" send "run -nw\n" - expect { + gdb_expect { -re "Starting program.*Breakpoint \[0-9\]+,.*main .argc.*argv.* at .*main.c:.*$gdb_prompt $" { pass "$description" } @@ -249,7 +250,7 @@ proc test_with_self { executable } { # do we have a version number ? send "print version\n" - expect { + gdb_expect { -re ".\[0-9\]+ = +0x.*\[0-9.\]+.*$gdb_prompt $" { pass "printed version" } @@ -272,7 +273,7 @@ proc test_with_self { executable } { setup_xfail "alpha-*-*" "hppa*-*-*" "mips-*-*" set description "step into xmalloc call" send "step\n" - expect { + gdb_expect { -re "xmalloc.*size=.*at.*utils.c.*$gdb_prompt $" { pass "$description" } @@ -292,7 +293,7 @@ proc test_with_self { executable } { # start the "xgdb" process send "continue\n" - expect { + gdb_expect { -re "GNU gdb \[0-9\.\]*.* Copyright \[0-9\]* Free Software Foundation, Inc.* GDB is free software, covered by the GNU General Public License, and you are.* @@ -312,7 +313,7 @@ GDB.*Copyright \[0-9\]+ Free Software Foundation, Inc..*$gdb_prompt $"\ # set xgdb prompt so we can tell which is which send "set prompt (xgdb) \n" - expect { + gdb_expect { -re "\[(\]xgdb\[)\].*\[(\]xgdb\[)\] $" { pass "Set xgdb prompt" } -re ".*$gdb_prompt $" { fail "Set xgdb prompt" } default { fail "(timeout) Set xgdb prompt" } @@ -321,7 +322,7 @@ GDB.*Copyright \[0-9\]+ Free Software Foundation, Inc..*$gdb_prompt $"\ # kill the xgdb process set description "send ^C to child process" send "\003" - expect { + gdb_expect { -re "Program received signal SIGINT.*$gdb_prompt $" { pass "$description" } @@ -335,7 +336,7 @@ GDB.*Copyright \[0-9\]+ Free Software Foundation, Inc..*$gdb_prompt $"\ set description "send SIGINT signal to child process" send "signal SIGINT\n" - expect { + gdb_expect { -re "Continuing with signal SIGINT.*$gdb_prompt $" { pass "$description" } @@ -355,7 +356,7 @@ GDB.*Copyright \[0-9\]+ Free Software Foundation, Inc..*$gdb_prompt $"\ setup_xfail "i*86-pc-linuxaout-gnu" "hppa*-*-hpux*" set description "backtrace through signal handler" send "backtrace\n" - expect { + gdb_expect { -re "#0.*read.*in main \\(.*\\) at .*main\\.c.*$gdb_prompt $" { pass "$description" } diff --git a/gdb/testsuite/gdb.base/bitfields.exp b/gdb/testsuite/gdb.base/bitfields.exp index 158c668..eb550fe 100644 --- a/gdb/testsuite/gdb.base/bitfields.exp +++ b/gdb/testsuite/gdb.base/bitfields.exp @@ -43,7 +43,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb proc bitfield_uniqueness {} { global decimal global hex - global prompt + global gdb_prompt global srcfile if [gdb_test "break break1" "Break.* at $hex: file .*$srcfile, line $decimal\\."] { @@ -51,8 +51,8 @@ proc bitfield_uniqueness {} { } gdb_run_cmd - expect { - -re "Break.*break1 \\(\\) at .*$srcfile:$decimal.*$prompt $" { + gdb_expect { + -re "Break.*break1 \\(\\) at .*$srcfile:$decimal.*$gdb_prompt $" { pass "running to break1" } timeout { fail "(timeout) running to break1"; return } @@ -131,7 +131,7 @@ proc bitfield_uniqueness {} { proc bitfield_containment {} { global decimal global hex - global prompt + global gdb_prompt global srcfile delete_breakpoints @@ -141,8 +141,8 @@ proc bitfield_containment {} { } gdb_run_cmd - expect { - -re "Break.*break2 \\(\\) at .*$srcfile:$decimal.*$prompt $" { + gdb_expect { + -re "Break.*break2 \\(\\) at .*$srcfile:$decimal.*$gdb_prompt $" { pass "running to break2" } timeout { fail "(timeout) running to break2"; return } @@ -171,7 +171,7 @@ proc bitfield_containment {} { proc bitfield_unsignedness {} { global decimal global hex - global prompt + global gdb_prompt global srcfile delete_breakpoints @@ -181,8 +181,8 @@ proc bitfield_unsignedness {} { } gdb_run_cmd - expect { - -re "Break.*break3 \\(\\) at .*$srcfile:$decimal.*$prompt $" { + gdb_expect { + -re "Break.*break3 \\(\\) at .*$srcfile:$decimal.*$gdb_prompt $" { pass "running to break3" } timeout { fail "(timeout) running to break3"; return } @@ -203,7 +203,7 @@ proc bitfield_unsignedness {} { proc bitfield_signedness {} { global decimal global hex - global prompt + global gdb_prompt global srcfile delete_breakpoints @@ -213,8 +213,8 @@ proc bitfield_signedness {} { } gdb_run_cmd - expect { - -re "Break.*break4 \\(\\) at .*$srcfile:$decimal.*$prompt $" { + gdb_expect { + -re "Break.*break4 \\(\\) at .*$srcfile:$decimal.*$gdb_prompt $" { pass "running to break4" } timeout { fail "(timeout) running to break4"; return } @@ -231,15 +231,15 @@ proc bitfield_signedness {} { # Determine if the target has signed bitfields so we can xfail the # the signed bitfield tests if it doesn't. send_gdb "print i\n" - expect { - -re ".* = -256.*$prompt $" { + gdb_expect { + -re ".* = -256.*$gdb_prompt $" { pass "determining signed-ness of bitfields" } - -re ".* = 256.*$prompt $" { + -re ".* = 256.*$gdb_prompt $" { pass "determining signed-ness of bitfields" setup_xfail "*-*-*" } - -re ".*$prompt $" { + -re ".*$gdb_prompt $" { fail "determining signed-ness of bitfields" return } @@ -263,7 +263,7 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} -send_gdb "set print sevenbit-strings\n" ; expect -re "$prompt $" +send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $" bitfield_uniqueness if [istarget "mips-idt-*"] then { # Restart because IDT/SIM runs out of file descriptors. diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index 099fd27..d9c0826 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -57,10 +57,10 @@ if [target_info exists gdb_stub] { # for general use elsewhere. send_gdb "delete breakpoints\n" -expect { - -i $gdb_spawn_id -re "Delete all breakpoints.*$" { +gdb_expect { + -re "Delete all breakpoints.*$" { send_gdb "y\n" - expect { + gdb_expect { -re "$gdb_prompt $" { setup_xfail "i*86-*-sysv4*" "sparc-sun-sunos4*" "alpha-dec-osf*" "mips-dec-ultrix*" fail "Delete all breakpoints when none (unexpected prompt)" @@ -68,7 +68,7 @@ expect { timeout { fail "Delete all breakpoints when none (timeout after unexpected prompt)" } } } - -i $gdb_spawn_id -re ".*$gdb_prompt $" { pass "Delete all breakpoints when none" } + -re ".*$gdb_prompt $" { pass "Delete all breakpoints when none" } timeout { fail "Delete all breakpoints when none (timeout)" } } @@ -146,7 +146,7 @@ if ![target_info exists use_gdb_stub] { } else { send_gdb "run\n" } - expect { + gdb_expect { -re "The program .* has been started already.*y or n. $" { send_gdb "y\n" exp_continue @@ -204,7 +204,7 @@ gdb_test "tbreak $srcfile:factorial" "Breakpoint.*at.* file .*$srcfile, line.*" # test break at line number # send_gdb "tbreak 64\n" -expect { +gdb_expect { -re "Breakpoint.*at.* file .*$srcfile, line 64.*$gdb_prompt $" { pass "Temporary breakpoint line number" } -re ".*$gdb_prompt $" { pass "Temporary breakpoint line number" } timeout { fail "breakpoint line number (timeout)" } @@ -216,7 +216,7 @@ gdb_test "tbreak 60" "Breakpoint.*at.* file .*$srcfile, line 60.*" "Temporary br # test break at line number in file # send_gdb "tbreak $srcfile:70\n" -expect { +gdb_expect { -re "Breakpoint.*at.* file .*$srcfile, line 70.*$gdb_prompt $" { pass "Temporary breakpoint line number in file" } -re ".*$gdb_prompt $" { pass "Temporary breakpoint line number in file" } timeout { fail "Temporary breakpoint line number in file (timeout)" } @@ -245,7 +245,6 @@ proc test_clear_command {} { proc test_next_with_recursion {} { global gdb_prompt global decimal - global noresults global binfile if [istarget "d10v-*-*"] { @@ -272,7 +271,7 @@ proc test_next_with_recursion {} { } else { gdb_run_cmd } - expect { + gdb_expect { -re "Break.* factorial .value=6. .*$gdb_prompt $" {} timeout { fail "run to factorial(6) (timeout)" ; return } } @@ -280,7 +279,7 @@ proc test_next_with_recursion {} { # Continue until we call factorial recursively with 5. send_gdb "continue\n" - expect { + gdb_expect { -re "Continuing.*Break.* factorial .value=5. .*$gdb_prompt $" {} timeout { fail "continue to factorial(5) (timeout)" ; return } } @@ -296,7 +295,7 @@ proc test_next_with_recursion {} { # we will be performing with 4. send_gdb "next\n" - expect { + gdb_expect { -re ".* factorial .value - 1.;.*$gdb_prompt $" {} timeout { fail "next to recursive call (timeout)" ; return } } @@ -322,7 +321,7 @@ proc test_next_with_recursion {} { "backtrace from factorial(5.1)"] if { $result != 0 } { return } - if { $noresults == 1 } { return } + if [target_info exists gdb,noresults] { return } if [target_info exists use_gdb_stub] { gdb_breakpoint "exit" gdb_test "continue" "Continuing..*Breakpoint .*exit .code=0.*" "continue until exit in recursive next test" @@ -344,5 +343,5 @@ if [istarget "*-*-vxworks*"] { set timeout 10 verbose "Timeout is now $timeout seconds" 2 send_gdb "set args main\n" - expect -re ".*$gdb_prompt $" {} + gdb_expect -re ".*$gdb_prompt $" {} } diff --git a/gdb/testsuite/gdb.base/callfuncs.exp b/gdb/testsuite/gdb.base/callfuncs.exp index 71286e4..ec5ea62 100644 --- a/gdb/testsuite/gdb.base/callfuncs.exp +++ b/gdb/testsuite/gdb.base/callfuncs.exp @@ -63,13 +63,13 @@ proc set_lang_c {} { global gdb_prompt send_gdb "set language c\n" - expect { + gdb_expect { -re ".*$gdb_prompt $" {} timeout { fail "set language c (timeout)" ; return 0 } } send_gdb "show language\n" - expect { + gdb_expect { -re ".* source language is \"c\".*$gdb_prompt $" { pass "set language to \"c\"" return 1 @@ -95,6 +95,8 @@ proc set_lang_c {} { proc do_function_calls {} { global prototypes global gcc_compiled + # We need to up this because this can be really slow on some boards. + set timeout 60; gdb_test "p t_char_values(0,0)" " = 0" gdb_test "p t_char_values('a','b')" " = 1" diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp index 5932d24..5094f5f 100644 --- a/gdb/testsuite/gdb.base/commands.exp +++ b/gdb/testsuite/gdb.base/commands.exp @@ -42,7 +42,7 @@ gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} proc gdbvar_simple_if_test {} { - global prompt + global gdb_prompt gdb_test "set \$foo = 0" "" "set foo in gdbvar_simple_if_test" # All this test should do is print 0xdeadbeef once. @@ -52,7 +52,7 @@ proc gdbvar_simple_if_test {} { } proc gdbvar_simple_while_test {} { - global prompt + global gdb_prompt gdb_test "set \$foo = 5" "" "set foo in gdbvar_simple_while_test" # This test should print 0xfeedface five times. @@ -60,7 +60,7 @@ proc gdbvar_simple_while_test {} { } proc gdbvar_complex_if_while_test {} { - global prompt + global gdb_prompt gdb_test "set \$foo = 4" "" "set foo in gdbvar complex_if_while_test" # This test should alternate between 0xdeadbeef and 0xfeedface two times. @@ -68,7 +68,7 @@ proc gdbvar_complex_if_while_test {} { } proc progvar_simple_if_test {} { - global prompt + global gdb_prompt if [target_info exists gdb,noargs] { verbose "Skipping progvar_simple_if_test because of noargs." @@ -84,7 +84,7 @@ proc progvar_simple_if_test {} { } proc progvar_simple_while_test {} { - global prompt + global gdb_prompt if [target_info exists gdb,noargs] { verbose "Skipping progvar_simple_while_test because of noargs." @@ -98,7 +98,7 @@ proc progvar_simple_while_test {} { } proc progvar_complex_if_while_test {} { - global prompt + global gdb_prompt if [target_info exists gdb,noargs] { verbose "Skipping progvar_simple_if_while_test because of noargs." @@ -123,7 +123,7 @@ proc if_while_breakpoint_command_test {} { gdb_test "break factorial" "Breakpoint.*at.*" send_gdb "commands\n" - expect { + gdb_expect { -re "End with" { pass "commands in if_while_breakpoint_command_test" } @@ -184,12 +184,12 @@ proc breakpoint_command_test {} { # Test a simple user defined command (with arguments) proc user_defined_command_test {} { - global prompt + global gdb_prompt gdb_test "set \$foo = 4" "" "set foo in user_defined_command_test" send_gdb "define mycommand\n" - expect { + gdb_expect { -re "End with" { pass "define mycommand in user_defined_command_test" } diff --git a/gdb/testsuite/gdb.base/crossload.exp b/gdb/testsuite/gdb.base/crossload.exp index 020e238..c605c85 100644 --- a/gdb/testsuite/gdb.base/crossload.exp +++ b/gdb/testsuite/gdb.base/crossload.exp @@ -75,7 +75,7 @@ proc bfddefault {} { gdb_unload set file_loaded 0 send_gdb "file $objdir/$subdir/$binfile\n" - expect { + gdb_expect { -re "A program is being debugged already. Kill it.*y or n." { send_gdb "y\n" exp_continue @@ -136,7 +136,7 @@ proc bfdexplicit {} { } send_gdb "file $objdir/$subdir/$binfile\n" - expect { + gdb_expect { -re "A program is being debugged already. Kill it.*y or n." { send_gdb "y\n" exp_continue @@ -167,7 +167,7 @@ proc test_ptype_functions {} { global bfdformat global det_file send_gdb "ptype main\n" - expect { + gdb_expect { -re "type = int \[)(\]+\r\n$gdb_prompt $" {} timeout { fail "(timeout) $binfile ($bfdformat) function main" ; return } } diff --git a/gdb/testsuite/gdb.base/funcargs.exp b/gdb/testsuite/gdb.base/funcargs.exp index b9acdc6..fcfab5d 100644 --- a/gdb/testsuite/gdb.base/funcargs.exp +++ b/gdb/testsuite/gdb.base/funcargs.exp @@ -45,7 +45,7 @@ if [get_compiler_info ${binfile}] { # proc integral_args {} { - global prompt + global gdb_prompt global det_file global gcc_compiled global gdb_spawn_id @@ -64,12 +64,12 @@ proc integral_args {} { setup_xfail "a29k-*-udi" if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" } gdb_run_cmd - expect { - -i $gdb_spawn_id -re ".* call0a \\(c=97 'a', s=1, i=2, l=3\\) .*$prompt $" { + gdb_expect { + -re ".* call0a \\(c=97 'a', s=1, i=2, l=3\\) .*$gdb_prompt $" { pass "run to call0a" } - -i $gdb_spawn_id -re "$prompt $" { fail "run to call0a" ; return } - -i $gdb_spawn_id timeout { fail "(timeout) run to call0a" ; return } + -re "$gdb_prompt $" { fail "run to call0a" ; return } + timeout { fail "(timeout) run to call0a" ; return } } # Print each arg as a double check to see if we can print @@ -105,7 +105,7 @@ proc integral_args {} { # proc unsigned_integral_args {} { - global prompt + global gdb_prompt global det_file global gcc_compiled global gdb_spawn_id @@ -124,12 +124,12 @@ proc unsigned_integral_args {} { setup_xfail "a29k-*-udi" if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" } gdb_run_cmd - expect { - -i $gdb_spawn_id -re ".* call1a \\(uc=98 'b', us=6, ui=7, ul=8\\) .*$prompt $" { + gdb_expect { + -re ".* call1a \\(uc=98 'b', us=6, ui=7, ul=8\\) .*$gdb_prompt $" { pass "run to call1a" } - -i $gdb_spawn_id -re "$prompt $" { fail "run to call1a" ; return } - -i $gdb_spawn_id timeout { fail "(timeout) run to call1a" ; return } + -re "$gdb_prompt $" { fail "run to call1a" ; return } + timeout { fail "(timeout) run to call1a" ; return } } # Print each arg as a double check to see if we can print @@ -165,7 +165,7 @@ proc unsigned_integral_args {} { # proc float_and_integral_args {} { - global prompt + global gdb_prompt global det_file global gcc_compiled global gdb_spawn_id @@ -189,10 +189,10 @@ proc float_and_integral_args {} { setup_xfail "a29k-*-udi" if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" } gdb_run_cmd - expect { - -i $gdb_spawn_id -re ".* call2a \\(c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$prompt $" { pass "run to call2a" } - -i $gdb_spawn_id -re "$prompt $" { fail "run to call2a" ; return } - -i $gdb_spawn_id timeout { fail "(timeout) run to call2a" ; return } + gdb_expect { + -re ".* call2a \\(c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" { pass "run to call2a" } + -re "$gdb_prompt $" { fail "run to call2a" ; return } + timeout { fail "(timeout) run to call2a" ; return } } # Print each arg as a double check to see if we can print @@ -258,7 +258,7 @@ proc float_and_integral_args {} { # proc pointer_args {} { - global prompt + global gdb_prompt global hex global det_file global gdb_spawn_id @@ -276,10 +276,10 @@ proc pointer_args {} { # code is broken. setup_xfail "a29k-*-udi" gdb_run_cmd - expect { - -i $gdb_spawn_id -re ".* call3a \\(cp=$hex \"a\", sp=$hex, ip=$hex, lp=$hex\\) .*$prompt $" { pass "run to call3a" } - -i $gdb_spawn_id -re "$prompt $" { fail "run to call3a" ; return } - -i $gdb_spawn_id timeout { fail "(timeout) run to call3a" ; return } + gdb_expect { + -re ".* call3a \\(cp=$hex \"a\", sp=$hex, ip=$hex, lp=$hex\\) .*$gdb_prompt $" { pass "run to call3a" } + -re "$gdb_prompt $" { fail "run to call3a" ; return } + timeout { fail "(timeout) run to call3a" ; return } } gdb_test "print *cp" ".* = 97 'a'" @@ -315,7 +315,7 @@ proc pointer_args {} { # proc structs_by_reference {} { - global prompt + global gdb_prompt global hex global det_file global gdb_spawn_id @@ -332,12 +332,12 @@ proc structs_by_reference {} { # code is broken. setup_xfail "a29k-*-udi" gdb_run_cmd - expect { - -i $gdb_spawn_id -re ".* call4a \\(stp=$hex\\) .*$prompt $" { + gdb_expect { + -re ".* call4a \\(stp=$hex\\) .*$gdb_prompt $" { pass "run to call4a" } - -i $gdb_spawn_id -re "$prompt $" { fail "run to call4a" ; return } - -i $gdb_spawn_id timeout { fail "(timeout) run to call4a" ; return } + -re "$gdb_prompt $" { fail "run to call4a" ; return } + timeout { fail "(timeout) run to call4a" ; return } } gdb_test "print *stp" ".* = \{s1 = 101, s2 = 102\}" @@ -359,7 +359,7 @@ proc structs_by_reference {} { # proc structs_by_value {} { - global prompt + global gdb_prompt global hex global det_file global gdb_spawn_id @@ -376,12 +376,12 @@ proc structs_by_value {} { # code is broken. setup_xfail "a29k-*-udi" gdb_run_cmd - expect { - -i $gdb_spawn_id -re ".* call5a \\(st=\{s1 = 101, s2 = 102\}\\) .*$prompt $" { + gdb_expect { + -re ".* call5a \\(st=\{s1 = 101, s2 = 102\}\\) .*$gdb_prompt $" { pass "run to call5a" } - -i $gdb_spawn_id -re "$prompt $" { fail "run to call5a" ; return } - -i $gdb_spawn_id timeout { fail "(timeout) run to call5a" ; return } + -re "$gdb_prompt $" { fail "run to call5a" ; return } + timeout { fail "(timeout) run to call5a" ; return } } gdb_test "print st" ".* = \{s1 = 101, s2 = 102\}" @@ -403,7 +403,7 @@ proc structs_by_value {} { # proc discard_and_shuffle {} { - global prompt + global gdb_prompt global hex global decimal global det_file @@ -428,10 +428,10 @@ proc discard_and_shuffle {} { # code is broken. setup_xfail "a29k-*-udi" gdb_run_cmd - expect { - -i $gdb_spawn_id -re ".*Breakpoint $decimal, call6a .*$prompt $" { pass "run to call6a" } - -i $gdb_spawn_id -re "$prompt $" { fail "run to call6a" ; return } - -i $gdb_spawn_id timeout { fail "(timeout) run to call6a" ; return } + gdb_expect { + -re ".*Breakpoint $decimal, call6a .*$gdb_prompt $" { pass "run to call6a" } + -re "$gdb_prompt $" { fail "run to call6a" ; return } + timeout { fail "(timeout) run to call6a" ; return } } setup_xfail "rs6000-*-*" @@ -548,7 +548,7 @@ proc discard_and_shuffle {} { # proc shuffle_round_robin {} { - global prompt + global gdb_prompt global hex global decimal global det_file @@ -573,12 +573,12 @@ proc shuffle_round_robin {} { # code is broken. setup_xfail "a29k-*-udi" gdb_run_cmd - expect { - -i $gdb_spawn_id -re ".*Breakpoint $decimal, call7a .*$prompt $" { + gdb_expect { + -re ".*Breakpoint $decimal, call7a .*$gdb_prompt $" { pass "run to call7a" } - -i $gdb_spawn_id -re "$prompt $" { fail "run to call7a" ; return } - -i $gdb_spawn_id timeout { fail "(timeout) run to call7a" ; return } + -re "$gdb_prompt $" { fail "run to call7a" ; return } + timeout { fail "(timeout) run to call7a" ; return } } setup_xfail "i960-*-*" 1813 @@ -665,7 +665,7 @@ proc shuffle_round_robin {} { # proc recursive_structs_by_value {} { - global prompt + global gdb_prompt global hex global decimal global det_file @@ -678,10 +678,10 @@ proc recursive_structs_by_value {} { # Run; should stop at hitbottom and print actual arguments. # Print backtrace. gdb_run_cmd - expect { - -i $gdb_spawn_id -re ".*Breakpoint $decimal, hitbottom .*$prompt $" { pass "run to hitbottom" } - -i $gdb_spawn_id -re "$prompt $" { fail "run to hitbottom" ; return } - -i $gdb_spawn_id timeout { fail "(timeout) run to hitbottom" ; return } + gdb_expect { + -re ".*Breakpoint $decimal, hitbottom .*$gdb_prompt $" { pass "run to hitbottom" } + -re "$gdb_prompt $" { fail "run to hitbottom" ; return } + timeout { fail "(timeout) run to hitbottom" ; return } } if ![istarget sparclet-*-*] { @@ -713,7 +713,7 @@ proc funcargs_reload { } { # Test for accessing local stack variables in functions which call alloca # proc localvars_after_alloca { } { - global prompt + global gdb_prompt global hex global decimal global gcc_compiled @@ -745,7 +745,7 @@ proc localvars_after_alloca { } { } proc call_after_alloca { } { - global prompt + global gdb_prompt global hex global decimal global gcc_compiled @@ -772,7 +772,7 @@ proc call_after_alloca { } { # these use a funky `dyncall' mechanism which GDB needs to know about. # proc localvars_in_indirect_call { } { - global prompt + global gdb_prompt global hex global decimal global gcc_compiled @@ -814,19 +814,19 @@ proc localvars_in_indirect_call { } { # send_gdb "finish\n" - expect { - -i $gdb_spawn_id -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*First.*$prompt $" { + gdb_expect { + -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*First.*$gdb_prompt $" { send_gdb "step\n" exp_continue } - -i $gdb_spawn_id -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$prompt $" { + -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$gdb_prompt $" { pass "finish from indirectly called function" } - -i $gdb_spawn_id -re ".*$prompt $" { + -re ".*$gdb_prompt $" { fail "finish from indirectly called function" return } - -i $gdb_spawn_id default { fail "finish from indirectly called function" ; return } + default { fail "finish from indirectly called function" ; return } } if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" } @@ -841,7 +841,7 @@ proc localvars_in_indirect_call { } { # to handle trampolines. # proc test_stepping_over_trampolines { } { - global prompt + global gdb_prompt global hex global decimal global gdb_spawn_id @@ -851,18 +851,18 @@ proc test_stepping_over_trampolines { } { # Cater for gdb stopping in midline, see comment for finish above. send_gdb "finish\n" - expect { - -i $gdb_spawn_id -re "marker_call_with_trampolines ..;.*$prompt $" { + gdb_expect { + -re "marker_call_with_trampolines ..;.*$gdb_prompt $" { send_gdb "step\n" exp_continue } - -i $gdb_spawn_id -re "pointer_to_call_with_trampolines.*$prompt $" { + -re "pointer_to_call_with_trampolines.*$gdb_prompt $" { pass "finish from marker_call_with_trampolines" } - -i $gdb_spawn_id -re ".*$prompt $" { + -re ".*$gdb_prompt $" { fail "finish from marker_call_with_trampolines" } - -i $gdb_spawn_id default { fail "finish from marker_call_with_trampolines" ; return 0 } + default { fail "finish from marker_call_with_trampolines" ; return 0 } } # Try to step into the target function. @@ -878,19 +878,19 @@ proc test_stepping_over_trampolines { } { # or immediately transfer control back to main if optimizations # are performed. send_gdb "step\n" - expect { - -i $gdb_spawn_id -re "main .* at.*$prompt $" { + gdb_expect { + -re "main .* at.*$gdb_prompt $" { pass "stepping back to main from function called with trampolines" ; return 1 } - -i $gdb_spawn_id -re "\}.*End of call_with_trampolines.*$prompt $" { + -re "\}.*End of call_with_trampolines.*$gdb_prompt $" { send_gdb "step\n" exp_continue } - -i $gdb_spawn_id -re ".*$prompt $" { + -re ".*$gdb_prompt $" { fail "stepping back to main from function called with trampolines" } - -i $gdb_spawn_id default { fail "stepping back to main from function called with trampolines" ; return 0 } + default { fail "stepping back to main from function called with trampolines" ; return 0 } } } diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp index f718c99..e44ee29 100644 --- a/gdb/testsuite/gdb.base/list.exp +++ b/gdb/testsuite/gdb.base/list.exp @@ -29,6 +29,9 @@ set bug_id 0 set testfile "list" set binfile ${objdir}/${subdir}/${testfile} +# There are some rather large lines in some of these source files. +set match_max 10000; + # Need to download the header to the host. remote_download host ${srcdir}/${subdir}/list0.h list0.h @@ -167,7 +170,7 @@ proc test_list_filename_and_number {} { set testcnt 0 send_gdb "list list0.c:1\n" - expect { + gdb_expect { -re "1\[ \t\]+#include \"list0.h\".*5\[ \t\]+int x;\r\n$gdb_prompt $" { incr testcnt } @@ -175,7 +178,7 @@ proc test_list_filename_and_number {} { timeout { fail "list list0.c:1 (timeout)" ; return } } send_gdb "list list0.c:10\n" - expect { + gdb_expect { -re "5\[ \t\]+int x;.*14\[ \t\]+foo .x\[+)\]+;\r\n$gdb_prompt $" { incr testcnt } @@ -183,7 +186,7 @@ proc test_list_filename_and_number {} { timeout { fail "list list.c:10 (timeout)" ; return } } send_gdb "list list1.c:1\n" - expect { + gdb_expect { -re "1\[ \t\]+void.*5\[ \t\]+printf \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt } @@ -191,7 +194,7 @@ proc test_list_filename_and_number {} { timeout { fail "list list1.c:1 (timeout)" ; return } } send_gdb "list list1.c:12\n" - expect { + gdb_expect { -re "7\[ \t\]+long_line \[(\]+.*\[)\]+;.*14\[ \t\]+\}\r\n.*$gdb_prompt $" { incr testcnt } @@ -232,28 +235,28 @@ proc test_list_forward {} { set testcnt 0 send_gdb "list list0.c:10\n" - expect { + gdb_expect { -re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt } -re ".*$gdb_prompt $" { fail "list list0.c:10" ; return } timeout { fail "list list0.c:10 (timeout)" ; return } } send_gdb "list\n" - expect { + gdb_expect { -re "15\[ \t\]+foo \[(\]+.*\[)\]+;.*24\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt } -re ".*$gdb_prompt $" { fail "list 15-24" ; return } timeout { fail "list 15-24 (timeout)" ; return } } send_gdb "list\n" - expect { + gdb_expect { -re "25\[ \t\]+foo \[(\]+.*\[)\]+;.*34\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt } -re ".*$gdb_prompt $" { fail "list 25-34" ; return } timeout { fail "list 25-34 (timeout)" ; return } } send_gdb "list\n" - expect { + gdb_expect { -re "35\[ \t\]+foo \[(\]+.*\[)\]+;.*42\[ \t\]+\}\r\n$gdb_prompt $" { incr testcnt } -re ".*$gdb_prompt $" { fail "list 35-42" ; return } timeout { fail "list 35-42 (timeout)" ; return } @@ -268,28 +271,28 @@ proc test_list_backwards {} { set testcnt 0 send_gdb "list list0.c:33\n" - expect { + gdb_expect { -re "28\[ \t\]+foo \[(\]+.*\[)\]+;.*37\[ \t\]+\r\n$gdb_prompt $" { incr testcnt } -re ".*$gdb_prompt $" { fail "list list0.c:33" ; return } timeout { fail "list list0.c:33 (timeout)" ; return } } send_gdb "list -\n" - expect { + gdb_expect { -re "18\[ \t\]+foo \[(\]+.*\[)\]+;.*27\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt } -re ".*$gdb_prompt $" { fail "list 18-27" ; return } timeout { fail "list 18-27 (timeout)" ; return } } send_gdb "list -\n" - expect { + gdb_expect { -re "8\[ \t\]+breakpoint\[(\]\[)\];.*17\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt } -re ".*$gdb_prompt $" { fail "list 8-17" ; return } timeout { fail "list 8-17 (timeout)" ; return } } send_gdb "list -\n" - expect { + gdb_expect { -re "1\[ \t\]+#include .*7\[ \t\]+set_debug_traps\[(\]\[)\]+;\r\n$gdb_prompt $" { incr testcnt } -re ".*$gdb_prompt $" { fail "list 1-7" ; return } timeout { fail "list 1-7 (timeout)" ; return } @@ -334,7 +337,7 @@ proc test_list_filename_and_function {} { # SunPRO cc is the second case below, it's also correct. setup_xfail "a29k-*-udi" send_gdb "list list0.c:main\n" - expect { + gdb_expect { -re "1\[ \t\]+#include .*8\[ \t\]+breakpoint\[(\]\[)\]+;\r\n$gdb_prompt $" { incr testcnt } @@ -351,7 +354,7 @@ proc test_list_filename_and_function {} { # AIX is legitimately removing it. setup_xfail "rs6000-*-aix*" send_gdb "list list0.c:unused\n" - expect { + gdb_expect { -re "36\[ \t\]+\}.*42\[ \t\]+\}\r\n$gdb_prompt $" { incr testcnt } @@ -372,7 +375,7 @@ proc test_list_filename_and_function {} { # FIXME Fails for COFF as well, I think. setup_xfail "a29k-*-udi" send_gdb "list list0.h:foo\n" - expect { + gdb_expect { -re "2\[ \t\]+including file. This.*11\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt } @@ -392,7 +395,7 @@ proc test_list_filename_and_function {} { # Ultrix gdb is the second case. # a29k-amd-udi is the third case. send_gdb "list list1.c:bar\n" - expect { + gdb_expect { -re "1\[ \t\]+void.*8\[ \t\]+\}\r\n$gdb_prompt $" { incr testcnt } @@ -412,7 +415,7 @@ proc test_list_filename_and_function {} { # AIX is legitimately removing it. setup_xfail "rs6000-*-aix*" send_gdb "list list1.c:unused\n" - expect { + gdb_expect { -re "7\[ \t\]+long_line \[(\]\[)\];.*14\[ \t\]+\}\r\n.*$gdb_prompt $" { incr testcnt } @@ -477,10 +480,10 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} -if [target_info exists use_gdb_stubs] { +if [target_info exists gdb_stub] { send_gdb "step\n" # if use stubs step out of the breakpoint() function. - expect { + gdb_expect { -re "main.* at .*$gdb_prompt $" {} -re ".*in .*start.*$gdb_prompt $" {} timeout { fail "single step at breakpoint() (timeout)" ; return 0 } diff --git a/gdb/testsuite/gdb.base/scope.exp b/gdb/testsuite/gdb.base/scope.exp index 9a0cd7c..9a8292b 100644 --- a/gdb/testsuite/gdb.base/scope.exp +++ b/gdb/testsuite/gdb.base/scope.exp @@ -547,7 +547,7 @@ gdb_test "print 'scope0.c'::filelocal_ro" "= 201" # is responsible for clearing bss and that hasnt' happened yet. setup_xfail "hppa*-*-*pro*" send_gdb "print 'scope0.c'::filelocal_bss\n" -expect { +gdb_expect { -re " = 0\r\n$gdb_prompt $" { pass "print 'scope0.c'::filelocal_bss before run" } diff --git a/gdb/testsuite/gdb.base/structs.exp b/gdb/testsuite/gdb.base/structs.exp index 76e4b05..3424278 100644 --- a/gdb/testsuite/gdb.base/structs.exp +++ b/gdb/testsuite/gdb.base/structs.exp @@ -100,28 +100,21 @@ proc do_function_calls {} { # Now print the L* variables and examine their values. gdb_test "p L1" " = {a = 49 '1'}" - setup_xfail "mn10200*-*-*" gdb_test "p L2" " = {a = 97 'a', b = 98 'b'}" - setup_xfail "mn10200*-*-*" gdb_test "p L3" " = {a = 65 'A', b = 66 'B', c = 67 'C'}" - setup_xfail "mn10200*-*-*" gdb_test "p L4" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4'}" if {$gcc_compiled} then { setup_xfail "hppa*-*-*" } - setup_xfail "mn10200*-*-*" gdb_test "p L5" " = {a = 97 'a', b = 98 'b', c = 99 'c', d = 100 'd', e = 101 'e'}" if {$gcc_compiled} then { setup_xfail "hppa*-*-*" } - setup_xfail "mn10200*-*-*" gdb_test "p L6" " = {a = 65 'A', b = 66 'B', c = 67 'C', d = 68 'D', e = 69 'E', f = 70 'F'}" if {$gcc_compiled} then { setup_xfail "hppa*-*-*" } - setup_xfail "mn10200*-*-*" gdb_test "p L7" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4', e = 53 '5', f = 54 '6', g = 55 '7'}" - setup_xfail "mn10200*-*-*" gdb_test "p L8" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4', e = 53 '5', f = 54 '6', g = 55 '7', h = 56 '8'}" gdb_test "p L9" " = {a = 97 'a', b = 98 'b', c = 99 'c', d = 100 'd', e = 101 'e', f = 102 'f', g = 103 'g', h = 104 'h', i = 105 'i'}" gdb_test "p L10" " = {a = 65 'A', b = 66 'B', c = 67 'C', d = 68 'D', e = 69 'E', f = 70 'F', g = 71 'G', h = 72 'H', i = 73 'I', j = 74 'J'}" @@ -136,9 +129,9 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} -send_gdb "set print sevenbit-strings\n" ; expect -re "$gdb_prompt $" -send_gdb "set print address off\n" ; expect -re "$gdb_prompt $" -send_gdb "set width 0\n" ; expect -re "$gdb_prompt $" +send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $" +send_gdb "set print address off\n" ; gdb_expect -re "$gdb_prompt $" +send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $" if [target_info exists gdb,cannot_call_functions] { setup_xfail "*-*-*" 2416 diff --git a/gdb/testsuite/gdb.chill/builtins.exp b/gdb/testsuite/gdb.chill/builtins.exp index 8597208..81569eb 100644 --- a/gdb/testsuite/gdb.chill/builtins.exp +++ b/gdb/testsuite/gdb.chill/builtins.exp @@ -43,20 +43,20 @@ proc set_lang_chill {} { verbose "loading file '$binfile'" gdb_load $binfile send_gdb "set language chill\n" - expect { + gdb_expect { -re ".*$gdb_prompt $" {} timeout { fail "set language chill (timeout)" ; return 0 } } send_gdb "show language\n" - expect { + gdb_expect { -re ".* source language is \"chill\".*$gdb_prompt $" { pass "set language to \"chill\"" send_gdb "break xx_\n" - expect { + gdb_expect { -re ".*$gdb_prompt $" { send_gdb "run\n" - expect -re ".*$gdb_prompt $" {} + gdb_expect -re ".*$gdb_prompt $" {} return 1 } timeout { diff --git a/gdb/testsuite/gdb.chill/callch.exp b/gdb/testsuite/gdb.chill/callch.exp index 5cbf7fa..b73e0c5 100644 --- a/gdb/testsuite/gdb.chill/callch.exp +++ b/gdb/testsuite/gdb.chill/callch.exp @@ -49,7 +49,7 @@ proc do_tests {} { send_gdb "set language chill\n" ; gdb_test "break callch.ch:48 "" - send_gdb "run\n"; expect -re "Breakpoint .*callch.ch:48.*$gdb_prompt $" + send_gdb "run\n"; gdb_expect -re "Breakpoint .*callch.ch:48.*$gdb_prompt $" gdb_test {set fred(10, i)} {a is '10'; b is '12'.} gdb_test_exact "call klaus()" {here's klaus calling.} gdb_test_exact "call fred()" {too few arguments in function call} diff --git a/gdb/testsuite/gdb.chill/chexp.exp b/gdb/testsuite/gdb.chill/chexp.exp index bdc100d..fe039e0 100644 --- a/gdb/testsuite/gdb.chill/chexp.exp +++ b/gdb/testsuite/gdb.chill/chexp.exp @@ -33,13 +33,13 @@ proc set_lang_chill {} { global gdb_prompt send_gdb "set language chill\n" - expect { + gdb_expect { -re ".*$gdb_prompt $" {} timeout { fail "set language chill (timeout)" ; return 0 } } send_gdb "show language\n" - expect { + gdb_expect { -re ".* source language is \"chill\".*$gdb_prompt $" { pass "set language to \"chill\"" return 1 diff --git a/gdb/testsuite/gdb.chill/enum.exp b/gdb/testsuite/gdb.chill/enum.exp index d5ec0e9..724382a 100644 --- a/gdb/testsuite/gdb.chill/enum.exp +++ b/gdb/testsuite/gdb.chill/enum.exp @@ -45,7 +45,7 @@ proc set_lang_chill {} { gdb_load $binfile send_gdb "set language chill\n" - expect { + gdb_expect { -re ".*$gdb_prompt $" {} timeout { fail "set language chill (timeout)" ; return 0 } } @@ -69,7 +69,7 @@ if ![set_lang_chill] then { runto hugo_ send_gdb "set var \$i := d\n" - expect -re ".*$gdb_prompt $" + gdb_expect -re ".*$gdb_prompt $" gdb_test "print \$i" { = d} gdb_test "print size (\$i)" { = 1} gdb_test "print b+c" { = 3} diff --git a/gdb/testsuite/gdb.chill/gch1041.exp b/gdb/testsuite/gdb.chill/gch1041.exp index 3b035ab..0fbedb6 100644 --- a/gdb/testsuite/gdb.chill/gch1041.exp +++ b/gdb/testsuite/gdb.chill/gch1041.exp @@ -46,7 +46,7 @@ proc set_lang_chill {} { gdb_load $binfile send_gdb "set language chill\n" - expect { + gdb_expect { -re ".*$gdb_prompt $" {} timeout { fail "set language chill (timeout)" ; return 0 } } diff --git a/gdb/testsuite/gdb.chill/gch1272.exp b/gdb/testsuite/gdb.chill/gch1272.exp index 3377c2d..2517473 100644 --- a/gdb/testsuite/gdb.chill/gch1272.exp +++ b/gdb/testsuite/gdb.chill/gch1272.exp @@ -45,7 +45,7 @@ proc set_lang_chill {} { gdb_load $binfile send_gdb "set language chill\n" - expect { + gdb_expect { -re ".*$gdb_prompt $" {} timeout { fail "set language chill (timeout)" ; return 0 } } diff --git a/gdb/testsuite/gdb.chill/gch1280.exp b/gdb/testsuite/gdb.chill/gch1280.exp index 1786ccf..a00df833 100644 --- a/gdb/testsuite/gdb.chill/gch1280.exp +++ b/gdb/testsuite/gdb.chill/gch1280.exp @@ -45,7 +45,7 @@ proc set_lang_chill {} { gdb_load $binfile send_gdb "set language chill\n" - expect { + gdb_expect { -re ".*$gdb_prompt $" {} timeout { fail "set language chill (timeout)" ; return 0 } } diff --git a/gdb/testsuite/gdb.chill/gch922.exp b/gdb/testsuite/gdb.chill/gch922.exp index f2d023e..247e3de 100644 --- a/gdb/testsuite/gdb.chill/gch922.exp +++ b/gdb/testsuite/gdb.chill/gch922.exp @@ -47,20 +47,20 @@ proc set_lang_chill {} { verbose "loading file '$binfile'" gdb_load $binfile send_gdb "set language chill\n" - expect { + gdb_expect { -re ".*$gdb_prompt $" {} timeout { fail "set language chill (timeout)" ; return 0 } } send_gdb "show language\n" - expect { + gdb_expect { -re ".* source language is \"chill\".*$gdb_prompt $" { pass "set language to \"chill\"" send_gdb "break xx_\n" - expect { + gdb_expect { -re ".*$gdb_prompt $" { send_gdb "run\n" - expect -re ".*$gdb_prompt $" {} + gdb_expect -re ".*$gdb_prompt $" {} return 1 } timeout { @@ -125,11 +125,11 @@ proc test_chars {} { gdb_test "set var a := (100)'\^(0,255)' "" test_print_accept "print a" {"\^\(0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255\)"} - send_gdb "set var a := (10)'\^(1)'//(26)\"\^(66,67)\"//\" \"//'I'//' '//'a'//'m'//\" Hugo\" \n" ; expect -re "$gdb_prompt $" + send_gdb "set var a := (10)'\^(1)'//(26)\"\^(66,67)\"//\" \"//'I'//' '//'a'//'m'//\" Hugo\" \n" ; gdb_expect -re "$gdb_prompt $" test_print_accept "print a" {"\^\(1,1,1,1,1,1,1,1,1,1\)BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC I am Hugo"} - send_gdb "set var b := \"Hugo \"\"\^(3,4)\"\"Otto\^(17)\" \n" ; expect -re "$gdb_prompt $" + send_gdb "set var b := \"Hugo \"\"\^(3,4)\"\"Otto\^(17)\" \n" ; gdb_expect -re "$gdb_prompt $" test_print_accept "print b" {"Hugo ""\^\(3,4\)""Otto\^\(17\)"} - send_gdb "set var c := (70)'b' // \"\^(2,3)Hugo \" // (70)'c' \n" ; expect -re "$gdb_prompt $" + send_gdb "set var c := (70)'b' // \"\^(2,3)Hugo \" // (70)'c' \n" ; gdb_expect -re "$gdb_prompt $" test_print_accept "print c" {'b'<repeats 70 times>//"\^\(2,3\)Hugo "//'c'<repeats 70 times>} gdb_test "set var d := '\^(199)' "" test_print_accept "print d" {'\^\(199\)'} @@ -137,15 +137,15 @@ proc test_chars {} { test_print_accept "print (10)'\^(0)'//(26)\"\^(66,67)\"//\" \"//'I'//' '//'a'//'m'//\" Hugo\"" {"\^\(0,0,0,0,0,0,0,0,0,0\)BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC I am Hugo"} test_print_accept "print \"Jason\"\"\^(0,5)\"\"Hugo\^(10)\"" {"Jason""\^\(0,5\)""Hugo\^\(10\)"} - send_gdb "set var a := \"\" \n" ; expect -re "$gdb_prompt $" + send_gdb "set var a := \"\" \n" ; gdb_expect -re "$gdb_prompt $" test_print_accept "print a" {""} - send_gdb "set var a := \"\"\"\" \n" ; expect -re "$gdb_prompt $" + send_gdb "set var a := \"\"\"\" \n" ; gdb_expect -re "$gdb_prompt $" test_print_accept "print a" {""""} - send_gdb "set var a := \" \"\"\" \n" ; expect -re "$gdb_prompt $" + send_gdb "set var a := \" \"\"\" \n" ; gdb_expect -re "$gdb_prompt $" test_print_accept "print a" {" """} - send_gdb "set var a := \"\^\^\" \n" ; expect -re "$gdb_prompt $" + send_gdb "set var a := \"\^\^\" \n" ; gdb_expect -re "$gdb_prompt $" test_print_accept "print a" {"\^\^"} - send_gdb "set var a := \"'\" \n" ; expect -re "$gdb_prompt $" + send_gdb "set var a := \"'\" \n" ; gdb_expect -re "$gdb_prompt $" test_print_accept "print a" {"'"} } diff --git a/gdb/testsuite/gdb.chill/gch981.exp b/gdb/testsuite/gdb.chill/gch981.exp index 361389c..3cf75f6 100644 --- a/gdb/testsuite/gdb.chill/gch981.exp +++ b/gdb/testsuite/gdb.chill/gch981.exp @@ -47,20 +47,20 @@ proc set_lang_chill {} { verbose "loading file '$binfile'" gdb_load $binfile send_gdb "set language chill\n" - expect { + gdb_expect { -re ".*$gdb_prompt $" {} timeout { fail "set language chill (timeout)" ; return 0 } } send_gdb "show language\n" - expect { + gdb_expect { -re ".* source language is \"chill\".*$gdb_prompt $" { pass "set language to \"chill\"" send_gdb "break xx_\n" - expect { + gdb_expect { -re ".*$gdb_prompt $" { send_gdb "run\n" - expect -re ".*$gdb_prompt $" {} + gdb_expect -re ".*$gdb_prompt $" {} return 1 } timeout { @@ -121,7 +121,7 @@ proc test_power {} { test_print_accept "print SIZE(v1_power1)" "1" gdb_test "set v1_power1 := \[b1\] "" -# if GDB has rejected the improper values, we have to expect the same! +# if GDB has rejected the improper values, we have to gdb_expect the same! test_print_accept "print v1_power1" {\[e1:e5\]} gdb_test "set v1_power1 := \[a1,a2\] "" @@ -171,7 +171,7 @@ proc test_power {} { gdb_test "set v_power3 := \[b5:b7, b1\] "" test_print_accept "print v_power3" {\[b1, b5:b7\]} - send_gdb "set v_power4 := \[\"b\"\] \n" ; expect -re "$gdb_prompt $" + send_gdb "set v_power4 := \[\"b\"\] \n" ; gdb_expect -re "$gdb_prompt $" test_print_accept "print v_power4" {\['b':'x'\]} gdb_test "set v_power4 := \[5\] "" test_print_accept "print v_power4" {\['b':'x'\]} diff --git a/gdb/testsuite/gdb.chill/misc.exp b/gdb/testsuite/gdb.chill/misc.exp index f064adc..8911a85 100644 --- a/gdb/testsuite/gdb.chill/misc.exp +++ b/gdb/testsuite/gdb.chill/misc.exp @@ -46,7 +46,7 @@ proc set_lang_chill {} { gdb_load $binfile send_gdb "set language chill\n" - expect { + gdb_expect { -re ".*$gdb_prompt $" {} timeout { fail "set language chill (timeout)" ; return 0 } } @@ -94,7 +94,7 @@ if ![set_lang_chill] then { gdb_test "print array () ubyte (foo)" { = \[\(0:11\): 0\]} send_gdb "set var \$i := foo\n" - expect -re ".*$gdb_prompt $" + gdb_expect -re ".*$gdb_prompt $" setup_xfail "m68*-*-hpux*" gdb_test "print/x array () byte (\$i)" { = \[\(0:11\): H'0\]} } diff --git a/gdb/testsuite/gdb.chill/powerset.exp b/gdb/testsuite/gdb.chill/powerset.exp index 525e03c..8ecee6c 100644 --- a/gdb/testsuite/gdb.chill/powerset.exp +++ b/gdb/testsuite/gdb.chill/powerset.exp @@ -43,20 +43,20 @@ proc set_lang_chill {} { verbose "loading file '$binfile'" gdb_load $binfile send_gdb "set language chill\n" - expect { + gdb_expect { -re ".*$gdb_prompt $" {} timeout { fail "set language chill (timeout)" ; return 0 } } send_gdb "show language\n" - expect { + gdb_expect { -re ".* source language is \"chill\".*$gdb_prompt $" { pass "set language to \"chill\"" send_gdb "break xx_\n" - expect { + gdb_expect { -re ".*$gdb_prompt $" { send_gdb "run\n" - expect -re ".*$gdb_prompt $" {} + gdb_expect -re ".*$gdb_prompt $" {} return 1 } timeout { diff --git a/gdb/testsuite/gdb.chill/pr-5984.exp b/gdb/testsuite/gdb.chill/pr-5984.exp index 206413e..b4f77b3 100644 --- a/gdb/testsuite/gdb.chill/pr-5984.exp +++ b/gdb/testsuite/gdb.chill/pr-5984.exp @@ -49,8 +49,8 @@ proc do_tests {} { send_gdb "set language chill\n" ; gdb_test "break pr-5984.ch:6 "" - send_gdb "run\n"; expect -re "Breakpoint .*pr-5984.ch:6" - expect -re "$gdb_prompt $" + send_gdb "run\n"; gdb_expect -re "Breakpoint .*pr-5984.ch:6" + gdb_expect -re "$gdb_prompt $" gdb_test "next" "Jason Dark.*" "next over Jason Dark" } diff --git a/gdb/testsuite/gdb.chill/pr-6292.exp b/gdb/testsuite/gdb.chill/pr-6292.exp index 1fae71a..c9f43fc 100644 --- a/gdb/testsuite/gdb.chill/pr-6292.exp +++ b/gdb/testsuite/gdb.chill/pr-6292.exp @@ -49,7 +49,7 @@ proc do_tests {} { send_gdb "set language chill\n" ; gdb_test "break pr-6292.ch:15 "" - send_gdb "run\n"; expect -re "Breakpoint .*pr-6292.ch:15.*$gdb_prompt $" + send_gdb "run\n"; gdb_expect -re "Breakpoint .*pr-6292.ch:15.*$gdb_prompt $" gdb_test_exact "call klaus()" {here's klaus calling.} gdb_test {set fred(10, i)} {a was '10'; b was '12'.} gdb_test "print i" { = 13} "print i after call" diff --git a/gdb/testsuite/gdb.chill/pr-9946.exp b/gdb/testsuite/gdb.chill/pr-9946.exp index 40d73b0..df28c73 100644 --- a/gdb/testsuite/gdb.chill/pr-9946.exp +++ b/gdb/testsuite/gdb.chill/pr-9946.exp @@ -46,7 +46,7 @@ proc set_lang_chill {} { gdb_load $binfile send_gdb "set language chill\n" - expect { + gdb_expect { -re ".*$gdb_prompt $" {} timeout { fail "set language chill (timeout)" ; return 0 } } diff --git a/gdb/testsuite/gdb.chill/tests1.exp b/gdb/testsuite/gdb.chill/tests1.exp index 8a0be28..37156a7 100644 --- a/gdb/testsuite/gdb.chill/tests1.exp +++ b/gdb/testsuite/gdb.chill/tests1.exp @@ -43,20 +43,20 @@ proc set_lang_chill {} { verbose "loading file '$binfile'" gdb_load $binfile send_gdb "set language chill\n" - expect { + gdb_expect { -re ".*$gdb_prompt $" {} timeout { fail "set language chill (timeout)" ; return 0 } } send_gdb "show language\n" - expect { + gdb_expect { -re ".* source language is \"chill\".*$gdb_prompt $" { pass "set language to \"chill\"" send_gdb "break dummyfunc\n" - expect { + gdb_expect { -re ".*$gdb_prompt $" { send_gdb "run\n" - expect -re ".*$gdb_prompt $" {} + gdb_expect -re ".*$gdb_prompt $" {} return 1 } timeout { diff --git a/gdb/testsuite/gdb.chill/tests2.exp b/gdb/testsuite/gdb.chill/tests2.exp index a162e31..35e37a6 100644 --- a/gdb/testsuite/gdb.chill/tests2.exp +++ b/gdb/testsuite/gdb.chill/tests2.exp @@ -55,20 +55,20 @@ proc set_lang_chill {} { gdb_load $objdir/$subdir/$binfile send_gdb "set language chill\n" - expect { + gdb_expect { -re ".*$gdb_prompt $" {} timeout { fail "set language chill (timeout)" ; return 0 } } send_gdb "show language\n" - expect { + gdb_expect { -re ".* source language is \"chill\".*$gdb_prompt $" { pass "set language to \"chill\"" send_gdb "break dummyfunc\n" - expect { + gdb_expect { -re ".*$gdb_prompt $" { send_gdb "run\n" - expect -re ".*$gdb_prompt $" {} + gdb_expect -re ".*$gdb_prompt $" {} return 1 } timeout { @@ -117,7 +117,7 @@ proc test_write { args } { verbose "setting var $value..." send_gdb "set var $location.m$extended := $value\n" - expect -re ".*$gdb_prompt $" {} + gdb_expect -re ".*$gdb_prompt $" {} gdb_test "print $location" \ ".*= \[\[\]\\.p1: 2863311530, \\.m: $matchval, \\.p2: 1431655765\[\]\]"\ "$message" diff --git a/gdb/testsuite/gdb.disasm/mn10200.exp b/gdb/testsuite/gdb.disasm/mn10200.exp index e62d231..dc19d90 100644 --- a/gdb/testsuite/gdb.disasm/mn10200.exp +++ b/gdb/testsuite/gdb.disasm/mn10200.exp @@ -47,7 +47,7 @@ proc add_tests { } { global decimal send_gdb "x/12i add_tests\n" - expect { + gdb_expect { -re " .*add d1,d2.* .*add d2,a3.* @@ -73,7 +73,7 @@ proc bcc_tests { } { global decimal send_gdb "x/15i bCC_tests\n" - expect { + gdb_expect { -re " .*beq 0x\[0-9a-f]+ <bCC_tests>.* .*bne 0x\[0-9a-f]+ <bCC_tests>.* @@ -102,7 +102,7 @@ proc bccx_tests { } { global decimal send_gdb "x/14i bCCx_tests\n" - expect { + gdb_expect { -re " .*beqx 0x\[0-9a-f]+ <bCCx_tests>.* .*bnex 0x\[0-9a-f]+ <bCCx_tests>.* @@ -130,7 +130,7 @@ proc bit_tests { } { global decimal send_gdb "x/4 bit_tests\n" - expect { + gdb_expect { -re " .*btst 64,d1.* .*btst 8192,d2.* @@ -148,7 +148,7 @@ proc cmp_tests { } { global decimal send_gdb "x/9i cmp_tests\n" - expect { + gdb_expect { -re " .*cmp d1,d2.* .*cmp d2,a3.* @@ -171,7 +171,7 @@ proc extend_tests { } { global decimal send_gdb "x/5i extend_tests\n" - expect { + gdb_expect { -re " .*ext d1.* .*extx d2.* @@ -190,7 +190,7 @@ proc logical_tests { } { global decimal send_gdb "x/11i logical_tests\n" - expect { + gdb_expect { -re " .*and d1,d2.* .*and 127,d2.* @@ -215,7 +215,7 @@ proc mov_tests_1 { } { global decimal send_gdb "x/12i mov_tests_1\n" - expect { + gdb_expect { -re " .*mov d1,a2.* .*mov a2,d1.* @@ -241,7 +241,7 @@ proc mov_tests_2 { } { global decimal send_gdb "x/9 mov_tests_2\n" - expect { + gdb_expect { -re " .*mov \\(d1,a1\\),d2.* .*mov \\(0x8000.*\\),d1.* @@ -264,7 +264,7 @@ proc mov_tests_3 { } { global decimal send_gdb "x/10 mov_tests_3\n" - expect { + gdb_expect { -re " .*mov d1,\\(a2\\).* .*mov d1,\\(32,a2\\).* @@ -288,7 +288,7 @@ proc mov_tests_4 { } { global decimal send_gdb "x/8 mov_tests_4\n" - expect { + gdb_expect { -re " .*mov a1,\\(d2,a2\\).* .*mov a1,\\(0x80.*\\).* @@ -310,7 +310,7 @@ proc movb_tests { } { global decimal send_gdb "x/12 movb_tests\n" - expect { + gdb_expect { -re " .*movb \\(8,a2\\),d1.* .*movb \\(256,a2\\),d1.* @@ -336,7 +336,7 @@ proc movbu_tests { } { global decimal send_gdb "x/7 movbu_tests\n" - expect { + gdb_expect { -re " .*movbu \\(a2\\),d1.* .*movbu \\(8,a2\\),d1.* @@ -357,7 +357,7 @@ proc movx_tests { } { global decimal send_gdb "x/6 movx_tests\n" - expect { + gdb_expect { -re " .*movx \\(8,a2\\),d1.* .*movx \\(256,a2\\),d1.* @@ -377,7 +377,7 @@ proc muldiv_tests { } { global decimal send_gdb "x/3 muldiv_tests\n" - expect { + gdb_expect { -re " .*mul d1,d2.* .*mulu d2,d3.* @@ -394,7 +394,7 @@ proc misc_tests { } { global decimal send_gdb "x/9 misc_tests\n" - expect { + gdb_expect { -re " .*jmp 0x\[0-9a-f]+ <main>.* .*jmp 0x\[0-9a-f]+ <start>.* @@ -417,7 +417,7 @@ proc shift_tests { } { global decimal send_gdb "x/4i shift_tests\n" - expect { + gdb_expect { -re " .*asr d2.* .*lsr d3.* @@ -435,7 +435,7 @@ proc sub_tests { } { global decimal send_gdb "x/9i sub_tests\n" - expect { + gdb_expect { -re " .*sub d1,d2.* .*sub d2,a3.* diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 8ca0735..2e33b70 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -97,7 +97,7 @@ proc gdb_unload {} { global GDB global gdb_prompt send_gdb "file\n" - expect { + gdb_expect { -re "No exec file now.*\r" { exp_continue } -re "No symbol file now.*\r" { exp_continue } -re "A program is being debugged already..*Kill it.*y or n. $"\ @@ -128,24 +128,24 @@ proc delete_breakpoints {} { global gdb_spawn_id send_gdb "delete breakpoints\n" - expect { - -i $gdb_spawn_id -re ".*Delete all breakpoints.*y or n.*$" { + gdb_expect { + -re ".*Delete all breakpoints.*y or n.*$" { send_gdb "y\n"; exp_continue } - -i $gdb_spawn_id -re ".*$gdb_prompt $" { # This happens if there were no breakpoints + -re ".*$gdb_prompt $" { # This happens if there were no breakpoints } - -i $gdb_spawn_id timeout { perror "Delete all breakpoints in delete_breakpoints (timeout)" ; return } + timeout { perror "Delete all breakpoints in delete_breakpoints (timeout)" ; return } } send_gdb "info breakpoints\n" - expect { - -i $gdb_spawn_id -re "No breakpoints or watchpoints..*$gdb_prompt $" {} - -i $gdb_spawn_id -re ".*$gdb_prompt $" { perror "breakpoints not deleted" ; return } - -i $gdb_spawn_id -re "Delete all breakpoints.*or n.*$" { + gdb_expect { + -re "No breakpoints or watchpoints..*$gdb_prompt $" {} + -re ".*$gdb_prompt $" { perror "breakpoints not deleted" ; return } + -re "Delete all breakpoints.*or n.*$" { send_gdb "y\n"; exp_continue } - -i $gdb_spawn_id timeout { perror "info breakpoints (timeout)" ; return } + timeout { perror "info breakpoints (timeout)" ; return } } } @@ -170,7 +170,7 @@ proc gdb_run_cmd {args} { set start "start"; } send_gdb "jump *$start\n" - expect { + gdb_expect { -re "Continuing at \[^\r\n\]*\[\r\n\]" { if ![target_info exists gdb_stub] { return; @@ -195,7 +195,7 @@ proc gdb_run_cmd {args} { timeout { perror "Jump to start() failed (timeout)"; return } } if [target_info exists gdb_stub] { - expect { + gdb_expect { -re ".*$gdb_prompt $" { send_gdb "continue\n" } @@ -205,7 +205,7 @@ proc gdb_run_cmd {args} { } send_gdb "run $args\n" # This doesn't work quite right yet. - expect { + gdb_expect { -re "The program .* has been started already.*y or n. $" { send_gdb "y\n" exp_continue @@ -223,7 +223,7 @@ proc gdb_breakpoint { function } { send_gdb "break $function\n" # The first two regexps are what we get with -g, the third is without -g. - expect { + gdb_expect { -re "Breakpoint \[0-9\]* at .*: file .*, line $decimal.\r\n$gdb_prompt $" {} -re "Breakpoint \[0-9\]*: file .*, line $decimal.\r\n$gdb_prompt $" {} -re "Breakpoint \[0-9\]* at .*$gdb_prompt $" {} @@ -256,7 +256,7 @@ proc runto { function } { # the "at foo.c:36" output we get with -g. # the "in func" output we get without -g. - expect { + gdb_expect { -re "Break.* at .*:$decimal.*$gdb_prompt $" { return 1 } @@ -293,7 +293,7 @@ proc runto_main {} { send_gdb "step\n" # if use stubs step out of the breakpoint() function. - expect { + gdb_expect { -re "main.* at .*$gdb_prompt $" {} -re "_start.*$gdb_prompt $" {} timeout { fail "single step at breakpoint() (timeout)" ; return 0 } @@ -354,8 +354,8 @@ proc gdb_test { args } { } } - expect { - -i $gdb_spawn_id -re ".*Ending remote debugging.*$gdb_prompt$" { + gdb_expect { + -re ".*Ending remote debugging.*$gdb_prompt$" { if ![isnative] then { warning "Can`t communicate to remote target." } @@ -363,25 +363,25 @@ proc gdb_test { args } { gdb_start set result -1 } - -i $gdb_spawn_id -re "\[\r\n\]*($pattern)\[\r\n\]+$gdb_prompt $" { + -re "\[\r\n\]*($pattern)\[\r\n\]+$gdb_prompt $" { if ![string match "" $message] then { pass "$message" } set result 0 } - -i $gdb_spawn_id -re "(${question_string})$" { + -re "(${question_string})$" { send_gdb "$response_string\n"; exp_continue; } - -i $gdb_spawn_id -re "Undefined command:.*$gdb_prompt" { + -re "Undefined command:.*$gdb_prompt" { perror "Undefined command \"$command\"." set result 1 } - -i $gdb_spawn_id -re "Ambiguous command.*$gdb_prompt $" { + -re "Ambiguous command.*$gdb_prompt $" { perror "\"$command\" is not a unique command name." set result 1 } - -i $gdb_spawn_id -re ".*Program exited with code \[0-9\]+.*$gdb_prompt $" { + -re ".*Program exited with code \[0-9\]+.*$gdb_prompt $" { if ![string match "" $message] then { set errmsg "$message: the program exited" } else { @@ -390,7 +390,7 @@ proc gdb_test { args } { fail "$errmsg" return -1 } - -i $gdb_spawn_id -re "The program is not being run.*$gdb_prompt $" { + -re "The program is not being run.*$gdb_prompt $" { if ![string match "" $message] then { set errmsg "$message: the program is no longer running" } else { @@ -399,30 +399,33 @@ proc gdb_test { args } { fail "$errmsg" return -1 } - -i $gdb_spawn_id -re ".*$gdb_prompt $" { + -re ".*$gdb_prompt $" { if ![string match "" $message] then { fail "$message" } set result 1 } - -i $gdb_spawn_id "<return>" { + "<return>" { send_gdb "\n" perror "Window too small." } - -i $gdb_spawn_id -re "\\(y or n\\) " { + -re "\\(y or n\\) " { send_gdb "n\n" perror "Got interactive prompt." } - -i $gdb_spawn_id eof { - perror "Process no longer exists" - return -1 + eof { + perror "Process no longer exists" + if { $message != "" } { + fail "$message" + } + return -1 } - -i $gdb_spawn_id full_buffer { + full_buffer { perror "internal buffer is full." } timeout { if ![string match "" $message] then { - fail "(timeout) $message" + fail "$message (timeout)" } set result 1 } @@ -451,7 +454,7 @@ proc test_print_reject { args } { send_user "Looking to match \"$expectthis\"\n" } send_gdb "$sendthis\n" - expect { + gdb_expect { -re ".*A .* in expression.*\\.*$gdb_prompt $" { pass "reject $sendthis" return 1 @@ -527,7 +530,7 @@ proc gdb_test_exact { args } { # It is most natural to write the pattern argument with only # embedded \n's, especially if you are trying to avoid Tcl quoting - # problems. But expect really wants to see \r\n in patterns. So + # problems. But gdb_expect really wants to see \r\n in patterns. So # transform the pattern here. First transform \r\n back to \n, in # case some users of gdb_test_exact already do the right thing. regsub -all "\r\n" $pattern "\n" pattern @@ -550,13 +553,13 @@ proc gdb_reinitialize_dir { subdir } { return ""; } send_gdb "dir\n" - expect { + gdb_expect { -re "Reinitialize source path to empty.*y or n. " { send_gdb "y\n" - expect { + gdb_expect { -re "Source directories searched.*$gdb_prompt $" { send_gdb "dir $subdir\n" - expect { + gdb_expect { -re "Source directories searched.*$gdb_prompt $" { verbose "Dir set to $subdir" } @@ -597,21 +600,21 @@ proc default_gdb_exit {} { if [is_remote host] { send_gdb "quit\n"; - expect { - -i $gdb_spawn_id -re ".*and kill it.*y or n. " { + gdb_expect { + -re ".*and kill it.*y or n. " { send_gdb "y\n"; exp_continue; } - -i $gdb_spawn_id timeout { } + timeout { } } } else { # We used to try to send_gdb "quit" to GDB, and wait for it to die. # Dealing with all the cases and errors got pretty hairy. Just close it, # that is simpler. - catch "close -i $gdb_spawn_id" + catch "close " # Omitting this probably would cause strange timing-dependent failures. - catch "wait -i $gdb_spawn_id" + catch "wait " } remote_close host; @@ -641,7 +644,7 @@ proc gdb_file_cmd { arg } { } send_gdb "file $arg\n" - expect { + gdb_expect { -re "Reading symbols from.*done.*$gdb_prompt $" { verbose "\t\tLoaded $arg into the $GDB" return 0 @@ -657,7 +660,7 @@ proc gdb_file_cmd { arg } { } -re "Load new symbol table from \".*\".*y or n. $" { send_gdb "y\n" - expect { + gdb_expect { -re "Reading symbols from.*done.*$gdb_prompt $" { verbose "\t\tLoaded $arg with new symbol table into $GDB" return 0 @@ -683,7 +686,7 @@ proc gdb_file_cmd { arg } { eof { # This is an attempt to detect a core dump, but seems not to # work. Perhaps we need to match .* followed by eof, in which - # expect does not seem to have a way to do that. + # gdb_expect does not seem to have a way to do that. perror "couldn't load $arg into $GDB (end of file)." return -1 } @@ -747,22 +750,23 @@ proc default_gdb_start { } { set gdb_spawn_id $shell_id set spawn_id $gdb_spawn_id # force the height to "unlimited", so no pagers get used + send_gdb "set height 0\n" - expect { - -i $shell_id -re ".*$gdb_prompt $" { + gdb_expect { + -re ".*$gdb_prompt $" { verbose "Setting height to 0." 2 } - -i $shell_id timeout { + timeout { warning "Couldn't set the height to 0" } } # force the width to "unlimited", so no wraparound occurs send_gdb "set width 0\n" - expect { - -i $shell_id -re ".*$gdb_prompt $" { + gdb_expect { + -re ".*$gdb_prompt $" { verbose "Setting width to 0." 2 } - -i $shell_id timeout { + timeout { warning "Couldn't set the width to 0." } } @@ -839,6 +843,104 @@ proc send_gdb { string } { return [remote_send host "$string"]; } +# +# Basically the same as TCL expect, but with a big difference: it will +# call the eof/timeout/default section if there is an error in the +# expect call. +# Also adds a -i $gdb_spawn_id to each expect statement. +# + +proc gdb_expect { args } { + global gdb_spawn_id; + global errorInfo errorCode; + + if { [llength $args] == 1 } { + set args "[lindex $args 0]"; + } + + set res {} + set got_re 0; + set need_append 1; + + set orig "$args"; + + set error_sect ""; + set save_next 0; + + for { set i 0; } { $i < [llength $args] } { incr i ; } { + if { $need_append } { + append res "\n-i $gdb_spawn_id "; + set need_append 0; + } + + set x "[lrange $args $i $i]"; + regsub "^\n*\[ \]*" "$x" "" x; + + if { $x == "-i" || $x == "-timeout" || $x == "-ex" } { + append res "$x "; + set next [expr ${i}+1]; + append res "[lrange $args $next $next]"; + incr i; + continue; + } + if { $x == "-n" || $x == "-notransfer" || $x == "-nocase" || $x == "-indices" } { + append res "${x} "; + continue; + } + if { $x == "-re" } { + append res "${x} "; + set next [expr ${i}+1]; + set y [lrange $args $next $next]; + append res "${y} "; + set got_re 1; + incr i; + continue; + } + if { $got_re } { + set need_append 1; + append res "$x "; + set got_re 0; + if { $save_next } { + set save_next 0; + set error_sect [lindex $args $i]; + } + } else { + if { ${x} == "eof" } { + set save_next 1; + } elseif { ${x} == "default" || ${x} == "timeout" } { + if { $error_sect == "" } { + set save_next 1; + } + } + append res "${x} "; + set got_re 1; + } + } + + set body "expect [list $res]"; + + set code [catch {uplevel $body} string]; + + if {$code == 1} { + if { $error_sect != "" } { + set code [catch {uplevel $error_sect} string]; + } else { + perror "uh, gdb_expect statement without a default case?!"; + return; + } + } + + if {$code == 1} { + return -code error -errorinfo $errorInfo -errorcode $errorCode $string + } elseif {$code == 2} { + return -code return $string + } elseif {$code == 3} { + return + } elseif {$code > 4} { + return -code $code $string + } +} + proc gdb_start { } { default_gdb_start } |