diff options
Diffstat (limited to 'gdb/testsuite/config')
47 files changed, 2059 insertions, 0 deletions
diff --git a/gdb/testsuite/config/abug.exp b/gdb/testsuite/config/abug.exp new file mode 100644 index 00000000000..e6ade13e5af --- /dev/null +++ b/gdb/testsuite/config/abug.exp @@ -0,0 +1,20 @@ +# Copyright (C) 1997 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: +# bug-gdb@prep.ai.mit.edu + +load_lib ../config/monitor.exp diff --git a/gdb/testsuite/config/arm-ice.exp b/gdb/testsuite/config/arm-ice.exp new file mode 100644 index 00000000000..d9842743d94 --- /dev/null +++ b/gdb/testsuite/config/arm-ice.exp @@ -0,0 +1 @@ +load_lib "../config/monitor.exp"; diff --git a/gdb/testsuite/config/cpu32bug.exp b/gdb/testsuite/config/cpu32bug.exp new file mode 100644 index 00000000000..e6ade13e5af --- /dev/null +++ b/gdb/testsuite/config/cpu32bug.exp @@ -0,0 +1,20 @@ +# Copyright (C) 1997 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: +# bug-gdb@prep.ai.mit.edu + +load_lib ../config/monitor.exp diff --git a/gdb/testsuite/config/cygmon.exp b/gdb/testsuite/config/cygmon.exp new file mode 100644 index 00000000000..d9842743d94 --- /dev/null +++ b/gdb/testsuite/config/cygmon.exp @@ -0,0 +1 @@ +load_lib "../config/monitor.exp"; diff --git a/gdb/testsuite/config/d10v.exp b/gdb/testsuite/config/d10v.exp new file mode 100644 index 00000000000..955288c7ff0 --- /dev/null +++ b/gdb/testsuite/config/d10v.exp @@ -0,0 +1,20 @@ +# Copyright (C) 1997 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: +# bug-gdb@prep.ai.mit.edu + +load_lib "../config/monitor.exp" diff --git a/gdb/testsuite/config/dve.exp b/gdb/testsuite/config/dve.exp new file mode 100644 index 00000000000..6aa46c1c834 --- /dev/null +++ b/gdb/testsuite/config/dve.exp @@ -0,0 +1,23 @@ +# Copyright (C) 1998 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: +# bug-gdb@prep.ai.mit.edu + +load_lib ../config/monitor.exp +set timeout 1000 +verbose "Timeout is now $timeout seconds" 2 + diff --git a/gdb/testsuite/config/est.exp b/gdb/testsuite/config/est.exp new file mode 100644 index 00000000000..e6ade13e5af --- /dev/null +++ b/gdb/testsuite/config/est.exp @@ -0,0 +1,20 @@ +# Copyright (C) 1997 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: +# bug-gdb@prep.ai.mit.edu + +load_lib ../config/monitor.exp diff --git a/gdb/testsuite/config/gdbserver.exp b/gdb/testsuite/config/gdbserver.exp new file mode 100644 index 00000000000..bb6f724f3b7 --- /dev/null +++ b/gdb/testsuite/config/gdbserver.exp @@ -0,0 +1,104 @@ +# Test Framework Driver for GDB using the extended gdb remote protocol +# Copyright 1995, 1997 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 gdb_prompt + global debughost + global port + + # 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 + if [gdb_target_monitor $arg] { + return -1; + } + + return 1 +} + +# +# gdb_start -- start GDB running. +# +proc gdb_start { } { + global gdb_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\]+.*$gdb_prompt $" {} + default { fail "gdb_start"} + } +} diff --git a/gdb/testsuite/config/h8300.exp b/gdb/testsuite/config/h8300.exp new file mode 100644 index 00000000000..d9842743d94 --- /dev/null +++ b/gdb/testsuite/config/h8300.exp @@ -0,0 +1 @@ +load_lib "../config/monitor.exp"; diff --git a/gdb/testsuite/config/hmsirom.exp b/gdb/testsuite/config/hmsirom.exp new file mode 100644 index 00000000000..75fc81da18a --- /dev/null +++ b/gdb/testsuite/config/hmsirom.exp @@ -0,0 +1,22 @@ +# Copyright (C) 1997 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: +# bug-gdb@prep.ai.mit.edu + +# Support for testing against a Hitachi SH3 target rom + +load_lib ../config/monitor.exp diff --git a/gdb/testsuite/config/hppro.exp b/gdb/testsuite/config/hppro.exp new file mode 100644 index 00000000000..0fca142235f --- /dev/null +++ b/gdb/testsuite/config/hppro.exp @@ -0,0 +1,24 @@ +# Copyright (C) 1997 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: +# bug-gdb@prep.ai.mit.edu + +load_lib ../config/monitor.exp + +# Hppro monitor is very slow... +set timeout 540 +verbose "Timeout is now $timeout seconds" 2 diff --git a/gdb/testsuite/config/i386-bozo.exp b/gdb/testsuite/config/i386-bozo.exp new file mode 100644 index 00000000000..78090937380 --- /dev/null +++ b/gdb/testsuite/config/i386-bozo.exp @@ -0,0 +1 @@ +load_lib "../config/monitor.exp" diff --git a/gdb/testsuite/config/i960.exp b/gdb/testsuite/config/i960.exp new file mode 100644 index 00000000000..e6ade13e5af --- /dev/null +++ b/gdb/testsuite/config/i960.exp @@ -0,0 +1,20 @@ +# Copyright (C) 1997 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: +# bug-gdb@prep.ai.mit.edu + +load_lib ../config/monitor.exp diff --git a/gdb/testsuite/config/m32r-stub.exp b/gdb/testsuite/config/m32r-stub.exp new file mode 100644 index 00000000000..cd04787ddb6 --- /dev/null +++ b/gdb/testsuite/config/m32r-stub.exp @@ -0,0 +1 @@ +load_lib "../../testsuite/config/sparclet.exp" diff --git a/gdb/testsuite/config/m32r.exp b/gdb/testsuite/config/m32r.exp new file mode 100644 index 00000000000..94dc6a24c4b --- /dev/null +++ b/gdb/testsuite/config/m32r.exp @@ -0,0 +1,23 @@ +# Copyright (C) 1997 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: +# bug-gdb@prep.ai.mit.edu + +load_lib ../config/monitor.exp +set timeout 120 +verbose "Timeout is now $timeout seconds" 2 + diff --git a/gdb/testsuite/config/m68k-emc.exp b/gdb/testsuite/config/m68k-emc.exp new file mode 100644 index 00000000000..70b8f5ef426 --- /dev/null +++ b/gdb/testsuite/config/m68k-emc.exp @@ -0,0 +1,17 @@ +load_lib gdb.exp +load_lib "../config/monitor.exp" + +proc gdb_emclaptop_command { command } { + global board_info; + set tname [board_info target name]; + + if ![info exists board_info($tname,m68k_connected)] { + m68k_emc_board_connect target; + } + # This is about all we can do for now. *sigh* + set dos_host [board_info target dos_host]; + + remote_send $dos_host "${command}\n"; + #remote_expect $dos_host { + #} +} diff --git a/gdb/testsuite/config/mips-idt.exp b/gdb/testsuite/config/mips-idt.exp new file mode 100644 index 00000000000..72664dff1b1 --- /dev/null +++ b/gdb/testsuite/config/mips-idt.exp @@ -0,0 +1,22 @@ +# Copyright (C) 1993, 1997 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 00000000000..72664dff1b1 --- /dev/null +++ b/gdb/testsuite/config/mips.exp @@ -0,0 +1,22 @@ +# Copyright (C) 1993, 1997 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/mn10300-eval.exp b/gdb/testsuite/config/mn10300-eval.exp new file mode 100644 index 00000000000..6aa46c1c834 --- /dev/null +++ b/gdb/testsuite/config/mn10300-eval.exp @@ -0,0 +1,23 @@ +# Copyright (C) 1998 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: +# bug-gdb@prep.ai.mit.edu + +load_lib ../config/monitor.exp +set timeout 1000 +verbose "Timeout is now $timeout seconds" 2 + diff --git a/gdb/testsuite/config/monitor.exp b/gdb/testsuite/config/monitor.exp new file mode 100644 index 00000000000..0d381a22cfa --- /dev/null +++ b/gdb/testsuite/config/monitor.exp @@ -0,0 +1,230 @@ +# Test Framework Driver for GDB driving a ROM monitor (via monitor.c). +# Copyright 1995, 1997 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. + +load_lib gdb.exp + +# +# gdb_target_monitor +# Set gdb to target the monitor +# +proc gdb_target_monitor { exec_file } { + global gdb_prompt + global exit_status + global timeout + + if [target_info exists gdb_protocol] { + set targetname "[target_info gdb_protocol]" + } else { + perror "No protocol specified for [target_info name]."; + return -1; + } + if [target_info exists baud] { + gdb_test "set remotebaud [target_info baud]" "" "" + } + if [target_info exists gdb_serial] { + set serialport "[target_info gdb_serial]"; + } elseif [target_info exists netport] { + set serialport "[target_info netport]" + } else { + set serialport "[target_info serial]" + } + + for {set j 1} {$j <= 2} {incr j} { + if [gdb_file_cmd $exec_file] { return -1; } + + for {set i 1} {$i <= 3} {incr i} { + send_gdb "target $targetname $serialport\n" + gdb_expect 60 { + -re "A program is being debugged already.*ill it.*y or n. $" { + send_gdb "y\n"; + exp_continue; + } + -re "Couldn't establish connection to remote.*$gdb_prompt" { + verbose "Connection failed"; + } + -re "Remote MIPS debugging.*$gdb_prompt" { + verbose "Set target to $targetname"; + return 0; + } + -re "Remote debugging using .*$serialport.*$gdb_prompt" { + verbose "Set target to $targetname"; + return 0; + } + -re "Remote target $targetname connected to.*$gdb_prompt" { + verbose "Set target to $targetname"; + return 0; + } + -re "Connected to.*$gdb_prompt" { + verbose "Set target to $targetname"; + return 0; + } + -re "Ending remote.*$gdb_prompt" { } + -re "Connection refused.*$gdb_prompt" { + verbose "Connection refused by remote target. Pausing, and trying again." + sleep 30 + continue + } + -re "Timeout reading from remote system.*$gdb_prompt" { + verbose "Got timeout error from gdb."; + } + timeout { + send_gdb ""; + break + } + } + } + + gdb_target_exec; + + if { $j == 1 && ![reboot_target] } { + break; + } + } + + perror "Couldn't set target for $targetname, port is $serialport."; + return -1; +} + +proc gdb_target_exec { } { + gdb_test "target exec" "No executable file now." "" ".*Kill it.*y or n.*" "y" + +} +# +# 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 gdb_prompt + global timeout + global last_gdb_file; + + if { $arg == "" } { + if [info exists last_gdb_file] { + set arg $last_gdb_file; + } else { + send_gdb "info files\n"; + gdb_expect 30 { + -re "Symbols from \"(\[^\"\]+)\"" { + set arg $expect_out(1,string); + exp_continue; + } + -re "Local exec file:\[\r\n\]+\[ \t\]*`(\[^'\]+)'," { + set arg $expect_out(1,string); + exp_continue; + } + -re "$gdb_prompt $" { } + } + } + } + + set last_gdb_file $arg; + + for { set j 1; } { $j <= 2 } {incr j; } { + if [target_info exists gdb,use_standard_load] { + gdb_target_exec; + if ![target_info exists gdb,no_push_conn] { + remote_push_conn host; + } + set state [remote_ld target $arg]; + if ![target_info exists gdb,no_push_conn] { + remote_close target; + remote_pop_conn host; + } + if { $state == "pass" } { + if [gdb_target_monitor $arg] { return -1; } + gdb_test "list main" ".*" "" + verbose "Loaded $arg into $GDB\n"; + return 0; + } + } else { + + if [gdb_target_monitor $arg] { return -1 } + + if [is_remote host] { + # FIXME: Multiple downloads. bleah. + set farg [remote_download host $arg]; + } else { + set farg $arg; + } + + if { $arg != "" && [target_info exists gdb_sect_offset] } { + set textoff [target_info gdb_sect_offset]; + send_gdb "sect .text $textoff\n"; + gdb_expect 30 { + -re "(0x\[0-9a-z]+) - 0x\[0-9a-z\]+ is \\.data" { + set dataoff $expect_out(1,string); + exp_continue; + } + -re "(0x\[0-9a-z\]+) - 0x\[0-9a-z\]+ is \\.bss" { + set bssoff $expect_out(1,string); + exp_continue; + } + -re "$gdb_prompt" { } + } + set dataoff [format 0x%x [expr $dataoff + $textoff]]; + set bssoff [format 0x%x [expr $bssoff + $textoff]]; + send_gdb "sect .data $dataoff\n"; + gdb_expect 30 { + -re "$gdb_prompt" { } + } + send_gdb "sect .bss $bssoff\n"; + gdb_expect 30 { + -re "$gdb_prompt" { } + } + } + + verbose "Loading $farg" + if [target_info exists gdb_load_offset] { + set command "load $farg [target_info gdb_load_offset]\n"; + } else { + set command "load $farg\n"; + } + send_gdb $command; + gdb_expect 1600 { + -re "\[Ff\]ailed.*$gdb_prompt $" { + verbose "load failed"; + } + -re "Timeout reading from remote.*$gdb_prompt" { + } + -re "$gdb_prompt $" { + verbose "Loaded $farg into $GDB\n" + return 0; + } + timeout { + if { $verbose > 1 } { + perror "Timed out trying to load $farg." + } + } + } + } + + # Make sure we don't have an open connection to the target. + gdb_target_exec; + + if { $j == 1 } { + if { ![reboot_target] } { + break; + } + } + } + perror "Couldn't load file into GDB."; + return -1; +} diff --git a/gdb/testsuite/config/mt-a29k-udi b/gdb/testsuite/config/mt-a29k-udi new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/gdb/testsuite/config/mt-a29k-udi diff --git a/gdb/testsuite/config/mt-i386-aout b/gdb/testsuite/config/mt-i386-aout new file mode 100644 index 00000000000..19b1cabe5e7 --- /dev/null +++ b/gdb/testsuite/config/mt-i386-aout @@ -0,0 +1,59 @@ +# compilers and assemblers +CC = i386-aout-gcc +CFLAGS = -g -D${target_os} +C++ = ${CC} +C++FLAGS = ${CFLAGS} +CXX = ${CC} +CXXFLAGS = ${CFLAGS} +AS = i386-aout-as +ASFLAGS = +FC = +FCFLAGS = +LD = ld +LDFLAGS = +LIBS = + +# binutils + +RANLIB = i386-aout-ranlib +RANLIBFLAGS = + +NM = i386-aout-nm +NMFLAGS = + +SIZE = i386-aout-size +SIZEFLAGS = + +STRIP = i386-aout-strip +STRIPFLAGS = + +OBJDUMP = i386-aout-objdump +OBJDUMPFLAGS = + +DEMANGLE = i386-aout-demangle +DEMANGLEFLAGS = + +COPY = i386-aout-copy +COPYFLAGS = + +# other utils +LEX = flex +LEXFLAGS = + +YACC = byacc +YACCFLAGS = + +AR = i386-aout-ar +ARFLAGS = + +CPP = ${CC} -E +CPPFLAGS = + +GDB = i386-aout-gdb +GDBFLAGS = -nx + +DIFF = diff +DIFFFLAGS = + +RUNTEST=i386-aout-runtest +RUNTESTFLAGS= diff --git a/gdb/testsuite/config/mt-i960-nindy b/gdb/testsuite/config/mt-i960-nindy new file mode 100644 index 00000000000..9786c51b3c3 --- /dev/null +++ b/gdb/testsuite/config/mt-i960-nindy @@ -0,0 +1 @@ +LDFLAGS_FOR_TARGET = -nostartfiles diff --git a/gdb/testsuite/config/mt-lynx b/gdb/testsuite/config/mt-lynx new file mode 100644 index 00000000000..1c153af7f82 --- /dev/null +++ b/gdb/testsuite/config/mt-lynx @@ -0,0 +1,4 @@ +CFLAGS_FOR_TARGET = +STEP_EXECUTABLE = step +THREADFLAGS = -mposix -mthreads +#LDFLAGS= -L/usr/cygnus/progressive-95q1/H-sparc-sun-sunos4.1.3/i386-lynx/lib/thread diff --git a/gdb/testsuite/config/mt-m68k b/gdb/testsuite/config/mt-m68k new file mode 100644 index 00000000000..493d702da31 --- /dev/null +++ b/gdb/testsuite/config/mt-m68k @@ -0,0 +1 @@ +CFLAGS_FOR_TARGET = -Tidp.ld -nostartfiles diff --git a/gdb/testsuite/config/mt-mips-ecoff b/gdb/testsuite/config/mt-mips-ecoff new file mode 100644 index 00000000000..90dd031785e --- /dev/null +++ b/gdb/testsuite/config/mt-mips-ecoff @@ -0,0 +1,2 @@ +CFLAGS = -I/s1/cygnus/dejagnu/mips-idt-ecoff/include -g +LDFLAGS = -nostartfiles /s1/cygnus/dejagnu/mips-idt-ecoff/crt0.o -L/s1/cygnus/dejagnu/mips-idt-ecoff -g diff --git a/gdb/testsuite/config/mt-netware b/gdb/testsuite/config/mt-netware new file mode 100644 index 00000000000..10d1ce4935c --- /dev/null +++ b/gdb/testsuite/config/mt-netware @@ -0,0 +1 @@ +LDFLAGS = -r diff --git a/gdb/testsuite/config/mt-slite b/gdb/testsuite/config/mt-slite new file mode 100644 index 00000000000..74e75a25c5c --- /dev/null +++ b/gdb/testsuite/config/mt-slite @@ -0,0 +1,8 @@ +LIBS = -lc -lg -lgcc +CFLAGS = -g -Dusestubs +LDFLAGS = ` \ + if [ -f $${rootme}/../../newlib/Makefile ]; then \ + echo -L$${rootsrc}/../../libgloss/ex93x -L$${rootme}/../../libgloss/ex93x -Tex93x.ld -nostartfiles -nostdlib -N; \ + else \ + echo -Tex93x.ld -nostartfiles -nostdlib -N; \ + fi` diff --git a/gdb/testsuite/config/mt-sparc-aout b/gdb/testsuite/config/mt-sparc-aout new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/gdb/testsuite/config/mt-sparc-aout diff --git a/gdb/testsuite/config/mt-unix b/gdb/testsuite/config/mt-unix new file mode 100644 index 00000000000..d6e2c786f84 --- /dev/null +++ b/gdb/testsuite/config/mt-unix @@ -0,0 +1 @@ +CFLAGS_FOR_TARGET = -g diff --git a/gdb/testsuite/config/mt-vxworks b/gdb/testsuite/config/mt-vxworks new file mode 100644 index 00000000000..d18bcb0bc32 --- /dev/null +++ b/gdb/testsuite/config/mt-vxworks @@ -0,0 +1,2 @@ +CFLAGS = -g -Dvxworks +LDFLAGS = -Xlinker -Ur diff --git a/gdb/testsuite/config/netware.exp b/gdb/testsuite/config/netware.exp new file mode 100644 index 00000000000..2538ccf49b6 --- /dev/null +++ b/gdb/testsuite/config/netware.exp @@ -0,0 +1,218 @@ +# Copyright (C) 1988, 1990, 1991, 1992, 1994, 1997 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: +# bug-gdb@prep.ai.mit.edu + +# This file was written by J.T. Conklin. (jtc@cygnus.com) + +load_lib gdb.exp +load_lib remote.exp + +global shell_id + +global LD +if ![info exists LD] then { + set LD [findfile "$base_dir/../../ld/ld.new"] +} + +global NLMCONV +if ![info exists NLMCONV] then { + set NLMCONV [findfile "$base_dir/../../binutils/nlmconv"] +} + +# +# 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 gdb_prompt + global LD + global NLMCONV + global errorCode + 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" + + # build *.lnk file + set fd [open $lnk w] + puts $fd "description \"[file tail $nlm]\"" + puts $fd "screenname \"System Console\"" + puts $fd "module clib.nlm" + puts $fd "module mathlib.nlm" + puts $fd "stack 32768" +# puts $fd "stack 64512" + puts $fd "debug" + # FIXME: don't hardcode location of prelude.o + puts $fd "input /s1/cygnus/dejagnu/i386-netware/lib/prelude.o" + puts $fd "input $arg" + puts $fd "output $nlm" + close $fd + + # run nlmconv + verbose "Executing: $NLMCONV -l$LD -T$lnk" 1 + catch "exec $NLMCONV -l$LD -T$lnk" output + if ![string match "" $output] then { + verbose $output 1 + } + if ![string match "NONE" $errorCode] { + warning "Can't link $arg" + + return -1 + } + catch "exec rm -f $lnk" + + # download + verbose "Downloading $nlm" 1 + catch "exec cp $nlm /.NetWare/$targetname.nws/sys.nwv/tmp/x.nlm" output + if ![string match "" $output] then { + verbose $output 1 + return -1 + } + + gdb_file_cmd $nlm +} + +proc gdb_run_cmd { } { + global shell_id + global gdb_prompt + 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" + gdb_expect { + -re ".*Kill the program being debugged.*y or n. $" { + send "y\n" + exp_continue + } + -re ".*$gdb_prompt $" {} + } + + 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" + gdb_expect { + -re "$gdb_prompt" {} + timeout { + perror "Couldn't set remote baud rate" + return + } + } + + set otimeout $timeout + set timeout 60 + verbose "Timeout is now $timeout seconds" 2 + send "target remote $serialport\n" + gdb_expect { + -re "Couldn't establish connection to remote target" { + send "target remote $serialport\n" + exp_continue + } + -re "$gdb_prompt" {} + timeout { + set timeout $otimeout + verbose "Timeout restored to $timeout seconds" 2 + perror "Couldn't set remote target" + return + } + } + set timeout $otimeout + verbose "Timeout restored to $timeout seconds" 2 + + send "continue\n" + gdb_expect { + "Continuing.$" {} + } + + return +} + + + +# +# start the remote shell +# + +set shell_prompt "Password:" +set shell_id [remote_open target] + +if $shell_id<0 then { + warning "Couldn't connect to target" + return -1 +} + +if [string match "" $passwd] then { + stty -echo + send_user "Password: " + expect_user -re "(.*)\n" + send_user "\n" + set passwd "$expect_out(1,string)" + stty echo +} + +send -i $shell_id "$passwd\n" +gdb_expect { + -i $shell_id ":" { + verbose "Got termtype prompt" 0 + } + + -i $shell_id timeout { + warning "Connection timed out" + return -1 + } +} + + +# FIXME: this is wrong. +set shell_prompt "[string toupper [target_info name]]:" +send -i $shell_id "1\n" + +gdb_expect { + -i $shell_id -re "$shell_prompt" {} + -i $shell_id timeout { + warning "Connection timed out" + return -1 + } +} diff --git a/gdb/testsuite/config/nind.exp b/gdb/testsuite/config/nind.exp new file mode 100644 index 00000000000..d8aecdbc60a --- /dev/null +++ b/gdb/testsuite/config/nind.exp @@ -0,0 +1,49 @@ +# Test Framework Driver +# Copyright (C) 1988, 1990, 1991, 1992, 1997 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 Rob Savoye. (rob@cygnus.com) + +load_lib gdb.exp + +# +# gdb_load -- load a file into the debugger. +# +proc gdb_load { arg } { + global verbose + global loadpath + global loadfile + global gdb_prompt + global GDB + set loadfile [file tail $arg] + set loadpath [file dirname $arg] + send_user "Not implememted yet\n" ; return -1 +} + +# +# gdb_start -- start GDB running +# +proc gdb_start { } { + global GDB + global GDBFLAGS + global spawn_id + global gdb_prompt + global verbose + send_user "Not implememted yet\n" ; return -1 +} diff --git a/gdb/testsuite/config/proelf.exp b/gdb/testsuite/config/proelf.exp new file mode 100644 index 00000000000..e6ade13e5af --- /dev/null +++ b/gdb/testsuite/config/proelf.exp @@ -0,0 +1,20 @@ +# Copyright (C) 1997 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: +# bug-gdb@prep.ai.mit.edu + +load_lib ../config/monitor.exp diff --git a/gdb/testsuite/config/rom68k.exp b/gdb/testsuite/config/rom68k.exp new file mode 100644 index 00000000000..e6ade13e5af --- /dev/null +++ b/gdb/testsuite/config/rom68k.exp @@ -0,0 +1,20 @@ +# Copyright (C) 1997 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: +# bug-gdb@prep.ai.mit.edu + +load_lib ../config/monitor.exp diff --git a/gdb/testsuite/config/sh.exp b/gdb/testsuite/config/sh.exp new file mode 100644 index 00000000000..e6ade13e5af --- /dev/null +++ b/gdb/testsuite/config/sh.exp @@ -0,0 +1,20 @@ +# Copyright (C) 1997 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: +# bug-gdb@prep.ai.mit.edu + +load_lib ../config/monitor.exp diff --git a/gdb/testsuite/config/sim.exp b/gdb/testsuite/config/sim.exp new file mode 100644 index 00000000000..5d8a93d5311 --- /dev/null +++ b/gdb/testsuite/config/sim.exp @@ -0,0 +1,85 @@ +# Test Framework Driver for GDB driving a builtin simulator +# Copyright 1994, 1997, 1998 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. + +load_lib gdb.exp + +# +# gdb_target_sim +# Set gdb to target the simulator +# +proc gdb_target_sim { } { + global gdb_prompt + global exit_status + + set target_sim_options "[board_info target gdb,target_sim_options]"; + + send_gdb "target sim $target_sim_options\n" + set timeout 60 + verbose "Timeout is now $timeout seconds" 2 + gdb_expect { + -re "Connected to the simulator.*$gdb_prompt $" { + verbose "Set target to sim" + } + timeout { + perror "Couldn't set target for simulator." + cleanup + exit $exit_status + } + } + set timeout 10 + verbose "Timeout is now $timeout seconds" 2 +} + +# +# 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 gdb_prompt + + if [gdb_file_cmd $arg] then { return -1 } + + gdb_target_sim + + send_gdb "load\n" + set timeout 2400 + verbose "Timeout is now $timeout seconds" 2 + gdb_expect { + -re ".*$gdb_prompt $" { + if $verbose>1 then { + send_user "Loaded $arg into $GDB\n" + } + set timeout 30 + verbose "Timeout is now $timeout seconds" 2 + return 1 + } + -re "$gdb_prompt $" { + if $verbose>1 then { + perror "GDB couldn't load." + } + } + timeout { + if $verbose>1 then { + perror "Timed out trying to load $arg." + } + } + } +} diff --git a/gdb/testsuite/config/slite.exp b/gdb/testsuite/config/slite.exp new file mode 100644 index 00000000000..c4cb1399150 --- /dev/null +++ b/gdb/testsuite/config/slite.exp @@ -0,0 +1,183 @@ +# Copyright (C) 1993, 1997, 1998 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 gdb_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 gdb_prompt + global GDB + global expect_out + + set loadfile [file tail $arg] + set loadpath [file dirname $arg] + + gdb_file_cmd $arg + + 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]; + set command "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]; + set command "target $protocol udp [target_info netport]\n"; + } + set timeout 60 + verbose "Timeout is now $timeout seconds" 2 + set try_count 0; + send_gdb $command; + gdb_expect { + -re "Unknown response.*resetting the board.|remote timeout" { + incr try_count; + if { $try_count > 3 } { + set try_count 0; + reboot_target; + sleep 5; + } + sleep 1; + send_gdb $command; + exp_continue; + } + -re "Remote target.*$gdb_prompt $" { } + -re ".*SPARClite appears to be alive.*$gdb_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 + } + } + + if [target_info exists gdb_load_offset] { + set offset "[target_info gdb_load_offset]"; + } else { + set offset ""; + } + if { 1 } { + if [is_remote host] { + set arg [remote_download host $arg]; + if { $arg == "" } { + error "download failed" + return -1; + } + } + send_gdb "load $arg $offset\n" + verbose "Loading $arg into $GDB" 2 + set timeout 2400 + verbose "Timeout is now $timeout seconds" 2 + gdb_expect { + -re "Loading.*$gdb_prompt $" { + verbose "Loaded $arg into $GDB" 1 + set timeout 30 + verbose "Timeout is now $timeout seconds" 2 + } + -re "$gdb_prompt $" { + if $verbose>1 then { + perror "GDB couldn't load." + } + } + timeout { + if $verbose>1 then { + perror "Timed out trying to load $arg." + } + } + } + } + # Some SPARClite boards automagically do a run after the program is + # loaded. + if [target_info exists need_monitor_run] { + set timeout 10 + verbose "Timeout is now $timeout seconds, doing monitor run" 2 + send_gdb "monitor run\n"; + sleep 2; + send_gdb ""; + gdb_expect { + -re ".*$gdb_prompt $" { verbose "Run command succeded" } + default { + perror "error sending monitor run command"; + } + } + } else { + sleep 2; + } + + if [target_info exists gdb_serial] { + set serial [target_info gdb_serial]; + } else { + set serial [target_info serial]; + } + send_gdb "target remote $serial\n" + set timeout 60 + verbose "Timeout is now $timeout seconds" 2 + gdb_expect { + -re ".*Kill it?.*y or n.*" { + send_gdb "y\n"; + exp_continue + } + -re ".*$gdb_prompt $" { + verbose "Set remote target to [target_info serial]" 2 + } + 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.exp b/gdb/testsuite/config/sparclet.exp new file mode 100644 index 00000000000..1919aca4f86 --- /dev/null +++ b/gdb/testsuite/config/sparclet.exp @@ -0,0 +1,391 @@ +# Copyright (C) 1996, 1997 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 + +# +# Sparclet remote run command. +# + +proc gdb_start { } { + global gdb_prompt + + if ![file exists loader] { + global libdir + set loader loader; + + if [target_info exists gdb_stub_offset] { + set result [target_compile "${libdir}/stub-loader.c" $loader executable "libs=-Wl,-Ttext,[target_info gdb_stub_offset]"]; + } else { + set result [target_compile "${libdir}/stub-loader.c" $loader executable "ldscript=[target_info gdb_stub_ldscript]"]; + } + } + + verbose -log "$gdb_prompt is gdb prompt" + + set result 0; + for { set y 0; } { $y < 4 } { incr y } { + if { [default_gdb_start] != 0 } { + return -1; + } + + if [target_info exists baud] { + send_gdb "set remotebaud [target_info baud]\n" + gdb_expect { + -re "$gdb_prompt" { } + default { + perror "Error setting baud rate." + return -1; + } + } + } + + for {set x 1;} { $x < 4 } {incr x} { + set result [gdb_sparclet_startup $result]; + if { $result > 0 } { + return 1; + } + # mmmmm, magic numbers. + if { $result == -42 || $result == -43 } { + break; + } else { + reboot_target; + } + } + if { $x == 4 } { + return -1; + } + gdb_exit; + sleep 5; + } + return -1; +} + +proc gdb_sparclet_startup { arg } { + global gdb_prompt + global GDB + global verbose + + set is_running_stub 0; + + if [target_info exists serial] { + set serial [target_info serial]; + } else { + set serial [target_info netport]; + } + set protocol [target_info gdb_protocol]; + set check_stub 1; + if { $arg != -42 } { + send_gdb "target $protocol $serial\n"; + # 10 seconds may be a bit short. + gdb_expect 10 { + -re "already.*y or n." { + gdb_send "y\n"; + exp_continue; + } + -re "Remote target.*connected to.*$gdb_prompt" { set check_stub 0; } + -re "$gdb_prompt" { } + timeout { } + } + if { $check_stub } { + verbose "timed out, checking if stub is already running" + send_gdb "\003"; + sleep 1; + send_gdb "\003"; + gdb_expect 10 { + -re "$gdb_prompt" { } + default { + remote_close host; + return -42; + } + } + } + } + if [target_info exists gdb_serial] { + set gdb_serial [target_info gdb_serial]; + } else { + set gdb_serial $serial; + } + if { $check_stub } { + send_gdb "target remote $gdb_serial\n"; + gdb_expect 15 { + -re "Remote debugging.*$gdb_prompt" { + verbose "stub is already running" + set is_running_stub 1; + } + default { + warning "board isn't responding"; + remote_close host; + remote_reboot target; + return -43; + } + } + } + + if { $is_running_stub == 0 } { + global srcdir + + if [is_remote host] { + set loader [remote_download host "loader"]; + } else { + set loader "loader"; + } + send_gdb "file $loader\n"; + gdb_expect { + -re "A program is being debug.*Kill it.*y or n. $" { + send_gdb "y\n" + exp_continue + } + -re "Load new symbol table.*y or n. $" { + send_gdb "y\n" + exp_continue + } + -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 $protocol $serial\n"; + gdb_expect { + -re "Remote target.*connected to.*$gdb_prompt" { } + default { + perror "Error reconnecting to board."; + return -1; + } + } + + send_gdb "load $loader [target_info gdb_stub_offset]\n" + verbose "Loading $loader into $GDB" 2 + set no_run_command 0; + gdb_expect 1200 { + -re "Loading.*$gdb_prompt $" { + verbose "Loaded $loader into $GDB" 1 + } + -re "Transfer rate:.*Switching to remote protocol.*Remote debugging" { + set no_run_command 1; + } + -re "$gdb_prompt $" { + if $verbose>1 then { + perror "GDB couldn't load." + } + } + timeout { + if $verbose>1 then { + perror "Timed out trying to load $arg." + } + } + } + + if !$no_run_command { + send_gdb "run\n"; + gdb_expect 60 { + -re "A program is being debug.*Kill it.*y or n. $" { + send_gdb "y\n" + exp_continue + } + -re "The program being debugged .*y or n. $" { + send_gdb "y\n" + exp_continue + } + -re "Starting program:.*loader.*$" { + verbose "Starting loader succeeded" + } + timeout { + perror "(timeout) starting the loader" ; + return -1 + } + default { + perror "error starting the loader"; + } + } + } + sleep 2; + send_gdb "" + sleep 1; + send_gdb "" + verbose "Sent ^C^C" + gdb_expect 10 { + -re "Give up .and stop debugging it.*$" { + send_gdb "y\n" + exp_continue + } + -re "$gdb_prompt $" { + verbose "Running loader succeeded" + } + timeout { + warning "(timeout) interrupting the loader" ; + remote_close host; + } + default { + warning "error interrupting the loader"; + } + } + + gdb_exit; + return [gdb_start]; + } + return 1; +} + +proc gdb_run_cmd { args } { + global gdb_prompt + + gdb_breakpoint exit; + send_gdb "set \$fp=0\n"; + gdb_expect { + -re "$gdb_prompt" { } + } + # This is needed for the SparcLite. Whee. + if [target_info exists gdb,start_symbol] { + set start_comm "jump *[target_info gdb,start_symbol]\n"; + } else { + set start_comm "jump *start\n"; + } + send_gdb "break copyloop\n"; + gdb_expect 10 { + -re "Breakpoint.*$gdb_prompt $" { + set start_comm "continue\n"; + } + -re "$gdb_prompt $" { } + timeout { warning "break copyloop failed badly"; } + } + send_gdb $start_comm; + gdb_expect 10 { + -re "y or n. $" { + remote_send host "y\n" + exp_continue; + } + -re "Breakpoint.*in copyloop.*$gdb_prompt $" { + remote_send host "jump relocd\n"; + exp_continue; + } + -re "Continuing at.*\[\r\n\]" { } + default { + return -1; + } + } + + 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 gdb_prompt + global GDB + global expect_out + + set loadfile [file tail $arg] + set loadpath [file dirname $arg] + + set protocol [target_info gdb_protocol]; + + if [is_remote host] { + set arg [remote_download host $arg]; + } + send_gdb "file $arg\n" + gdb_expect 30 { + -re "A program is being debug.*Kill it.*y or n. $" { + send_gdb "y\n" + exp_continue + } + -re "Load new symbol table.*y or n. $" { + send_gdb "y\n" + exp_continue + } + -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] { + set gdb_serial [target_info gdb_serial]; + } else { + if [target_info exists serial] { + set gdb_serial [target_info serial]; + } else { + set gdb_serial [target_info netport]; + } + } + send_gdb "target remote $gdb_serial\n" + gdb_expect 30 { + -re "Kill it?.*y or n.*" { + send_gdb "y\n"; + exp_continue + } + -re "$gdb_prompt $" { + verbose "Set remote target to $gdb_serial" 2 + } + timeout { + 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 + gdb_expect 1200 { + -re "Loading.*$gdb_prompt $" { + verbose "Loaded $arg into $GDB" 1 + } + -re "$gdb_prompt $" { + if $verbose>1 then { + perror "GDB couldn't load." + } + } + timeout { + if $verbose>1 then { + perror "Timed out trying to load $arg." + } + } + } + send_gdb "list main\n"; + gdb_expect 60 { + -re "$gdb_prompt" { } + default { + perror "command for list main never completed"; + return -1; + } + } + + return 0 +} diff --git a/gdb/testsuite/config/udi.exp b/gdb/testsuite/config/udi.exp new file mode 100644 index 00000000000..3a5d778b20b --- /dev/null +++ b/gdb/testsuite/config/udi.exp @@ -0,0 +1,112 @@ +# Test Framework Driver for GDB driving Universal Debug Interface on 29K +# Copyright 1988, 1990, 1991, 1992, 1993, 1994, 1997 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 Rob Savoye. (rob@cygnus.com) + +load_lib gdb.exp + +# +# gdb_target_udi +# Set gdb to the desired UDI target +# +proc gdb_target_udi { } { + global gdb_prompt + global verbose + global exit_status + + set targetname [target_info mondfe,name]; + # set targets hostname + send_gdb "target udi $targetname\n" + set timeout 60 + verbose "Timeout is now $timeout seconds" 2 + gdb_expect { + -re "target udi $targetname\[\r\n\]+" { + exp_continue + } + -re "TIP UDI 1.2 Conformant.*$gdb_prompt $" { + verbose "Set target to $targetname" + } + -re "TIP-ipc WARNING,.*failed:" { + warning "$expect_out(buffer)" + } + -re "TIP-ipc ERROR,.*failed:" { + perror "$expect_out(buffer)" + } + -re "A program is being debugged already. Kill it\? \(y or n\)" { + send "y\n" + exp_continue + } + timeout { + perror "Couldn't set target for UDI." + cleanup + exit $exit_status + } + } + set timeout 10 + verbose "Timeout is now $timeout seconds" 2 +} + +# +# 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 gdb_prompt + + if [gdb_file_cmd $arg] { + return -1 + } + + gdb_target_udi +} + +# +# gdb_start -- start GDB running. This assumes that there the +# UDICONF enviroment variable is set. +# +proc gdb_start { } { + global env; + + set env(UDICONF) [target_info mondfe,udi_soc]; + default_gdb_start + verbose "Setting up target, Please wait..." + gdb_target_udi +} + +# +# gdb_exit -- exit gdb +# +proc gdb_exit { } { + catch default_gdb_exit + set in [open [concat "|ls -F"] r] + while {[gets $in line]>-1} { + if [regexp "=$" $line] then { + set line [string trimright $line "="] + verbose "Removing the $line named socket" + exec rm -f $line + } + } + close $in +} diff --git a/gdb/testsuite/config/unix.exp b/gdb/testsuite/config/unix.exp new file mode 100644 index 00000000000..321ad542d7a --- /dev/null +++ b/gdb/testsuite/config/unix.exp @@ -0,0 +1,29 @@ +# Copyright (C) 1988, 1990, 1991, 1992, 1994, 1997 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: +# bug-gdb@prep.ai.mit.edu + +# This file was written by Rob Savoye. (rob@cygnus.com) + +# Set a default timeout to be used for the tests under UNIX, rather than +# accepting whatever default dejagnu gives us (apparently 10 seconds). +# When running the tests over NFS, under somewhat heavy load, 10 seconds +# does not seem to be enough. Try starting with 60. +set timeout 60 +verbose "Timeout is now $timeout seconds" 2 + +load_lib gdb.exp diff --git a/gdb/testsuite/config/unknown.exp b/gdb/testsuite/config/unknown.exp new file mode 100644 index 00000000000..f3cfb79e94a --- /dev/null +++ b/gdb/testsuite/config/unknown.exp @@ -0,0 +1,21 @@ +# Copyright (C) 1997 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: +# bug-gdb@prep.ai.mit.edu + +perror "Sorry, there is no support for this target" +exit 1 diff --git a/gdb/testsuite/config/vr4300.exp b/gdb/testsuite/config/vr4300.exp new file mode 100644 index 00000000000..e6ade13e5af --- /dev/null +++ b/gdb/testsuite/config/vr4300.exp @@ -0,0 +1,20 @@ +# Copyright (C) 1997 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: +# bug-gdb@prep.ai.mit.edu + +load_lib ../config/monitor.exp diff --git a/gdb/testsuite/config/vr5000.exp b/gdb/testsuite/config/vr5000.exp new file mode 100644 index 00000000000..e6ade13e5af --- /dev/null +++ b/gdb/testsuite/config/vr5000.exp @@ -0,0 +1,20 @@ +# Copyright (C) 1997 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: +# bug-gdb@prep.ai.mit.edu + +load_lib ../config/monitor.exp diff --git a/gdb/testsuite/config/vx.exp b/gdb/testsuite/config/vx.exp new file mode 100644 index 00000000000..9c90606f945 --- /dev/null +++ b/gdb/testsuite/config/vx.exp @@ -0,0 +1,130 @@ +# Copyright (C) 1988, 1990, 1991, 1992, 1995, 1997 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 Rob Savoye. (rob@cygnus.com) + +# +# load support libraries +# +load_lib remote.exp +load_lib gdb.exp + +set shell_prompt "->" +set gdb_prompt "\\(vxgdb\\)" + +# +# gdb_version -- extract and print the version number of gcc +# +proc gdb_version {} { + default_gdb_version +} + +# +# gdb_load -- load a file into the debugger. +# We have to stop and start gdb each time we do this, because when +# vxgdb loads two files in a row, the symbols in the first file loaded +# take precedence. Returns -1 on error, else 0. +# +proc gdb_load { arg } { + set result 0 + + if { [remote_ld target $arg] != 0 } { + perror "Couldn't load $arg" + return -1 + } + + return [gdb_file_cmd $arg] +} + +# +# gdb_start -- start gdb running +# +proc gdb_start { } { + global gdb_prompt + global verbose + global connectmode + global reboot + + # get a connection to the board + for { set x 0; } { $x < 3 } { incr x } { + set shell_id [remote_open target] + if { $shell_id > 0 } { + verbose "Spawn id for remote shell is $shell_id" + + set timeout 10 + verbose "Timeout is now $timeout seconds" 2 + + set state [spawn_vxgdb]; + if { $state == "pass" } { + return 0; + } + if { $state == "fail" } { + return -1; + } + } + remote_reboot target; + } +} + +proc spawn_vxgdb { } { + global gdb_prompt + + default_gdb_start + + # set the default arguments to "main", so that "run" with no + # arguments will work correctly. + send_gdb "set args main\n" + gdb_expect -re ".*$gdb_prompt $" {} + + verbose "Setting up target, Please wait..." + # set targets hostname + send_gdb "target vxworks [target_info hostname]\n" + set timeout 60 + verbose "Timeout is now $timeout seconds" 2 + gdb_expect { + -re "Done\..*$gdb_prompt $" { + verbose "Set target to [target_info hostname]" 1 + set timeout 10; + return "pass"; + } + -re "net_connect: RPC: (Program not registered|.*Timed out).*$" { + warning "Couldn't set GDB to target [target_info netport]." + } + timeout { + warning "Couldn't set target for vxworks." + } + } + return "retry"; +} + +proc gdb_exit { } { + remote_close target; + catch default_gdb_exit +} + +#expect_after { +# "<return>" { send "\n"; perror "Window too small." } +# -re "\(y or n\) " { send "n\n"; perror "Got interactive prompt." } +# buffer_full { 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." } +#} + diff --git a/gdb/testsuite/config/vxworks.exp b/gdb/testsuite/config/vxworks.exp new file mode 100644 index 00000000000..f9c50c8fb3f --- /dev/null +++ b/gdb/testsuite/config/vxworks.exp @@ -0,0 +1,20 @@ +# Copyright (C) 1997 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: +# bug-gdb@prep.ai.mit.edu + +load_lib ../config/vx.exp diff --git a/gdb/testsuite/config/vxworks29k.exp b/gdb/testsuite/config/vxworks29k.exp new file mode 100644 index 00000000000..3d4c53cf52b --- /dev/null +++ b/gdb/testsuite/config/vxworks29k.exp @@ -0,0 +1,27 @@ +# Copyright (C) 1995, 1997 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 Brendan Kehoe (brendan@cygnus.com). + +# We need this file here because the targetname for the 29k board +# is `vxworks29k', not `vxworks'. That way other tools (e.g., gcc) +# can differentiate between the stuff run on that board and others. + +verbose "Loading ${srcdir}/config/vx.exp" +source ${srcdir}/config/vx.exp |