diff options
author | Bob Manson <manson@cygnus> | 1997-01-29 09:40:31 +0000 |
---|---|---|
committer | Bob Manson <manson@cygnus> | 1997-01-29 09:40:31 +0000 |
commit | 787f6220773d9174a9675dedd3bbfc8f070511a6 (patch) | |
tree | 64911c10d46bc93973cc825a730b4173b3367a49 /gdb/testsuite/config | |
parent | 1a2faf1f1e335ff32c1d8c5c7675cd7ce9055e33 (diff) | |
download | gdb-787f6220773d9174a9675dedd3bbfc8f070511a6.zip gdb-787f6220773d9174a9675dedd3bbfc8f070511a6.tar.gz gdb-787f6220773d9174a9675dedd3bbfc8f070511a6.tar.bz2 |
Major revision to testsuites for cross-testing and DOS testing support.
Diffstat (limited to 'gdb/testsuite/config')
18 files changed, 1678 insertions, 753 deletions
diff --git a/gdb/testsuite/config/abug.exp b/gdb/testsuite/config/abug.exp index 8bd4532..1a2f7a9 100644 --- a/gdb/testsuite/config/abug.exp +++ b/gdb/testsuite/config/abug.exp @@ -1,2 +1 @@ -push_target mvme135 load_lib ../config/monitor.exp diff --git a/gdb/testsuite/config/d10v.exp b/gdb/testsuite/config/d10v.exp new file mode 100644 index 0000000..7809093 --- /dev/null +++ b/gdb/testsuite/config/d10v.exp @@ -0,0 +1 @@ +load_lib "../config/monitor.exp" diff --git a/gdb/testsuite/config/gdbserver.exp b/gdb/testsuite/config/gdbserver.exp new file mode 100644 index 0000000..e9e873e --- /dev/null +++ b/gdb/testsuite/config/gdbserver.exp @@ -0,0 +1,105 @@ +# Test Framework Driver for GDB using the extended gdb remote protocol +# Copyright 1995 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +# +# For this to function correctly, you need to set a number of variables +# in your gdb/site.exp file +# +# set noargs 1 -- we can't pass arguments (yet) +# set noinferiorio 1 -- we can't get io to/from the inferior +# set targethost <host> -- name of the remote system (runs gdbserver) +# set debughost <host> -- name of the system running gdb +# set port <number> -- starting port number for communication +# set gdbserver <path> -- path (on the remote side) to find +# gdbserver +# set rsh <path> -- path (on debughost side) to rsh +# set rcp <path> -- path (on debughost side) to rcp +# +# You will need to be able to spawn processes from gdbhost to run on +# targethost via rsh (this is how we start gdbserver); similarly +# you need to be able to rcp files from gdbhost to targethost. +# +# We don't do much error checking, if something goes wrong, you'll probably +# just get a tcl error and everything will die. FIXME +# + +# Load the basic gdb testing library +load_lib gdb.exp +load_lib monitor.exp + +# +# gdb_load -- load a file into the debugger. +# return a -1 if anything goes wrong. +# +# Loading a file in the gdbsrever framework is a little strange in that +# we also create the inferior (which is stopped at the first instruction +# in the program when we get control). +# +proc gdb_load { arg } { + global verbose + global loadpath + global loadfile + global GDB + global prompt + global debughost + global port + + # first load the file into gdb + if [gdb_file_cmd $arg] then { return -1 } + + # bump the port number to avoid conflicts with hung ports + set targethost [target_info gdb_server_host]; + set debughost [target_info gdb_debug_host]; + if [target_info exists gdb_server_prog] { + set gdbserver [target_info gdb_server_prog]; + } else { + set gdbserver "gdbserver"; + } + incr port + set serialport $targethost:$port + + # Copy the file down to the remote host. + set file [remote_download host $arg]; + + # now start gdbserver on the remote side + remote_spawn host "$gdbserver $debughost:$port $file >& /dev/null < /dev/null" + + # give it plenty of time to get going (lynx) + sleep 30 + + # tell gdb we are remote debugging + gdb_target_monitor + + return 1 +} + +# +# gdb_start -- start GDB running. +# +proc gdb_start { } { + global prompt + + # do the usual stuff + catch default_gdb_start + + # FIXME: This shouldn't be necessary, but lots of PA tests fail + # without it. + send "set remotecache 0\n" + expect { + -re "set remotecache 0\[\r\n\]+.*$prompt $" {} + default { fail "gdb_start"} + } +} diff --git a/gdb/testsuite/config/m32r-stub.exp b/gdb/testsuite/config/m32r-stub.exp new file mode 100644 index 0000000..d3c7058 --- /dev/null +++ b/gdb/testsuite/config/m32r-stub.exp @@ -0,0 +1,463 @@ +# Copyright (C) 1996 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# DejaGnu@cygnus.com + +# This file was written by Michael Snyder <msnyder@cygnus.com>. + +# GDB support routines for a board using Mitsubishi M32R remote debugging +# protocol. + +load_lib remote.exp +load_lib gdb.exp + + +# +# M32R remote run command. +# +# This requires that we beep the user and ask him to push the board reset! +# Then we will switch to the monitor target, run the program, use 2 ^C's +# to interrupt the monitor target, and switch back to the remote target. +# Then we have to do a continue to get past the stub breakpoint. +# + +proc gdb_run_cmd {} { + global prompt + global gdb_spawn_id + + set timeout 60 + verbose "Timeout is now $timeout seconds, starting remote stub" 2 + send_user "Please reset the board now...\n" + sleep 1 + send_user "\n" + sleep 1 + send_user "\n" + sleep 1 + send_user "\n" + + # go back to monitor, run the program, interrupt it, and start remote. + + if [target_info exists gdb_protocol] { + set protocol [target_info gdb_protocol]; + } else { + set protocol "sparclet" + } + if [target_info exists serial] { + set targetname [target_info serial]; + send_gdb "target $protocol [target_info serial]\n"; + } else { + if ![target_info exists netport] { + perror "Need either netport or gdb_serial entry for [target_info name]."; + return -1; + } + set targetname [target_info netport]; + 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. $" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re "Remote target.*$prompt $" { } + -i $gdb_spawn_id -re ".*SPARCLET appears to be alive.*$prompt $" { + if $verbose>1 then { + send_user "Set target to $targetname\n" + } + } + -i $gdb_spawn_id timeout { + set timeout 10 + verbose "Timeout is now $timeout seconds" 2 + perror "Couldn't set M32R target." + return -1 + } + } + + send_gdb "disable\n"; + expect { + -i $gdb_spawn_id -re ".*$prompt $" { + verbose "Breakpoints disabled" 2 + } + -i $gdb_spawn_id timeout { + perror "(timeout) disabling breakpoints"; + return -1 + } + -i $gdb_spawn_id 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. $" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re "The program being debugged .*y or n. $" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re ".*Starting program:.*$" { + verbose "Starting remote stub succeeded" + } + -i $gdb_spawn_id timeout { + perror "(timeout) starting the remote stub" ; + return -1 + } + -i $gdb_spawn_id default { + perror "error starting the remote stub"; + } + } + sleep 2; + send_gdb "" + sleep 1; + send_gdb "" + verbose "Sent ^C^C" + expect { + -i $gdb_spawn_id -re ".*Give up .and stop debugging it.*$" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re ".*$prompt $" { + verbose "interrupting remote stub succeeded" + } + -i $gdb_spawn_id timeout { + perror "(timeout) interrupting the remote stub"; + return -1 + } + -i $gdb_spawn_id 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.*" { + send_gdb "y\n"; + exp_continue + } + -i $gdb_spawn_id -re ".*$prompt $" { + verbose "connected to stub at [target_info gdb_serial]" 2 + } + -i $gdb_spawn_id timeout { + set timeout 10 + verbose "Timeout is now $timeout seconds" 2 + perror "Couldn't set remote target." + return -1 + } + } + } + + send_gdb "enable\n"; + expect { + -i $gdb_spawn_id -re ".*$prompt $" { + verbose "Breakpoints enabled" 2 + } + -i $gdb_spawn_id timeout { + perror "(timeout) enabling breakpoints"; + return -1 + } + -i $gdb_spawn_id default { + perror "error enabling breakpoints"; + } + } + send_gdb "continue\n"; + return +} + + +# +# gdb_load -- load a file into the GDB. +# Returns a 0 if there was an error, +# 1 if it load successfully. +# +proc gdb_load { arg } { + global verbose + global loadpath + global loadfile + global prompt + global GDB + global expect_out + global gdb_spawn_id + + set loadfile [file tail $arg] + set loadpath [file dirname $arg] + + if [target_info exists gdb_protocol] { + set protocol [target_info gdb_protocol]; + } else { + set protocol "m32r" + } + + # 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. $" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re "Load new symbol table.*y or n. $" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re "Reading symbols from.*done..*$prompt $" {} + -i $gdb_spawn_id -re "$prompt $" { perror "GDB couldn't find loader" } + -i $gdb_spawn_id timeout { + perror "(timeout) read symbol file" ; + return -1 + } + } + + if [target_info exists serial] { + set targetname [target_info serial]; + send_gdb "target $protocol [target_info serial]\n"; + } else { + if ![target_info exists netport] { + perror "Need either netport or gdb_serial entry for [target_info name]."; + return -1; + } + set targetname [target_info netport]; + send_gdb "target $protocol udp [target_info netport]\n"; + } + expect { + -i $gdb_spawn_id -re "Remote target.*$prompt $" { } + -i $gdb_spawn_id -re ".*SPARCLET appears to be alive.*$prompt $" { + if $verbose>1 then { + send_user "Set target to $targetname\n" + } + } + -i $gdb_spawn_id timeout { + set timeout 10 + verbose "Timeout is now $timeout seconds" 2 + perror "Couldn't set M32R target." + return -1 + } + } + + send_gdb "run\n"; + expect { + -i $gdb_spawn_id -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. $" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re ".*Starting program:.*loader.*$" { + verbose "Starting loader succeeded" + } + -i $gdb_spawn_id timeout { + perror "(timeout) starting the loader" ; + return -1 + } + -i $gdb_spawn_id default { + perror "error starting the loader"; + } + } + sleep 2; + send_gdb "" + sleep 1; + send_gdb "" + verbose "Sent ^C^C" + expect { + -i $gdb_spawn_id -re ".*Give up .and stop debugging it.*$" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re ".*$prompt $" { + verbose "Running loader succeeded" + } + -i $gdb_spawn_id timeout { + perror "(timeout) interrupting the loader" ; + return -1 + } + -i $gdb_spawn_id 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. $" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re "Load new symbol table.*y or n. $" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re "Reading symbols from.*done..*$prompt $" {} + -i $gdb_spawn_id -re "$prompt $" { perror "GDB couldn't read file" } + -i $gdb_spawn_id 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.*" { + send_gdb "y\n"; + exp_continue + } + -i $gdb_spawn_id -re ".*$prompt $" { + verbose "Set remote target to [target_info serial]" 2 + } + -i $gdb_spawn_id timeout { + set timeout 10 + verbose "Timeout is now $timeout seconds" 2 + perror "Couldn't set remote target." + return -1 + } + } + } + if [target_info exists gdb_load_offset] { + set offset "[target_info gdb_load_offset]"; + } else { + set offset ""; + } + send_gdb "load $arg $offset\n" + verbose "Loading $arg into $GDB" 2 + set timeout 1200 + verbose "Timeout is now $timeout seconds" 2 + expect { + -i $gdb_spawn_id -re "Loading.*$prompt $" { + verbose "Loaded $arg into $GDB" 1 + set timeout 60 + verbose "Timeout is now $timeout seconds" 2 + } + -i $gdb_spawn_id -re "$prompt $" { + if $verbose>1 then { + perror "GDB couldn't load." + } + } + -i $gdb_spawn_id timeout { + if $verbose>1 then { + perror "Timed out trying to load $arg." + } + } + } + + send_user "Please reset the board now...\n" + sleep 1 + send_user "\n" + sleep 1 + send_user "\n" + sleep 1 + send_user "\n" + + # go back to monitor, run the program, interrupt it, and start remote. + + if [target_info exists serial] { + set targetname [target_info serial]; + send_gdb "target $protocol [target_info serial]\n"; + } else { + if ![target_info exists netport] { + perror "Need either netport or gdb_serial entry for [target_info name]."; + return -1; + } + set targetname [target_info netport]; + 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. $" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re "Remote target.*$prompt $" { } + -i $gdb_spawn_id -re ".*SPARCLET appears to be alive.*$prompt $" { + if $verbose>1 then { + send_user "Set target to $targetname\n" + } + } + -i $gdb_spawn_id timeout { + set timeout 10 + verbose "Timeout is now $timeout seconds" 2 + perror "Couldn't set M32R target." + return -1 + } + } + + send_gdb "run\n"; + expect { + -i $gdb_spawn_id -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. $" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re ".*Starting program:.*$" { + verbose "Starting remote stub succeeded" + } + -i $gdb_spawn_id timeout { + perror "(timeout) starting the remote stub" ; + return -1 + } + -i $gdb_spawn_id default { + perror "error starting the remote stub"; + } + } + sleep 2; + send_gdb "" + sleep 1; + send_gdb "" + verbose "Sent ^C^C" + expect { + -i $gdb_spawn_id -re ".*Give up .and stop debugging it.*$" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re ".*$prompt $" { + verbose "interrupting remote stub succeeded" + } + -i $gdb_spawn_id timeout { + perror "(timeout) interrupting the remote stub"; + return -1 + } + -i $gdb_spawn_id 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.*" { + send_gdb "y\n"; + exp_continue + } + -i $gdb_spawn_id -re ".*$prompt $" { + verbose "connected to stub at [target_info gdb_serial]" 2 + } + -i $gdb_spawn_id timeout { + set timeout 10 + verbose "Timeout is now $timeout seconds" 2 + perror "Couldn't set remote target." + return -1 + } + } + } + return 0 +} + diff --git a/gdb/testsuite/config/mips-gdb.exp b/gdb/testsuite/config/mips-gdb.exp deleted file mode 100644 index ce58ee5..0000000 --- a/gdb/testsuite/config/mips-gdb.exp +++ /dev/null @@ -1,251 +0,0 @@ -# Copyright (C) 1993 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -# Please email any bugs, comments, and/or additions to this file to: -# DejaGnu@cygnus.com - -# This file was written by Ian Lance Taylor <ian@cygnus.com>. - -# GDB support routines for a board using the MIPS remote debugging -# protocol. These are actually pretty generic. - -# DejaGnu currently assumes that debugging is being done over the main -# console port. It would probably be more convenient for people using -# IDT boards to permit the debugging port and the connected port to be -# different, since an IDT board has two ports. This would require -# extending some of the tests in a fashion similar to that done for -# VxWorks, because the test output would appear on the other port, -# rather than being displayed by gdb. - -load_lib remote.exp -load_lib gdb.exp - -# -# gdb_version -- extract and print the version number of gdb -# -proc gdb_version {} { - global GDB - global GDBFLAGS - global prompt - set tmp [exec echo "q" | $GDB] - set version [lindex $tmp [lsearch $tmp "\[0-9\]*"]] - set version [string range $version 0 [expr [string length $version]-2]] - clone_output "[which $GDB] version $version $GDBFLAGS\n" -} - -# -# gdb_load -- load a file into the GDB. -# Returns a 0 if there was an error, -# 1 if it load successfully. -# -proc gdb_load { arg } { - global verbose - global loadpath - global loadfile - global prompt - global spawn_id - global GDB - global expect_out - global targetname - - set loadfile [file tail $arg] - set loadpath [file dirname $arg] - - send "file $arg\n" - expect { - -re "A program is being debugged already..*Kill it.*y or n. $" { - send "y\n" - exp_continue - } - -re "Reading symbols from.*done..*$prompt $" {} - -re "$prompt $" { perror "GDB couldn't read file" } - timeout { perror "(timeout) read symbol file" ; return -1 } - } - - send "target mips $targetname\n" - set timeout 60 - verbose "Timeout is now $timeout seconds" 2 - expect { - -re "Remote MIPS debugging.*$prompt $" { - if $verbose>1 then { - send_user "Set target to $targetname\n" - } - } - timeout { - perror "Couldn't set MIPS target." - set timeout 10 - verbose "Timeout is now $timeout seconds" 2 - return -1 - } - } - - send "load $arg\n" - if $verbose>1 then { - send_user "Loading $arg into $GDB\n" - } - set timeout 2400 - verbose "Timeout is now $timeout seconds" 2 - expect { - -re "Loading.*$prompt $" { - if $verbose>1 then { - send_user "Loaded $arg into $GDB\n" - } - set timeout 30 - verbose "Timeout is now $timeout seconds" 2 - } - -re "$prompt $" { - if $verbose>1 then { - perror "GDB couldn't load." - } - } - timeout { - if $verbose>1 then { - perror "Timed out trying to load $arg." - } - } - } - set timeout 10 - verbose "Timeout is now $timeout seconds" 2 - if [info exists expect_out(buffer)] then { - send_log $expect_out(buffer) - } - return 0 -} - -# -# gdb_start -- start GDB running. -# -proc gdb_start { } { - global GDB - global GDBFLAGS - global spawn_id - global shell_id - global prompt - global verbose - global targetname - global connectmode - global reboot - global baud - - # reboot the board to get a clean start - if $reboot then { - if ![info exists connectmode] then { - set connectmode "kermit" - } - if ![info exists baud] then { - set baud 9600 - } - set shell_id [ eval $connectmode "$targetname" ] - send -i $shell_id "\n" - expect { - -i $shell_id -re "<IDT>$" { } - timeout { - send -i $shell_id "\CC" - expect { - -i $shell_id -re "<IDT>$" { } - timeout { - perror "(timeout) board did not come up."; return -1 - } - } - } - } - send -i $shell_id "go 0xbfc00000\n" - expect { - -i $shell_id -re "<IDT>$" { } - timeout { perror "(timeout) board did not come up."; return -1 } - } - verbose "about to exit kermit" - exit_remote_shell $shell_id - } - - set GDB [which $GDB] - # start GDB - if [ llength $GDBFLAGS ] then { - spawn $GDB $GDBFLAGS - } else { - spawn $GDB - } - expect { - -re ".*\r\n$prompt $" { - verbose "GDB initialized." - } - -re "$prompt $" { - perror "GDB never initialized." - return -1 - } - timeout { - perror "(timeout) GDB never initialized." - return -1 - } - } - - # force the height to "unlimited", so no pagers get used - send "set height 0\n" - expect -re ".*$prompt $" {} - # force the width to "unlimited", so no wraparound occurs - send "set width 0\n" - expect -re ".*$prompt $" {} - - # Don't use floating point instructions, in case the board doesn't - # support them. - send "set mipsfpu off\n" - expect -re ".*$prompt $" {} - -# if $verbose>1 then { -# send_user "Setting up target, please wait...\n" -# } -# send "target mips $targetname\n" -# set timeout 60 -# verbose "Timeout is now $timeout seconds" 2 -# expect { -# -re "Remote MIPS debugging.*$prompt $" { -# if $verbose>1 then { -# send_user "Set target to $targetname\n" -# } -# } -# timeout { -# perror "Couldn't set MIPS target." -# set timeout 10 -# verbose "Timeout is now $timeout seconds" 2 -# return -1 -# } -# } - set timeout 10 - verbose "Timeout is now $timeout seconds" 2 -} - -expect_after { - "<return>" { send "\n"; perror "Window too small." } - -re "\(y or n\) " { send "n\n"; perror "Got interactive prompt." } - full_buffer { perror "internal buffer is full." } - eof { perror "eof -- pty is hosed." } - timeout { perror "timeout." } - "virtual memory exhausted" { perror "virtual memory exhausted." } - "Undefined command" { perror "send string probably wrong." } -} - -proc gdb_exit { } { - catch default_gdb_exit -} - -gdb_start - -# make sure gdb has actually started, otherwise if the first test -# timesout, DejaGnu crashes -send "\n" -expect { - -re "$prompt" - } diff --git a/gdb/testsuite/config/mips-idt.exp b/gdb/testsuite/config/mips-idt.exp new file mode 100644 index 0000000..2adaa75 --- /dev/null +++ b/gdb/testsuite/config/mips-idt.exp @@ -0,0 +1,22 @@ +# Copyright (C) 1993 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +# Please email any bugs, comments, and/or additions to this file to: +# DejaGnu@cygnus.com + +load_lib ../config/monitor.exp + + diff --git a/gdb/testsuite/config/mips.exp b/gdb/testsuite/config/mips.exp new file mode 100644 index 0000000..2adaa75 --- /dev/null +++ b/gdb/testsuite/config/mips.exp @@ -0,0 +1,22 @@ +# Copyright (C) 1993 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +# Please email any bugs, comments, and/or additions to this file to: +# DejaGnu@cygnus.com + +load_lib ../config/monitor.exp + + diff --git a/gdb/testsuite/config/monitor.exp b/gdb/testsuite/config/monitor.exp index 9c6d9b1..a8e79be 100644 --- a/gdb/testsuite/config/monitor.exp +++ b/gdb/testsuite/config/monitor.exp @@ -18,40 +18,47 @@ load_lib gdb.exp # -# gdb_version -- extract and print the version number of gdb -# -proc gdb_version {} { - default_gdb_version -} - -# # gdb_target_monitor # Set gdb to target the monitor # proc gdb_target_monitor { } { global prompt global exit_status - global targetname - global serialport - global baud - global target_info + global timeout set timeout 60 - if {$baud != ""} then { - send "set remotebaud $baud\n" + + verbose "Timeout is now $timeout seconds" 2 + if [target_info exists gdb_protocol] { + set targetname "[target_info gdb_protocol]" + } else { + perror "No protocol specified for [target_info name]."; + return -1; } - if [info exists target_info(target,cflags)] { - set targetname "$target_info(target,target)" + if [target_info exists baud] { + send_gdb "set remotebaud [target_info baud]\n" } - if [info exists target_info(target,netport)] { - set serialport "$target_info(target,netport)" + if [target_info exists netport] { + set serialport "[target_info netport]" + } else { + set serialport "[target_info serial]" } - for {set i 1} {$i <= 3} {incr i} { - send "target $targetname $serialport\n" - expect { - -re "Remote target $targetname connected to.*$prompt $" { - verbose "Set target to $targetname" - return + + for {set j 1} {$j <= 2} {incr j} { + for {set i 1} {$i <= 3} {incr i} { + send_gdb "target $targetname $serialport\n" + expect { + -re "Remote MIPS debugging.*" { + verbose "Set target to $targetname" + return + } + -re "Remote debugging using $serialport.*" { + verbose "Set target to $targetname" + return + } + -re "Remote target $targetname connected to.*" { + verbose "Set target to $targetname" + return } -re "Connection refused" { verbose "Connection refused by remote target. Pausing, and trying again." @@ -61,10 +68,14 @@ proc gdb_target_monitor { } { timeout { break } + } + } + if { $j == 1 && ![reboot_target] } { + break; } } - perror "Couldn't set target for $targetname." + perror "Couldn't set target for $targetname, port is $serialport." cleanup exit $exit_status } @@ -79,14 +90,23 @@ proc gdb_load { arg } { global loadfile global GDB global prompt + global timeout - if [gdb_file_cmd $arg] then { return -1 } + if { $arg != "" } { + if [gdb_file_cmd $arg] { return -1 } + } gdb_target_monitor + if [is_remote host] { + # FIXME: + set arg a.out; + } + verbose "Loading $arg" - send "load $arg\n" - set timeout 600 + send_gdb "load $arg\n" + set timeout 1000 + verbose "Timeout is now $timeout seconds" 2 expect { -re ".*$prompt $" { if { $verbose > 1 } { @@ -101,24 +121,22 @@ proc gdb_load { arg } { } timeout { if { $verbose > 1 } { - perror "Timed out trying to load $arg." + perror "Timed out trying to load $arg." } } } } -# -# gdb_start -- start GDB running. -# proc gdb_start { } { - default_gdb_start -} + global timeout + global reboot -# -# gdb_exit -- exit gdb -# -proc gdb_exit { } { - catch default_gdb_exit -} + # reboot the board to get a clean start + if $reboot then { + reboot_target; + } + catch default_gdb_start; -gdb_start + set timeout 10 + verbose "Timeout is now $timeout seconds" 2 +} diff --git a/gdb/testsuite/config/netware.exp b/gdb/testsuite/config/netware.exp index 7dcad4d..aa170bb 100644 --- a/gdb/testsuite/config/netware.exp +++ b/gdb/testsuite/config/netware.exp @@ -23,7 +23,6 @@ load_lib gdb.exp load_lib remote.exp global shell_id -global passwd global LD if ![info exists LD] then { @@ -55,9 +54,11 @@ proc gdb_load { arg } { global LD global NLMCONV global errorCode - global targetname global shell_id + # FIXME: this is wrong. + set targetname [target_info name]; + set obj [file tail $arg] set nlm "$obj.nlm" set lnk "$obj.lnk" @@ -101,21 +102,24 @@ proc gdb_load { arg } { gdb_file_cmd $nlm } -proc gdb_start { } { - default_gdb_start -} - -proc gdb_exit { } { - catch default_gdb_exit -} - proc gdb_run_cmd { } { global shell_id global prompt - global baud serialport - global targetname global timeout + set connhost [target_info name]; + if [board_info $connhost exists serial] { + set serialport [board_info $connhost serial]; + } else { + set serialport [board_info $connhost netport]; + } + + if [board_info $connhost exists baud] { + set baud [board_info $connhost baud]; + } else { + set baud 9600; + } + # FIXME: This is wrong. send "kill\n" expect { -re ".*Kill the program being debugged.*y or n. $" { @@ -125,7 +129,7 @@ proc gdb_run_cmd { } { -re ".*$prompt $" {} } - verbose "Starting GDB stub on $targetname" 1 + verbose "Starting GDB stub on [target_info name]" 1 send -i $shell_id "load nlmstub BAUD=$baud x.nlm\r\n" send "set remotebaud $baud\n" @@ -148,12 +152,14 @@ proc gdb_run_cmd { } { } -re "$prompt" {} timeout { + set timeout $otimeout + verbose "Timeout restored to $timeout seconds" 2 perror "Couldn't set remote target" return } } set timeout $otimeout - verbose "Timeout is now $timeout seconds" 2 + verbose "Timeout restored to $timeout seconds" 2 send "continue\n" expect { @@ -170,7 +176,7 @@ proc gdb_run_cmd { } { # set shell_prompt "Password:" -set shell_id [ eval $connectmode "$targetname" ] +set shell_id [remote_open target] if $shell_id<0 then { warning "Couldn't connect to target" @@ -199,7 +205,8 @@ expect { } -set shell_prompt "[string toupper $targetname]:" +# FIXME: this is wrong. +set shell_prompt "[string toupper [target_info name]]:" send -i $shell_id "1\n" expect { @@ -209,5 +216,3 @@ expect { return -1 } } - -gdb_start diff --git a/gdb/testsuite/config/nind-gdb.exp b/gdb/testsuite/config/nind.exp index 52673f1..f44cc58 100644 --- a/gdb/testsuite/config/nind-gdb.exp +++ b/gdb/testsuite/config/nind.exp @@ -20,23 +20,7 @@ # This file was written by Rob Savoye. (rob@cygnus.com) -# these need to be initialized only if site.exp doesn't set them -if ![info exists prompt] then { - set prompt "\(gdb\)" -} - -# -# gdb_version -- extract and print the version number of gdb -# -proc gdb_version {} { - global GDB - global GDBFLAGS - global prompt - set tmp [exec echo "q" | $GDB] - set version [lindex $tmp [lsearch $tmp "\[0-9\]*"]] - set version [string range $version 0 [expr [string length $version]-2]] - clone_output "[which $GDB] version $version $GDBFLAGS\n" -} +load_lib gdb.exp # # gdb_load -- load a file into the debugger. @@ -61,27 +45,5 @@ proc gdb_start { } { global spawn_id global prompt global verbose - global targetname send_user "Not implememted yet\n" ; return -1 } - -expect_after { - "<return>" { send "\n"; clone_output "ERROR: Window too small" } - -re "\(y or n\) " { send "n\n"; clone_output "ERROR: Got interactive prompt" } - full_buffer { clone_output "ERROR: internal buffer is full" } - eof { clone_output "ERROR: eof -- pty is hosed" } - timeout { clone_output "ERROR: timeout" } - "virtual memory exhausted" { clone_output "ERROR: virtual memory exhausted" } - "Undefined command" { clone_output "ERROR: send string probably wrong" } -} - -load_lib gdb.exp - -gdb_start - -# make sure gdb has actually started, otherwise if the first test -# timesout, DejaGnu crashes -send "\n" -expect { - -re "$prompt" - } diff --git a/gdb/testsuite/config/sim-gdb.exp b/gdb/testsuite/config/sim.exp index 58dcca8..4c76cac 100644 --- a/gdb/testsuite/config/sim-gdb.exp +++ b/gdb/testsuite/config/sim.exp @@ -17,13 +17,6 @@ load_lib gdb.exp -# -# gdb_version -- extract and print the version number of gdb -# -proc gdb_version {} { - default_gdb_version -} - # The SH simulator by default will allocate 16M of memory, which is # convenient, but it slows down testing to chew up that much swap; # so supply an option that makes the simulator allocate 256K. @@ -39,13 +32,14 @@ if [istarget "sh*-*-*"] then { # Set gdb to target the simulator # proc gdb_target_sim { } { - global targetname global prompt global verbose global exit_status global target_sim_options + global gdb_spawn_id - send "target sim $target_sim_options\n" + set spawn_id $gdb_spawn_id + send_gdb "target sim $target_sim_options\n" set timeout 60 verbose "Timeout is now $timeout seconds" 2 expect { @@ -72,12 +66,15 @@ proc gdb_load { arg } { global loadfile global GDB global prompt + global gdb_spawn_id + + set spawn_id $gdb_spawn_id if [gdb_file_cmd $arg] then { return -1 } gdb_target_sim - send "load\n" + send_gdb "load\n" set timeout 2400 verbose "Timeout is now $timeout seconds" 2 expect { @@ -101,27 +98,3 @@ proc gdb_load { arg } { } } } - -# -# gdb_start -- start GDB running. -# -proc gdb_start { } { - default_gdb_start - verbose "Setting up target, Please wait..." -} - -# -# gdb_exit -- exit gdb -# -proc gdb_exit { } { - catch default_gdb_exit -} - -gdb_start - -# make sure gdb has actually started, otherwise if the first test -# timesout, DejaGnu crashes -send "\n" -expect { - -re "$prompt" - } diff --git a/gdb/testsuite/config/slite-gdb.exp b/gdb/testsuite/config/slite-gdb.exp deleted file mode 100644 index 58fd2f2..0000000 --- a/gdb/testsuite/config/slite-gdb.exp +++ /dev/null @@ -1,273 +0,0 @@ -# Copyright (C) 1993 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -# Please email any bugs, comments, and/or additions to this file to: -# DejaGnu@cygnus.com - -# This file was written by Ian Lance Taylor <ian@cygnus.com>. - -# GDB support routines for a board using the MIPS remote debugging -# protocol. These are actually pretty generic. - -# DejaGnu currently assumes that debugging is being done over the main -# console port. It would probably be more convenient for people using -# IDT boards to permit the debugging port and the connected port to be -# different, since an IDT board has two ports. This would require -# extending some of the tests in a fashion similar to that done for -# VxWorks, because the test output would appear on the other port, -# rather than being displayed by gdb. - -load_lib remote.exp -load_lib gdb.exp - -# -# gdb_version -- extract and print the version number of gdb -# -proc gdb_version {} { - global GDB - global GDBFLAGS - global prompt - set tmp [exec echo "q" | $GDB] - set version [lindex $tmp [lsearch $tmp "\[0-9\]*"]] - set version [string range $version 0 [expr [string length $version]-2]] - clone_output "[which $GDB] version $version $GDBFLAGS\n" -} - -# -# gdb_load -- load a file into the GDB. -# Returns a 0 if there was an error, -# 1 if it load successfully. -# -proc gdb_load { arg } { - global verbose - global loadpath - global loadfile - global prompt - global spawn_id - global GDB - global expect_out - global targetname - - set loadfile [file tail $arg] - set loadpath [file dirname $arg] - - send "file $arg\n" - expect { - -re "A program is being debugged already..*Kill it.*y or n. $" { - send "y\n" - exp_continue - } - -re "Load new symbol table.*y or n. $" { - send "y\n" - exp_continue - } - -re "Reading symbols from.*done..*$prompt $" {} - -re "$prompt $" { perror "GDB couldn't read file" } - timeout { perror "(timeout) read symbol file" ; return -1 } - } - - send "target sparclite $targetname\n" - set timeout 60 - verbose "Timeout is now $timeout seconds" 2 - expect { - -re ".*SPARClite appears to be alive.*$prompt $" { - if $verbose>1 then { - send_user "Set target to $targetname\n" - } - } - timeout { - perror "Couldn't set SLITE target." - set timeout 10 - verbose "Timeout is now $timeout seconds" 2 - return -1 - } - } - - send "load $arg\n" - if $verbose>1 then { - send_user "Loading $arg into $GDB\n" - } - set timeout 2400 - verbose "Timeout is now $timeout seconds" 2 - expect { - -re "Loading.*$prompt $" { - if $verbose>1 then { - send_user "Loaded $arg into $GDB\n" - } - set timeout 30 - verbose "Timeout is now $timeout seconds" 2 - } - -re "$prompt $" { - if $verbose>1 then { - perror "GDB couldn't load." - } - } - timeout { - if $verbose>1 then { - perror "Timed out trying to load $arg." - } - } - } - set timeout 10 - verbose "Timeout is now $timeout seconds" 2 - - send "target remote $targetname\n" - set timeout 60 - verbose "Timeout is now $timeout seconds" 2 - expect { - -re ".*$prompt $" { - if $verbose>1 then { - send_user "Set remote target to $targetname\n" - } - } - timeout { - perror "Couldn't set remote target." - set timeout 10 - verbose "Timeout is now $timeout seconds" 2 - return -1 - } - } - - if [info exists expect_out(buffer)] then { - send_log $expect_out(buffer) - } - return 0 -} - -# -# gdb_start -- start GDB running. -# -proc gdb_start { } { - global GDB - global GDBFLAGS - global spawn_id - global shell_id - global prompt - global verbose - global targetname - global connectmode - global reboot - global baud - - # reboot the board to get a clean start - if $reboot then { - if ![info exists connectmode] then { - set connectmode "kermit" - } - if ![info exists baud] then { - set baud 9600 - } - set shell_id [ eval $connectmode "$targetname" ] - send -i $shell_id "\n" - expect { - -i $shell_id -re ">$" { } - timeout { - send -i $shell_id "\CC" - expect { - -i $shell_id -re ">$" { } - timeout { - perror "(timeout) board did not come up."; return -1 - } - } - } - } - send -i $shell_id "go 0xbfc00000\n" - expect { - -i $shell_id -re ">$" { } - timeout { perror "(timeout) board did not come up."; return -1 } - } - verbose "about to exit kermit" - exit_remote_shell $shell_id - } - - set GDB [which $GDB] - # start GDB - if [ llength $GDBFLAGS ] then { - spawn $GDB $GDBFLAGS - } else { - spawn $GDB - } - expect { - -re ".*\r\n$prompt $" { - verbose "GDB initialized." - } - -re "$prompt $" { - perror "GDB never initialized." - return -1 - } - timeout { - perror "(timeout) GDB never initialized." - return -1 - } - } - - # force the height to "unlimited", so no pagers get used - send "set height 0\n" - expect -re ".*$prompt $" {} - # force the width to "unlimited", so no wraparound occurs - send "set width 0\n" - expect -re ".*$prompt $" {} - - # Don't use floating point instructions, in case the board doesn't - # support them. - # send "set mipsfpu off\n" - # expect -re ".*$prompt $" {} - -# if $verbose>1 then { -# send_user "Setting up target, please wait...\n" -# } -# send "target mips $targetname\n" -# set timeout 60 -# verbose "Timeout is now $timeout seconds" 2 -# expect { -# -re "Remote MIPS debugging.*$prompt $" { -# if $verbose>1 then { -# send_user "Set target to $targetname\n" -# } -# } -# timeout { -# perror "Couldn't set MIPS target." -# set timeout 10 -# verbose "Timeout is now $timeout seconds" 2 -# return -1 -# } -# } - set timeout 10 - verbose "Timeout is now $timeout seconds" 2 -} - -expect_after { - "<return>" { send "\n"; perror "Window too small." } - -re "\(y or n\) " { send "n\n"; perror "Got interactive prompt." } - full_buffer { perror "internal buffer is full." } - eof { perror "eof -- pty is hosed." } - timeout { perror "timeout." } - "virtual memory exhausted" { perror "virtual memory exhausted." } - "Undefined command" { perror "send string probably wrong." } -} - -proc gdb_exit { } { - catch default_gdb_exit -} - -gdb_start - -# make sure gdb has actually started, otherwise if the first test -# timesout, DejaGnu crashes -send "\n" -expect { - -re "$prompt" - } diff --git a/gdb/testsuite/config/slite.exp b/gdb/testsuite/config/slite.exp new file mode 100644 index 0000000..7109a2e --- /dev/null +++ b/gdb/testsuite/config/slite.exp @@ -0,0 +1,168 @@ +# Copyright (C) 1993 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +# Please email any bugs, comments, and/or additions to this file to: +# DejaGnu@cygnus.com + +# This file was written by Ian Lance Taylor <ian@cygnus.com>. + +# GDB support routines for a board using the MIPS remote debugging +# protocol. These are actually pretty generic. + +# DejaGnu currently assumes that debugging is being done over the main +# console port. It would probably be more convenient for people using +# IDT boards to permit the debugging port and the connected port to be +# different, since an IDT board has two ports. This would require +# extending some of the tests in a fashion similar to that done for +# VxWorks, because the test output would appear on the other port, +# rather than being displayed by gdb. + +load_lib remote.exp +load_lib gdb.exp +set prompt "\\(gdb\\)" + +# +# gdb_load -- load a file into the GDB. +# Returns a 0 if there was an error, +# 1 if it load successfully. +# +proc gdb_load { arg } { + global verbose + global loadpath + global loadfile + global prompt + global GDB + global expect_out + global gdb_spawn_id + + set loadfile [file tail $arg] + set loadpath [file dirname $arg] + + send_gdb "file $arg\n" + expect { + -i $gdb_spawn_id -re "A program is being debugged already..*Kill it.*y or n. $" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re "Load new symbol table.*y or n. $" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re "Reading symbols from.*done..*$prompt $" {} + -i $gdb_spawn_id -re "$prompt $" { perror "GDB couldn't read file" } + -i $gdb_spawn_id timeout { perror "(timeout) read symbol file" ; return -1 } + } + + if [target_info exists gdb_protocol] { + set protocol [target_info gdb_protocol]; + } else { + set protocol "sparclite" + } + + if [target_info exists serial] { + set targetname [target_info serial]; + send_gdb "target $protocol [target_info serial]\n"; + } else { + if ![target_info exists netport] { + perror "Need either netport or gdb_serial entry for [target_info name]."; + return -1; + } + set targetname [target_info netport]; + send_gdb "target $protocol udp [target_info netport]\n"; + } + set timeout 60 + verbose "Timeout is now $timeout seconds" 2 + expect { + -i $gdb_spawn_id -re "Remote target.*$prompt $" { } + -i $gdb_spawn_id -re ".*SPARClite appears to be alive.*$prompt $" { + if $verbose>1 then { + send_user "Set target to $targetname\n" + } + } + -i $gdb_spawn_id timeout { + perror "Couldn't set SLITE target." + set timeout 10 + verbose "Timeout is now $timeout seconds" 2 + return -1 + } + } + + if [target_info exists gdb_load_offset] { + set offset "[target_info gdb_load_offset]"; + } else { + set offset ""; + } + if { 1 } { + send_gdb "load $arg $offset\n" + verbose "Loading $arg into $GDB" 2 + set timeout 2400 + verbose "Timeout is now $timeout seconds" 2 + expect { + -i $gdb_spawn_id -re "Loading.*$prompt $" { + verbose "Loaded $arg into $GDB" 1 + set timeout 30 + verbose "Timeout is now $timeout seconds" 2 + } + -i $gdb_spawn_id -re "$prompt $" { + if $verbose>1 then { + perror "GDB couldn't load." + } + } + -i $gdb_spawn_id timeout { + if $verbose>1 then { + perror "Timed out trying to load $arg." + } + } + } + } + set timeout 10 + verbose "Timeout is now $timeout seconds, doing monitor run" 2 + send_gdb "monitor run\n"; + sleep 2; + send_gdb ""; + expect { + -i $gdb_spawn_id -re ".*$prompt $" { verbose "Run command succeded" } + -i $gdb_spawn_id default { + perror "error sending monitor run command"; + } + } + + if [target_info exists gdb_serial] { + send_gdb "target remote [target_info gdb_serial]\n" + set timeout 60 + verbose "Timeout is now $timeout seconds" 2 + expect { + -i $gdb_spawn_id -re ".*Kill it?.*y or n.*" { + send_gdb "y\n"; + exp_continue + } + -i $gdb_spawn_id -re ".*$prompt $" { + verbose "Set remote target to [target_info serial]" 2 + } + -i $gdb_spawn_id timeout { + perror "Couldn't set remote target." + set timeout 10 + verbose "Timeout is now $timeout seconds" 2 + return -1 + } + } + } + + if [info exists expect_out(buffer)] then { + send_log $expect_out(buffer) + } + return 0 +} diff --git a/gdb/testsuite/config/sparclet-old.exp b/gdb/testsuite/config/sparclet-old.exp new file mode 100644 index 0000000..ea97d19 --- /dev/null +++ b/gdb/testsuite/config/sparclet-old.exp @@ -0,0 +1,463 @@ +# Copyright (C) 1996 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# DejaGnu@cygnus.com + +# This file was written by Michael Snyder <msnyder@cygnus.com>. + +# GDB support routines for a board using the sparclet remote debugging +# protocol. + +load_lib remote.exp +load_lib gdb.exp +set prompt "\\(gdbslet\\)" + + +# +# Sparclet remote run command. +# +# This requires that we beep the user and ask him to push the board reset! +# Then we will switch to the monitor target, run the program, use 2 ^C's +# to interrupt the monitor target, and switch back to the remote target. +# Then we have to do a continue to get past the stub breakpoint. +# + +proc gdb_run_cmd {} { + global prompt + global gdb_spawn_id + + set timeout 60 + verbose "Timeout is now $timeout seconds, starting remote stub" 2 + send_user "Please reset the board now...\n" + sleep 1 + send_user "\n" + sleep 1 + send_user "\n" + sleep 1 + send_user "\n" + + # go back to monitor, run the program, interrupt it, and start remote. + + if [target_info exists gdb_protocol] { + set protocol [target_info gdb_protocol]; + } else { + set protocol "sparclet" + } + if [target_info exists serial] { + set targetname [target_info serial]; + send_gdb "target $protocol [target_info serial]\n"; + } else { + if ![target_info exists netport] { + perror "Need either netport or gdb_serial entry for [target_info name]."; + return -1; + } + set targetname [target_info netport]; + 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. $" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re "Remote target.*$prompt $" { } + -i $gdb_spawn_id -re ".*SPARCLET appears to be alive.*$prompt $" { + if $verbose>1 then { + send_user "Set target to $targetname\n" + } + } + -i $gdb_spawn_id timeout { + set timeout 10 + verbose "Timeout is now $timeout seconds" 2 + perror "Couldn't set SPARCLET target." + return -1 + } + } + + send_gdb "disable\n"; + expect { + -i $gdb_spawn_id -re ".*$prompt $" { + verbose "Breakpoints disabled" 2 + } + -i $gdb_spawn_id timeout { + perror "(timeout) disabling breakpoints"; + return -1 + } + -i $gdb_spawn_id 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. $" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re "The program being debugged .*y or n. $" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re ".*Starting program:.*$" { + verbose "Starting remote stub succeeded" + } + -i $gdb_spawn_id timeout { + perror "(timeout) starting the remote stub" ; + return -1 + } + -i $gdb_spawn_id default { + perror "error starting the remote stub"; + } + } + sleep 2; + send_gdb "" + sleep 1; + send_gdb "" + verbose "Sent ^C^C" + expect { + -i $gdb_spawn_id -re ".*Give up .and stop debugging it.*$" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re ".*$prompt $" { + verbose "interrupting remote stub succeeded" + } + -i $gdb_spawn_id timeout { + perror "(timeout) interrupting the remote stub"; + return -1 + } + -i $gdb_spawn_id 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.*" { + send_gdb "y\n"; + exp_continue + } + -i $gdb_spawn_id -re ".*$prompt $" { + verbose "connected to stub at [target_info gdb_serial]" 2 + } + -i $gdb_spawn_id timeout { + set timeout 10 + verbose "Timeout is now $timeout seconds" 2 + perror "Couldn't set remote target." + return -1 + } + } + } + + send_gdb "enable\n"; + expect { + -i $gdb_spawn_id -re ".*$prompt $" { + verbose "Breakpoints enabled" 2 + } + -i $gdb_spawn_id timeout { + perror "(timeout) enabling breakpoints"; + return -1 + } + -i $gdb_spawn_id default { + perror "error enabling breakpoints"; + } + } + send_gdb "continue\n"; + return +} + + +# +# gdb_load -- load a file into the GDB. +# Returns a 0 if there was an error, +# 1 if it load successfully. +# +proc gdb_load { arg } { + global verbose + global loadpath + global loadfile + global prompt + global GDB + global expect_out + global gdb_spawn_id + + set loadfile [file tail $arg] + set loadpath [file dirname $arg] + + if [target_info exists gdb_protocol] { + set protocol [target_info gdb_protocol]; + } else { + set protocol "sparclet" + } + + # 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. $" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re "Load new symbol table.*y or n. $" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re "Reading symbols from.*done..*$prompt $" {} + -i $gdb_spawn_id -re "$prompt $" { perror "GDB couldn't find loader" } + -i $gdb_spawn_id timeout { + perror "(timeout) read symbol file" ; + return -1 + } + } + + if [target_info exists serial] { + set targetname [target_info serial]; + send_gdb "target $protocol [target_info serial]\n"; + } else { + if ![target_info exists netport] { + perror "Need either netport or gdb_serial entry for [target_info name]."; + return -1; + } + set targetname [target_info netport]; + send_gdb "target $protocol udp [target_info netport]\n"; + } + expect { + -i $gdb_spawn_id -re "Remote target.*$prompt $" { } + -i $gdb_spawn_id -re ".*SPARCLET appears to be alive.*$prompt $" { + if $verbose>1 then { + send_user "Set target to $targetname\n" + } + } + -i $gdb_spawn_id timeout { + set timeout 10 + verbose "Timeout is now $timeout seconds" 2 + perror "Couldn't set SPARCLET target." + return -1 + } + } + + send_gdb "run\n"; + expect { + -i $gdb_spawn_id -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. $" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re ".*Starting program:.*loader.*$" { + verbose "Starting loader succeeded" + } + -i $gdb_spawn_id timeout { + perror "(timeout) starting the loader" ; + return -1 + } + -i $gdb_spawn_id default { + perror "error starting the loader"; + } + } + sleep 2; + send_gdb "" + sleep 1; + send_gdb "" + verbose "Sent ^C^C" + expect { + -i $gdb_spawn_id -re ".*Give up .and stop debugging it.*$" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re ".*$prompt $" { + verbose "Running loader succeeded" + } + -i $gdb_spawn_id timeout { + perror "(timeout) interrupting the loader" ; + return -1 + } + -i $gdb_spawn_id 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. $" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re "Load new symbol table.*y or n. $" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re "Reading symbols from.*done..*$prompt $" {} + -i $gdb_spawn_id -re "$prompt $" { perror "GDB couldn't read file" } + -i $gdb_spawn_id 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.*" { + send_gdb "y\n"; + exp_continue + } + -i $gdb_spawn_id -re ".*$prompt $" { + verbose "Set remote target to [target_info serial]" 2 + } + -i $gdb_spawn_id timeout { + set timeout 10 + verbose "Timeout is now $timeout seconds" 2 + perror "Couldn't set remote target." + return -1 + } + } + } + if [target_info exists gdb_load_offset] { + set offset "[target_info gdb_load_offset]"; + } else { + set offset ""; + } + send_gdb "load $arg $offset\n" + verbose "Loading $arg into $GDB" 2 + set timeout 1200 + verbose "Timeout is now $timeout seconds" 2 + expect { + -i $gdb_spawn_id -re "Loading.*$prompt $" { + verbose "Loaded $arg into $GDB" 1 + set timeout 60 + verbose "Timeout is now $timeout seconds" 2 + } + -i $gdb_spawn_id -re "$prompt $" { + if $verbose>1 then { + perror "GDB couldn't load." + } + } + -i $gdb_spawn_id timeout { + if $verbose>1 then { + perror "Timed out trying to load $arg." + } + } + } + + send_user "Please reset the board now...\n" + sleep 1 + send_user "\n" + sleep 1 + send_user "\n" + sleep 1 + send_user "\n" + + # go back to monitor, run the program, interrupt it, and start remote. + + if [target_info exists serial] { + set targetname [target_info serial]; + send_gdb "target $protocol [target_info serial]\n"; + } else { + if ![target_info exists netport] { + perror "Need either netport or gdb_serial entry for [target_info name]."; + return -1; + } + set targetname [target_info netport]; + 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. $" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re "Remote target.*$prompt $" { } + -i $gdb_spawn_id -re ".*SPARCLET appears to be alive.*$prompt $" { + if $verbose>1 then { + send_user "Set target to $targetname\n" + } + } + -i $gdb_spawn_id timeout { + set timeout 10 + verbose "Timeout is now $timeout seconds" 2 + perror "Couldn't set SPARCLET target." + return -1 + } + } + + send_gdb "run\n"; + expect { + -i $gdb_spawn_id -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. $" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re ".*Starting program:.*$" { + verbose "Starting remote stub succeeded" + } + -i $gdb_spawn_id timeout { + perror "(timeout) starting the remote stub" ; + return -1 + } + -i $gdb_spawn_id default { + perror "error starting the remote stub"; + } + } + sleep 2; + send_gdb "" + sleep 1; + send_gdb "" + verbose "Sent ^C^C" + expect { + -i $gdb_spawn_id -re ".*Give up .and stop debugging it.*$" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re ".*$prompt $" { + verbose "interrupting remote stub succeeded" + } + -i $gdb_spawn_id timeout { + perror "(timeout) interrupting the remote stub"; + return -1 + } + -i $gdb_spawn_id 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.*" { + send_gdb "y\n"; + exp_continue + } + -i $gdb_spawn_id -re ".*$prompt $" { + verbose "connected to stub at [target_info gdb_serial]" 2 + } + -i $gdb_spawn_id timeout { + set timeout 10 + verbose "Timeout is now $timeout seconds" 2 + perror "Couldn't set remote target." + return -1 + } + } + } + return 0 +} diff --git a/gdb/testsuite/config/sparclet.exp b/gdb/testsuite/config/sparclet.exp new file mode 100644 index 0000000..c97f5fc --- /dev/null +++ b/gdb/testsuite/config/sparclet.exp @@ -0,0 +1,332 @@ +# Copyright (C) 1996 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# DejaGnu@cygnus.com + +# This file was written by Michael Snyder <msnyder@cygnus.com>. + +# GDB support routines for a board using the sparclet remote debugging +# protocol. + +load_lib remote.exp +load_lib gdb.exp +set prompt "\\(gdbslet\\)" + + +# +# Sparclet remote run command. +# +# This requires that we beep the user and ask him to push the board reset! +# Then we will switch to the monitor target, run the program, use 2 ^C's +# to interrupt the monitor target, and switch back to the remote target. +# Then we have to do a continue to get past the stub breakpoint. +# + +proc gdb_start { } { + global gdb_spawn_id; + global prompt + global GDB + + if { [default_gdb_start] != 0 } { + return -1; + } + + if [target_info exists baud] { + send_gdb "set remotebaud [target_info baud]\n" + expect { + -i $gdb_spawn_id -re ".*$prompt" { } + -i $gdb_spawn_id default { + perror "Error setting baud rate." + return -1; + } + } + } + + for {set x 1;} { $x < 4 } {incr x} { + if { [gdb_sparclet_startup] > 0 } { + break; + } + reboot_target; + } + return 1; +} + +proc gdb_sparclet_startup { } { + global gdb_spawn_id; + global prompt + global GDB + + set timeout 5; + set is_running_stub 0; + + send_gdb "target sparclet [target_info serial]\n"; + expect { + -i $gdb_spawn_id -re ".*already.*y or n." { + gdb_send "y\n"; + exp_continue; + } + -i $gdb_spawn_id -re "Remote target.*connected to.*$prompt" { } + -i $gdb_spawn_id timeout { + verbose "timed out, checking if stub is already running" + set timeout 10 + send_gdb "\003"; + expect { + -i $gdb_spawn_id -re ".*$prompt" { + } + -i $gdb_spawn_id 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.*$prompt" { + verbose "stub is already running" + set is_running_stub 1; + } + -i $gdb_spawn_id default { + perror "sparclet board isn't responding"; + return -1; + } + } + } + } + + if { $is_running_stub == 0 } { + global srcdir + + if ![file exists loader] { + set result [target_compile "${srcdir}/config/sparclet-loader.c" "loader" executable "libs=-Wl,-Ttext,[target_info gdb_stub_offset]"]; + } + set loader "loader"; + send_gdb "file $loader\n"; + expect { + -i $gdb_spawn_id -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. $" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re "Reading symbols from.*done..*$prompt $" {} + -i $gdb_spawn_id -re "$prompt $" { perror "GDB couldn't find loader" } + -i $gdb_spawn_id 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.*$prompt" { } + -i $gdb_spawn_id default { + perror "Error reconnecting to sparclet."; + return -1; + } + } + + send_gdb "load $loader [target_info gdb_stub_offset]\n" + verbose "Loading $loader into $GDB" 2 + set timeout 1200 + verbose "Timeout is now $timeout seconds" 2 + expect { + -i $gdb_spawn_id -re "Loading.*$prompt $" { + verbose "Loaded $loader into $GDB" 1 + set timeout 60 + verbose "Timeout is now $timeout seconds" 2 + } + -i $gdb_spawn_id -re "$prompt $" { + if $verbose>1 then { + perror "GDB couldn't load." + } + } + -i $gdb_spawn_id 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. $" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re "The program being debugged .*y or n. $" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re ".*Starting program:.*loader.*$" { + verbose "Starting loader succeeded" + } + -i $gdb_spawn_id timeout { + perror "(timeout) starting the loader" ; + return -1 + } + -i $gdb_spawn_id default { + perror "error starting the loader"; + } + } + sleep 2; + send_gdb "" + sleep 1; + send_gdb "" + verbose "Sent ^C^C" + expect { + -i $gdb_spawn_id -re ".*Give up .and stop debugging it.*$" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re ".*$prompt $" { + verbose "Running loader succeeded" + } + -i $gdb_spawn_id timeout { + perror "(timeout) interrupting the loader" ; + return -1 + } + -i $gdb_spawn_id default { + perror "error interrupting the loader"; + } + } + + gdb_exit; + return [gdb_start]; + } + return 1; +} + +proc gdb_run_cmd { args } { + global gdb_spawn_id + global prompt + + gdb_breakpoint exit; + send_gdb "set \$fp=0\n"; + expect { + -i $gdb_spawn_id -re ".*$prompt" { } + } + send_gdb "jump start\n"; + expect { + -i $gdb_spawn_id -re ".*y or n. $" { + send_gdb "y\n" + } + -i $gdb_spawn_id -re "Continuing at.*\[\r\n\]" { } + -i $gdb_spawn_id default { + return "failed" + } + } + return ""; +} + + +# +# gdb_load -- load a file into the GDB. +# Returns a 0 if there was an error, +# 1 if it load successfully. +# +proc gdb_load { arg } { + global verbose + global loadpath + global loadfile + global prompt + global GDB + global expect_out + global gdb_spawn_id + + set loadfile [file tail $arg] + set loadpath [file dirname $arg] + + if [target_info exists gdb_protocol] { + set protocol [target_info gdb_protocol]; + } else { + set protocol "sparclet" + } + + send_gdb "file $arg\n" + expect { + -i $gdb_spawn_id -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. $" { + send_gdb "y\n" + exp_continue + } + -i $gdb_spawn_id -re "Reading symbols from.*done..*$prompt $" {} + -i $gdb_spawn_id -re "$prompt $" { perror "GDB couldn't read file" } + -i $gdb_spawn_id 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.*" { + send_gdb "y\n"; + exp_continue + } + -i $gdb_spawn_id -re ".*$prompt $" { + verbose "Set remote target to [target_info serial]" 2 + } + -i $gdb_spawn_id timeout { + set timeout 10 + verbose "Timeout is now $timeout seconds" 2 + perror "Couldn't set remote target." + return -1 + } + } + } + if [target_info exists gdb_load_offset] { + set offset "[target_info gdb_load_offset]"; + } else { + set offset ""; + } + send_gdb "load $arg $offset\n" + verbose "Loading $arg into $GDB" 2 + set timeout 1200 + verbose "Timeout is now $timeout seconds" 2 + expect { + -i $gdb_spawn_id -re "Loading.*$prompt $" { + verbose "Loaded $arg into $GDB" 1 + set timeout 60 + verbose "Timeout is now $timeout seconds" 2 + } + -i $gdb_spawn_id -re "$prompt $" { + if $verbose>1 then { + perror "GDB couldn't load." + } + } + -i $gdb_spawn_id timeout { + if $verbose>1 then { + perror "Timed out trying to load $arg." + } + } + } + send_gdb "list main\n"; + expect { + -i $gdb_spawn_id -re ".*$prompt" { } + -i $gdb_spawn_id default { + perror "command for list main never completed"; + return -1; + } + } + + return 0 +} diff --git a/gdb/testsuite/config/udi-gdb.exp b/gdb/testsuite/config/udi.exp index 9a369fd..1d49722 100644 --- a/gdb/testsuite/config/udi-gdb.exp +++ b/gdb/testsuite/config/udi.exp @@ -20,30 +20,18 @@ # This file was written by Rob Savoye. (rob@cygnus.com) -# -# NOTE: these test assume that there is a udi_soc file in th -# - load_lib gdb.exp -load_lib udi.exp - -# -# gdb_version -- extract and print the version number of gdb -# -proc gdb_version {} { - default_gdb_version -} # # gdb_target_udi # Set gdb to the desired UDI target # proc gdb_target_udi { } { - global targetname global prompt global verbose global exit_status + set targetname [target_info remote_host]; # set targets hostname send "target udi $targetname\n" set timeout 60 @@ -79,6 +67,7 @@ proc gdb_target_udi { } { # gdb_load -- load a file into the debugger. # return a -1 if anything goes wrong. # + proc gdb_load { arg } { global verbose global loadpath @@ -86,7 +75,9 @@ proc gdb_load { arg } { global GDB global prompt - if [gdb_file_cmd $arg] then { return -1 } + if [gdb_file_cmd $arg] { + return -1 + } gdb_target_udi } @@ -117,12 +108,3 @@ proc gdb_exit { } { } close $in } - -gdb_start - -# make sure gdb has actually started, otherwise if the first test -# timesout, DejaGnu crashes -send "\n" -expect { - -re "$prompt" - } diff --git a/gdb/testsuite/config/unix-gdb.exp b/gdb/testsuite/config/unix.exp index c53a28f..8d0530f 100644 --- a/gdb/testsuite/config/unix-gdb.exp +++ b/gdb/testsuite/config/unix.exp @@ -27,57 +27,3 @@ set timeout 60 verbose "Timeout is now $timeout seconds" 2 load_lib gdb.exp - -# variables that need to set up -# -if ![info exists prompt] then { - set prompt "\[(\]gdb\[)\]" -} -# some convenience abbreviations -# -if ![info exists hex] then { - set hex "0x\[0-9A-Fa-f\]+" -} -if ![info exists decimal] then { - set decimal "\[0-9\]+" -} - -# -# gdb_version -- extract and print the version number of gcc -# -proc gdb_version {} { - default_gdb_version -} - -# -# gdb_unload -- unload a file if one is loaded -# - -# -# gdb_load -- load a file into the debugger. -# return a -1 if anything goes wrong. -# -proc gdb_load { arg } { - global verbose - global loadpath - global loadfile - global GDB - global prompt - upvar timeout timeout - - return [gdb_file_cmd $arg] -} - -proc gdb_start { } { - default_gdb_start -} - -proc gdb_exit { } { - catch default_gdb_exit -} - -set binpath /s1/users/rob/vxworks/bin/somewhere-bogus-that-needs-configuring -global GDB -set bin $GDB - -gdb_start diff --git a/gdb/testsuite/config/vx-gdb.exp b/gdb/testsuite/config/vx.exp index 6a6ea6b..c2b2632 100644 --- a/gdb/testsuite/config/vx-gdb.exp +++ b/gdb/testsuite/config/vx.exp @@ -43,13 +43,9 @@ proc gdb_version {} { # take precedence. Returns -1 on error, else 0. # proc gdb_load { arg } { - global shell_id - -# gdb_exit -# spawn_vxgdb set result 0 - if { [vxworks_ld $shell_id $arg] != 0 } { + if { [vxworks_ld target $arg] != 0 } { perror "Couldn't load $arg" return -1 } @@ -58,20 +54,18 @@ proc gdb_load { arg } { } # -# gdb_start -- start gdb running and +# gdb_start -- start gdb running # proc gdb_start { } { global prompt global verbose - global targetname global connectmode global reboot - global shell_id # get a connection to the board - set shell_id [ eval $connectmode "$targetname" ] + set shell_id [remote_open target] if { $shell_id < 0 } then { - perror "Couldn't connect to $targetname." + perror "Couldn't connect to target." return -1 } verbose "Spawn id for remote shell is $shell_id" @@ -108,7 +102,6 @@ proc gdb_start { } { proc spawn_vxgdb { } { global prompt global verbose - global targetname default_gdb_start @@ -119,15 +112,15 @@ proc spawn_vxgdb { } { verbose "Setting up target, Please wait..." # set targets hostname - send "target vxworks $targetname\n" + send "target vxworks [target_info netport]\n" set timeout 60 verbose "Timeout is now $timeout seconds" 2 expect { -re "Done\..*$prompt $" { - verbose "Set target to $targetname" 1 + verbose "Set target to [target_info netport]" 1 } -re "net_connect: RPC: Program not registered.*$" { - perror "Couldn't set GDB to target $targetname." + perror "Couldn't set GDB to target [target_info netport]." exit 1 } timeout { @@ -142,10 +135,7 @@ proc spawn_vxgdb { } { } proc gdb_exit { } { - global shell_id - if [info exists shell_id] then { - exit_remote_shell $shell_id - } + remote_close target; catch default_gdb_exit } @@ -159,5 +149,3 @@ proc gdb_exit { } { # "Undefined command" { perror "send string probably wrong." } #} -gdb_start - |