* gdb.*/*.exp: Call gdb_expect instead of expect.
* lib/gdb.exp(gdb_expect): New function.
+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.
udi.exp
unix.exp
unknown.exp
+vr4300.exp
vx.exp
vxworks.exp
vxworks29k.exp
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."
}
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";
}
}
sleep 1;
send_gdb "\ 3"
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."
}
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";
}
}
# 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
}
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."
}
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";
}
}
sleep 1;
send_gdb "\ 3"
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";
}
}
# 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
}
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."
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 "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."
}
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";
}
}
sleep 1;
send_gdb "\ 3"
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."
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;
}
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;
}
}
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;
}
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."
}
}
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";
}
}
sleep 1;
send_gdb "\ 3"
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";
}
}
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"
}
}
}
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
}
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."
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;
}
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
}
--- /dev/null
+load_lib ../config/monitor.exp
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"
}
}
send "$command\n"
- expect {
+ gdb_expect {
-re ".*No such file or directory.\r\n$gdb_prompt $" {
fail "$description (no source available)"
}
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
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"
}
# do we have a version number ?
send "print version\n"
- expect {
+ gdb_expect {
-re ".\[0-9\]+ = +0x.*\[0-9.\]+.*$gdb_prompt $" {
pass "printed version"
}
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"
}
# 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.*
# 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" }
# 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"
}
set description "send SIGINT signal to child process"
send "signal SIGINT\n"
- expect {
+ gdb_expect {
-re "Continuing with signal SIGINT.*$gdb_prompt $" {
pass "$description"
}
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"
}
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\\."] {
}
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 }
proc bitfield_containment {} {
global decimal
global hex
- global prompt
+ global gdb_prompt
global srcfile
delete_breakpoints
}
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 }
proc bitfield_unsignedness {} {
global decimal
global hex
- global prompt
+ global gdb_prompt
global srcfile
delete_breakpoints
}
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 }
proc bitfield_signedness {} {
global decimal
global hex
- global prompt
+ global gdb_prompt
global srcfile
delete_breakpoints
}
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 }
# 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
}
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.
# 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)"
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)" }
}
} else {
send_gdb "run\n"
}
- expect {
+ gdb_expect {
-re "The program .* has been started already.*y or n. $" {
send_gdb "y\n"
exp_continue
# 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)" }
# 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)" }
proc test_next_with_recursion {} {
global gdb_prompt
global decimal
- global noresults
global binfile
if [istarget "d10v-*-*"] {
} else {
gdb_run_cmd
}
- expect {
+ gdb_expect {
-re "Break.* factorial .value=6. .*$gdb_prompt $" {}
timeout { fail "run to factorial(6) (timeout)" ; return }
}
# 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 }
}
# 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 }
}
"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"
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 $" {}
}
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
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"
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.
}
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.
}
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.
}
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."
}
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."
}
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."
gdb_test "break factorial" "Breakpoint.*at.*"
send_gdb "commands\n"
- expect {
+ gdb_expect {
-re "End with" {
pass "commands in if_while_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"
}
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
}
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
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 }
}
#
proc integral_args {} {
- global prompt
+ global gdb_prompt
global det_file
global gcc_compiled
global gdb_spawn_id
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
#
proc unsigned_integral_args {} {
- global prompt
+ global gdb_prompt
global det_file
global gcc_compiled
global gdb_spawn_id
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
#
proc float_and_integral_args {} {
- global prompt
+ global gdb_prompt
global det_file
global gcc_compiled
global gdb_spawn_id
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
#
proc pointer_args {} {
- global prompt
+ global gdb_prompt
global hex
global det_file
global gdb_spawn_id
# 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'"
#
proc structs_by_reference {} {
- global prompt
+ global gdb_prompt
global hex
global det_file
global gdb_spawn_id
# 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\}"
#
proc structs_by_value {} {
- global prompt
+ global gdb_prompt
global hex
global det_file
global gdb_spawn_id
# 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\}"
#
proc discard_and_shuffle {} {
- global prompt
+ global gdb_prompt
global hex
global decimal
global det_file
# 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-*-*"
#
proc shuffle_round_robin {} {
- global prompt
+ global gdb_prompt
global hex
global decimal
global det_file
# 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
#
proc recursive_structs_by_value {} {
- global prompt
+ global gdb_prompt
global hex
global decimal
global det_file
# 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-*-*] {
# 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
}
proc call_after_alloca { } {
- global prompt
+ global gdb_prompt
global hex
global decimal
global gcc_compiled
# 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
#
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-*-*" }
# to handle trampolines.
#
proc test_stepping_over_trampolines { } {
- global prompt
+ global gdb_prompt
global hex
global decimal
global gdb_spawn_id
# 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.
# 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 }
}
}
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
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
}
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
}
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
}
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
}
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 }
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 }
# 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
}
# 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
}
# 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
}
# 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
}
# 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
}
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 }
# 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"
}
# 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'}"
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
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 {
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}
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
gdb_load $binfile
send_gdb "set language chill\n"
- expect {
+ gdb_expect {
-re ".*$gdb_prompt $" {}
timeout { fail "set language chill (timeout)" ; return 0 }
}
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}
gdb_load $binfile
send_gdb "set language chill\n"
- expect {
+ gdb_expect {
-re ".*$gdb_prompt $" {}
timeout { fail "set language chill (timeout)" ; return 0 }
}
gdb_load $binfile
send_gdb "set language chill\n"
- expect {
+ gdb_expect {
-re ".*$gdb_prompt $" {}
timeout { fail "set language chill (timeout)" ; return 0 }
}
gdb_load $binfile
send_gdb "set language chill\n"
- expect {
+ gdb_expect {
-re ".*$gdb_prompt $" {}
timeout { fail "set language chill (timeout)" ; return 0 }
}
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 {
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\)'}
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" {"'"}
}
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 {
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\] ""
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'\]}
gdb_load $binfile
send_gdb "set language chill\n"
- expect {
+ gdb_expect {
-re ".*$gdb_prompt $" {}
timeout { fail "set language chill (timeout)" ; return 0 }
}
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\]}
}
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 {
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"
}
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"
gdb_load $binfile
send_gdb "set language chill\n"
- expect {
+ gdb_expect {
-re ".*$gdb_prompt $" {}
timeout { fail "set language chill (timeout)" ; return 0 }
}
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 {
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 {
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"
global decimal
send_gdb "x/12i add_tests\n"
- expect {
+ gdb_expect {
-re "
.*add d1,d2.*
.*add d2,a3.*
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>.*
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>.*
global decimal
send_gdb "x/4 bit_tests\n"
- expect {
+ gdb_expect {
-re "
.*btst 64,d1.*
.*btst 8192,d2.*
global decimal
send_gdb "x/9i cmp_tests\n"
- expect {
+ gdb_expect {
-re "
.*cmp d1,d2.*
.*cmp d2,a3.*
global decimal
send_gdb "x/5i extend_tests\n"
- expect {
+ gdb_expect {
-re "
.*ext d1.*
.*extx d2.*
global decimal
send_gdb "x/11i logical_tests\n"
- expect {
+ gdb_expect {
-re "
.*and d1,d2.*
.*and 127,d2.*
global decimal
send_gdb "x/12i mov_tests_1\n"
- expect {
+ gdb_expect {
-re "
.*mov d1,a2.*
.*mov a2,d1.*
global decimal
send_gdb "x/9 mov_tests_2\n"
- expect {
+ gdb_expect {
-re "
.*mov \\(d1,a1\\),d2.*
.*mov \\(0x8000.*\\),d1.*
global decimal
send_gdb "x/10 mov_tests_3\n"
- expect {
+ gdb_expect {
-re "
.*mov d1,\\(a2\\).*
.*mov d1,\\(32,a2\\).*
global decimal
send_gdb "x/8 mov_tests_4\n"
- expect {
+ gdb_expect {
-re "
.*mov a1,\\(d2,a2\\).*
.*mov a1,\\(0x80.*\\).*
global decimal
send_gdb "x/12 movb_tests\n"
- expect {
+ gdb_expect {
-re "
.*movb \\(8,a2\\),d1.*
.*movb \\(256,a2\\),d1.*
global decimal
send_gdb "x/7 movbu_tests\n"
- expect {
+ gdb_expect {
-re "
.*movbu \\(a2\\),d1.*
.*movbu \\(8,a2\\),d1.*
global decimal
send_gdb "x/6 movx_tests\n"
- expect {
+ gdb_expect {
-re "
.*movx \\(8,a2\\),d1.*
.*movx \\(256,a2\\),d1.*
global decimal
send_gdb "x/3 muldiv_tests\n"
- expect {
+ gdb_expect {
-re "
.*mul d1,d2.*
.*mulu d2,d3.*
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>.*
global decimal
send_gdb "x/4i shift_tests\n"
- expect {
+ gdb_expect {
-re "
.*asr d2.*
.*lsr d3.*
global decimal
send_gdb "x/9i sub_tests\n"
- expect {
+ gdb_expect {
-re "
.*sub d1,d2.*
.*sub d2,a3.*
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. $"\
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 }
}
}
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;
timeout { perror "Jump to start() failed (timeout)"; return }
}
if [target_info exists gdb_stub] {
- expect {
+ gdb_expect {
-re ".*$gdb_prompt $" {
send_gdb "continue\n"
}
}
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
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 $" {}
# 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
}
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 }
}
}
- 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."
}
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 {
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 {
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
}
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
# 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
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"
}
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;
}
send_gdb "file $arg\n"
- expect {
+ gdb_expect {
-re "Reading symbols from.*done.*$gdb_prompt $" {
verbose "\t\tLoaded $arg into the $GDB"
return 0
}
-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
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
}
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."
}
}
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
}