aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/testsuite/ChangeLog10
-rw-r--r--gdb/testsuite/config/nind-gdb.exp118
-rw-r--r--gdb/testsuite/config/udi-gdb.exp206
-rw-r--r--gdb/testsuite/config/unix-gdb.exp234
-rw-r--r--gdb/testsuite/config/vx-gdb.exp301
-rw-r--r--gdb/testsuite/lib/gdb.exp255
7 files changed, 1134 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d69f625..aca6553 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,13 @@
+Sun Feb 21 10:55:55 1993 Mike Werner (mtw@poseidon.cygnus.com)
+
+ * gdb/testsuite: Initial creation of gdb/testsuite.
+ Migrated dejagnu testcases and support files for testing nm to
+ gdb/testsuite from deja-gnu. These files were moved "as is"
+ with no modifications. This migration is part of a major overhaul
+ of dejagnu. The modifications to these testcases, etc., which
+ will allow them to work with the new version of dejagnu will be
+ made in a future update.
+
Fri Feb 19 18:36:55 1993 John Gilmore (gnu@cygnus.com)
* NEWS: Add reminders for next release.
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
new file mode 100644
index 0000000..6259922
--- /dev/null
+++ b/gdb/testsuite/ChangeLog
@@ -0,0 +1,10 @@
+Sun Feb 21 10:55:55 1993 Mike Werner (mtw@poseidon.cygnus.com)
+
+ * gdb/testsuite: Initial creation of gdb/testsuite.
+ Migrated dejagnu testcases and support files for testing nm to
+ gdb/testsuite from deja-gnu. These files were moved "as is"
+ with no modifications. This migration is part of a major overhaul
+ of dejagnu. The modifications to these testcases, etc., which
+ will allow them to work with the new version of dejagnu will be
+ made in a future update.
+
diff --git a/gdb/testsuite/config/nind-gdb.exp b/gdb/testsuite/config/nind-gdb.exp
new file mode 100644
index 0000000..8d2f157
--- /dev/null
+++ b/gdb/testsuite/config/nind-gdb.exp
@@ -0,0 +1,118 @@
+# Test Framework Driver
+# Copyright (C) 1988, 1990, 1991, 1992 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., 675 Mass Ave, Cambridge, MA 02139, 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)
+
+# 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"
+}
+
+#
+# gdb_load -- load a file into the debugger.
+#
+proc gdb_load { arg } {
+ global verbose
+ global loadpath
+ global loadfile
+ global prompt
+ global GDB
+ set loadfile [file tail $arg]
+ set loadpath [file dirname $arg]
+ send_user "Not implememted yet\n" ; alldone
+}
+
+#
+# gdb_exit -- exit the debugger
+#
+proc gdb_exit {} {
+ global GDB
+ global GDBFLAGS
+ global verbose
+ send "quit\n"
+ expect {
+ eof {
+ if $verbose>1 then {
+ send_user "Got EOF from $GDB\n"
+ }
+ }
+ timeout {
+ if $verbose>1 then {
+ send_user "Got TIMEOUT from $GDB\n"
+ }
+ }
+ -re "The program is running. Quit anyway? (y or n) $"\
+ { send "y\n"
+ if $verbose>1 then {
+ send_user "\t\tKilling program being debugged\n"
+ }
+ }
+ }
+ if $verbose>1 then {
+ send_user "Quitting $GDB $GDBFLAGS\n"
+ }
+}
+
+#
+# gdb_start -- start GDB running
+#
+proc gdb_start { } {
+ global GDB
+ global GDBFLAGS
+ global spawn_id
+ global prompt
+ global verbose
+ global targetname
+ send_user "Not implememted yet\n" ; alldone
+}
+
+expect_after {
+ "<return>" { send "\n"; clone_output "ERROR: Window too small" }
+ -re "\(y or n\) " { send "n\n"; clone_output "ERROR: Got interactive prompt" }
+ buffer_full { 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/udi-gdb.exp b/gdb/testsuite/config/udi-gdb.exp
new file mode 100644
index 0000000..644f4af
--- /dev/null
+++ b/gdb/testsuite/config/udi-gdb.exp
@@ -0,0 +1,206 @@
+# Test Framework Driver
+# Copyright (C) 1988, 1990, 1991, 1992 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., 675 Mass Ave, Cambridge, MA 02139, 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)
+
+#
+# NOTE: these test assume that there is a udi_soc file in th
+#
+
+# these need to be initialized only if site.exp doesn't set them
+set prompt "\(gdb\)"
+
+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"
+}
+
+#
+# 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
+
+ send "load $arg\n"
+ if $verbose>1 then {
+ send_user "Loading $arg into $GDB\n"
+ }
+ expect {
+ -re "Loading.*\.text.*\.data.*\.bss.*Reading symbols from $arg.+done.*$prompt $" {
+ if $verbose>1 then {
+ send_user "Loaded $arg into $GDB\n"
+ }
+ return 1
+ }
+ -re "$prompt $" {
+ if $verbose>1 then {
+ error "GDB couldn't load."
+ }
+ }
+ timeout {
+ if $verbose>1 then {
+ error "Timed out trying to load $arg."
+ }
+ }
+}
+ if [info exists expect_out(buffer)] then {
+ send_log $expect_out(buffer)
+ }
+ return 0
+}
+
+#
+# gdb_exit -- exit the GDB
+#
+proc gdb_exit {} {
+ global GDB
+ global GDBFLAGS
+ global verbose
+
+ set timeout 5
+ send "quit\n"
+ expect {
+ eof {
+ if $verbose>1 then {
+ send_user "Got EOF from $GDB\n"
+ }
+ }
+ timeout {
+ if $verbose>1 then {
+ send_user "Got TIMEOUT from $GDB\n"
+ }
+ }
+ -re "The program is running. Quit anyway? (y or n) $"\
+ { send "y\n"
+ if $verbose>1 then {
+ send_user "\t\tKilling program being debugged\n"
+ }
+ }
+ }
+ if $verbose>1 then {
+ send_user "Quitting $GDB $GDBFLAGS\n"
+ }
+ close
+}
+
+#
+# gdb_start -- start GDB running. This assumes that there the
+# UDICONF enviroment variable is set.
+#
+proc gdb_start { } {
+ global GDB
+ global GDBFLAGS
+ global spawn_id
+ global prompt
+ global verbose
+ global targetname
+
+ set GDB [which $GDB]
+ # start GDB
+ if [ llength $GDBFLAGS ] then {
+ spawn $GDB $GDBFLAGS
+ } else {
+ spawn $GDB
+ }
+ expect {
+ -re "GDB.*$prompt $" {
+ if $verbose>1 then {
+ send_user "$GDB initialized for cross mode\n\n"
+ }
+ }
+ -re "$prompt $" { error "GDB never initialized."; alldone }
+ timeout { error "(timeout) GDB never initialized.";
+ alldone }
+ }
+
+ # 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 $" {}
+ # set the default arguments to "main", so that "run" with no
+ # arguments will work correctly.
+ send "set args main\n"
+ expect -re ".*$prompt $" {}
+
+ if $verbose>1 then {
+ send_user "Setting up target, Please wait...\n"
+ }
+ catch "exec rm [glob -nocomplain *_soc]"
+ catch "exec rm [glob -nocomplain /tmp/*_soc]"
+ # set targets hostname
+ send "target udi $targetname\n"
+ set timeout 60
+ expect {
+ -re "target udi.*TIP UDI 1.2 Conformant.*$prompt $" {
+ if $verbose>1 then {
+ send_user "Set target to $targetname\n"
+ }
+}
+ timeout {
+ error "Couldn't set target for vxworks."
+ set timeout 10
+ alldone
+ }
+ }
+ set timeout 10
+}
+
+expect_after {
+ "<return>" { send "\n"; clone_output "ERROR: Window too small." }
+ -re "\(y or n\) " { send "n\n"; error "Got interactive prompt." }
+ buffer_full { error "internal buffer is full." }
+ eof { error "eof -- pty is hosed." }
+ timeout { error "timeout." }
+ "virtual memory exhausted" { error "virtual memory exhausted." }
+ "Undefined command" { 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/unix-gdb.exp b/gdb/testsuite/config/unix-gdb.exp
new file mode 100644
index 0000000..795914b
--- /dev/null
+++ b/gdb/testsuite/config/unix-gdb.exp
@@ -0,0 +1,234 @@
+# Copyright (C) 1988, 1990, 1991, 1992 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., 675 Mass Ave, Cambridge, MA 02139, 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)
+
+# 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 {} {
+ global GDB
+ global GDBFLAGS
+ 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_unload -- unload a file if one is loaded
+#
+
+proc gdb_unload {} {
+ global verbose
+ global GDB
+ global prompt
+ send "file\n"
+ expect {
+ -re "No exec file now\.\r" { continue -expect }
+ -re "No symbol file now\.\r" { continue -expect }
+ -re "A program is being debugged already..*Kill it\? \(y or n\) $"\
+ { send "y\n"
+ if $verbose>1 then {
+ send_user "\t\tKilling previous program being debugged\n"
+ }
+ continue -expect
+ }
+ -re "Discard symbol table from .*\? \(y or n\) $" {
+ send "y\n"
+ continue -expect
+ }
+ -re "$prompt $" {}
+ timeout {
+ error "Couldn't unload file in $GDB (timed out)."
+ alldone
+ }
+ }
+}
+
+#
+# gdb_load -- load a file into the debugger.
+#
+proc gdb_load { arg } {
+ global verbose
+ global loadpath
+ global loadfile
+ global GDB
+ global prompt
+
+ set loadfile [file tail $arg]
+ set loadpath [file dirname $arg]
+ send "directory\n"
+ expect {
+ -re "Reinitialize source path to empty\? \(y or n\) $"\
+ { send "y\n"
+ expect {
+ -re "$prompt $" {}
+ timeout { fail "(timeout) reset directory path" ; return }
+ }
+ }
+ timeout { fail "(timeout) reset directory path" ; return }
+ }
+ send "directory $loadpath\n"
+ expect -re "$prompt $" {}
+ send "file $arg\n"
+ expect {
+ -re "Reading symbols from.*done.*$prompt $"\
+ { if $verbose>1 then {
+ send_user "\t\tLoaded $arg into the $GDB\n"
+ }
+ }
+ -re "has no symbol-table.*$prompt $" {
+ error "$arg wasn't compiled with \"-g\"\n"
+ return -1
+ }
+ -re "A program is being debugged already..*Kill it\? \(y or n\) $"\
+ { send "y\n"
+ if $verbose>1 then {
+ send_user "\t\tKilling previous program being debugged\n"
+ }
+ continue -expect
+ }
+ -re "Load new symbol table from.*\? \(y or n\) $"\
+ { send "y\n"
+ expect {
+ -re "Reading symbols from.*done.*$prompt $"
+ { if $verbose>1 then {
+ send_user "\t\tLoaded $arg with new symbol table into $GDB\n"
+ }
+ }
+ timeout { error "(timeout) Couldn't load $arg, other program already loaded."; alldone }
+ }
+ }
+ -re ".*No such file or directory.*$prompt $"\
+ { error "($arg) No such file or directory\n"; alldone }
+ -re "$prompt $" { error "couldn't load $arg into $GDB."; alldone }
+ timeout { error "couldn't load $arg into $GDB (timed out)."; alldone }
+ }
+}
+
+#
+# gdb_exit -- kills the gdb process currently running
+#
+proc gdb_exit {} {
+ global verbose
+ global GDB
+ global GDBFLAGS
+ set timeout 1
+
+ catch "send \"quit\n\"" result
+ if [string match "write\(spawn_id=\[0-9\]+\): Bad file number" $result] then {
+ close
+ return 0
+ }
+ expect {
+ eof {
+ if $verbose>1 then {
+ send_user "Got EOF from $GDB\n"
+ }
+ }
+ timeout {
+ if $verbose>1 then {
+ send_user "Got TIMEOUT from $GDB\n"
+ }
+ }
+ -re "The program is running. Quit anyway? (y or n) $"\
+ { send "y\n"
+ if $verbose>1 then {
+ send_user "\t\tKilling program being debugged\n"
+ }
+ }
+ }
+
+ close
+
+ if $verbose>1 then {
+ send_user "Quitting $GDB $GDBFLAGS\n"
+ }
+}
+
+#
+# start gdb -- start gdb running
+#
+
+proc gdb_start {} {
+ global verbose
+ global GDB
+ global GDBFLAGS
+ global prompt
+ global spawn_id
+ global timeout
+ if $verbose>1 then {
+ send_user "Spawning $GDB $GDBFLAGS\n"
+ }
+
+ set oldtimeout $timeout
+ set timeout [expr "$timeout + 60"]
+ if [ llength $GDBFLAGS ] then {
+ spawn $GDB $GDBFLAGS
+ } else {
+ spawn $GDB
+ }
+ expect {
+ -re ".*$prompt $" { if $verbose>1 then {
+ send_user "GDB initialized for native mode\n" }
+ }
+ -re "$prompt $" { error "GDB never initialized."; alldone }
+ timeout { error "(timeout) GDB never initialized."; alldone }
+ }
+ set timeout $oldtimeout
+ # 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 $" {}
+}
+
+expect_after {
+ "<return>" { send "\n"; error "Window too small." }
+ -re "\(y or n\) " { send "n\n"; error "Got interactive prompt." }
+ buffer_full { error "internal buffer is full." }
+ eof { error "eof -- pty is hosed." }
+ timeout { error "timeout." }
+ "virtual memory exhausted" { error "virtual memory exhausted." }
+ "Undefined command" { error "send string probably wrong." }
+}
+
+load_lib gdb.exp
+
+set binpath /s1/users/rob/vxworks/bin/somewhere-bogus-that-needs-configuring
+set bin $GDB
+
+gdb_start
+
diff --git a/gdb/testsuite/config/vx-gdb.exp b/gdb/testsuite/config/vx-gdb.exp
new file mode 100644
index 0000000..9e88ef0
--- /dev/null
+++ b/gdb/testsuite/config/vx-gdb.exp
@@ -0,0 +1,301 @@
+# Copyright (C) 1988, 1990, 1991, 1992 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., 675 Mass Ave, Cambridge, MA 02139, 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
+set shell_prompt "->"
+
+# these need to be initialized only if site.exp doesn't set them
+if ![info exists prompt] then {
+ set prompt "\(vxgdb\)"
+}
+
+#
+# gdb_version -- extract and print the version number of gcc
+#
+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 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.
+#
+proc gdb_load { arg } {
+ global shell_id
+ global verbose
+ global loadpath
+ global loadfile
+ global base_dir
+ global prompt
+ global GDB
+ quit_vxgdb
+ spawn_vxgdb
+ set loadfile [file tail $arg]
+ set loadpath [file dirname $arg]
+ send -i $shell_id cd \"$base_dir\"\n
+ expect {
+ -i $shell_id "value = 0 = 0x0" {
+ if $verbose>1 then {
+ send_user "VxWorks changed directory to $base_dir\n"
+ }
+ }
+ timeout { error "Couldn't load $arg into $GDB."; return }
+ }
+ send "load $arg\n"
+ # Use a very generous timeout because we might be loading across
+ # the Internet.
+ set timeout 600
+ expect {
+ -re "load.*done.*$prompt $" {
+ if $verbose>1 then {
+ send_user "Loaded $arg\n"
+ }
+ }
+ -i $shell_id "Login incorrect." {
+ error "Login is incorrect."; set timeout 10; return
+ }
+ -re "Load failed on target machine.*$prompt $" {
+ error "Couldn't load $arg."; set timeout 10; return
+ }
+ -re "No such file or directory.*$prompt $" {
+ error "$arg doesn't exist."; set timeout 10; return
+ }
+ -re ".*Reading symbols.*done..*$prompt $" {
+ if $verbose>1 then {
+ send_user "Loaded $arg\n"
+ }
+ }
+ -re "$prompt $" {
+ error "Couldn't load $arg."; set timeout 10; return
+ }
+ timeout {
+ error "(timeout) couldn't load $arg.";
+ set timeout 10
+ return
+ }
+ }
+ set timeout 10
+}
+
+#
+#
+#
+proc gdb_exit {} {
+ global shell_id
+
+ exit_remote_shell $shell_id
+ quit_vxgdb
+}
+
+proc quit_vxgdb { } {
+ global GDB
+ global GDBFLAGS
+ global verbose
+
+ set timeout 1
+ send "quit\n"
+ expect {
+ eof {
+ if $verbose>1 then {
+ send_user "Got EOF from $GDB\n"
+ }
+ }
+ timeout {
+ if $verbose>1 then {
+ send_user "Got TIMEOUT from $GDB\n"
+ }
+ }
+ -re "The program is running. Quit anyway? (y or n) $"\
+ { send "y\n"
+ if $verbose>1 then {
+ send_user "\t\tKilling program being debugged\n"
+ }
+ }
+ }
+ if $verbose>1 then {
+ send_user "Quitting $GDB $GDBFLAGS\n"
+ }
+}
+
+#
+# gdb_start -- start gdb running and
+#
+proc gdb_start { } {
+ global GDB
+ global GDBFLAGS
+ global spawn_id
+ 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" ]
+ if $shell_id<0 then {
+ error "Couldn't connect to $targetname."
+ return -1
+ }
+
+ # reboot vxworks to get a clean start
+ if $reboot then {
+ send_user "Rebooting VxWorks, Please wait...\n"
+
+ send -i $shell_id "\CX"
+ set timeout 120
+ expect {
+ -i $shell_id -re "Connection closed.*$" {
+ if $verbose>2 then {
+ send_user "\nVxWorks has closed the shell\n"
+ }
+ }
+ eof { error "(eof) never disconnected from VxWorks shell."; alldone }
+ timeout { error "(timeout) never disconnected from VxWorks shell."; alldone }
+ }
+ close -i $shell_id
+
+ exec sleep 30
+
+ set timeout 60
+ set shell_id [ eval $connectmode "$targetname" ]
+ if $shell_id<0 then {
+ error "Couldn't connect to $targetname."
+ }
+ }
+ set timeout 10
+
+ # this is the non-interactive version of nfsAuthUnixPrompt
+ #send -i $shell_id nfsAuthUnixSet ($vx_host, $vx_uid, $vx_gid, 0); \n
+ #expect {
+ # -i $shell_id "value = 0 = 0x0" {
+ # if $verbose>1 then {
+ # send_user "\nVxWorks set host=$vx_host, uid=$vx_uid, gid=$vx_gid\n"
+ # }
+ # }
+ # timeout { error "couldn't set host=$vx_host, uid=$vx_uid, gid=$vx_gid\n"; alldone }
+ #}
+
+ #send -i $shell_id cd \"$base_dir\"\n
+ #expect {
+ # -i $shell_id "value = 0 = 0x0" {
+ # if $verbose>1 then {
+ # send_user "VxWorks changed directory to $base_dir\n"
+ # }
+ # }
+ # timeout { error "couldn't load $arg into $bin."; alldone }
+ #}
+
+ spawn_vxgdb
+}
+
+proc spawn_vxgdb { } {
+ global GDB
+ global GDBFLAGS
+ global spawn_id
+ global prompt
+ global verbose
+ global targetname
+
+ # start GDB
+ if [ llength $GDBFLAGS ] then {
+ spawn $GDB $GDBFLAGS
+ } else {
+ spawn $GDB
+ }
+ expect {
+ -re ".*$prompt $" {
+ if $verbose>1 then {
+ send_user "$GDB initialized for cross mode to Vxworks\n\n"
+ }
+ }
+ -re "$prompt $" { error "GDB never initialized."; alldone }
+ timeout { error "(timeout) GDB never initialized.";
+ alldone }
+ }
+
+ # 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 $" {}
+ # set the default arguments to "main", so that "run" with no
+ # arguments will work correctly.
+ send "set args main\n"
+ expect -re ".*$prompt $" {}
+
+ if $verbose>1 then {
+ send_user "Setting up target, Please wait...\n"
+ }
+ # set targets hostname
+ send "target vxworks $targetname\n"
+ set timeout 60
+ expect {
+ -re "Done\..*$prompt $" {
+ if $verbose>1 then {
+ send_user "Set target to $targetname\n"
+ }
+ }
+ -re "net_connect: RPC: Program not registered.*$" {
+ error "Couldn't set GDB to target $targetname."
+ exit 1
+ }
+ timeout {
+ error "Couldn't set target for vxworks."
+ set timeout 10
+ alldone
+ }
+ }
+ set timeout 10
+}
+
+expect_after {
+ "<return>" { send "\n"; error "Window too small." }
+ -re "\(y or n\) " { send "n\n"; error "Got interactive prompt." }
+ buffer_full { error "internal buffer is full." }
+ eof { error "eof -- pty is hosed." }
+ timeout { error "timeout." }
+ "virtual memory exhausted" { error "virtual memory exhausted." }
+ "Undefined command" { 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/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
new file mode 100644
index 0000000..a8ba0ee
--- /dev/null
+++ b/gdb/testsuite/lib/gdb.exp
@@ -0,0 +1,255 @@
+# Copyright (C) 1992 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+# Please email any bugs, comments, and/or additions to this file to:
+# DejaGnu@cygnus.com
+
+# This file was written by Fred Fish. (fnf@cygnus.com)
+
+# Generic gdb subroutines that should work for any target. If these
+# need to be modified for any target, it can be done with a variable
+# or by passing arguments.
+
+#
+# gdb_unload -- unload a file if one is loaded
+#
+
+proc gdb_unload {} {
+ global verbose
+ global GDB
+ global prompt
+ send "file\n"
+ expect {
+ -re "No exec file now\.\r" { continue -expect }
+ -re "No symbol file now\.\r" { continue -expect }
+ -re "A program is being debugged already..*Kill it\? \(y or n\) $"\
+ { send "y\n"
+ if $verbose>1 then {
+ send_user "\t\tKilling previous program being debugged\n"
+ }
+ continue -expect
+ }
+ -re "Discard symbol table from .*\? \(y or n\) $" {
+ send "y\n"
+ continue -expect
+ }
+ -re "$prompt $" {}
+ timeout {
+ error "couldn't unload file in $GDB (timed out)."
+ alldone
+ }
+ }
+}
+
+# Many of the tests depend on setting breakpoints at various places and
+# running until that breakpoint is reached. At times, we want to start
+# with a clean-slate with respect to breakpoints, so this utility proc
+# lets us do this without duplicating this code everywhere.
+#
+
+proc delete_breakpoints {} {
+ global prompt
+
+ send "delete breakpoints\n"
+ expect {
+ -re "Delete all breakpoints\? \(y or n\) $" {
+ send "y\n"
+ continue -expect
+ }
+ -re "y\r\n$prompt $" {}
+ -re ".*$prompt $" { fail "Delete all breakpoints" ; return }
+ timeout { fail "Delete all breakpoints (timeout)" ; return }
+ }
+ send "info breakpoints\n"
+ expect {
+ -re "No breakpoints or watchpoints..*$prompt $" {}
+ -re ".*$prompt $" { fail "breakpoints not deleted" ; return }
+ timeout { fail "info breakpoints (timeout)" ; return }
+ }
+}
+
+
+#
+# Set breakpoint at function and run gdb until it breaks there.
+# Since this is the only breakpoint that will be set, if it stops
+# at a breakpoint, we will assume it is the one we want. We can't
+# just compare to "function" because it might be a fully qualified,
+# single quoted C++ function specifier.
+#
+
+proc runto { function } {
+ global prompt
+ global decimal
+
+ send "delete\n"
+ expect {
+ -re "Delete all breakpoints\? \(y or n\) $" {
+ send "y\n"
+ expect {
+ -re "$prompt $" {}
+ timeout { fail "deleting breakpoints (timeout)" ; return 0 }
+ }
+ }
+ -re ".*$prompt $" {}
+ timeout { fail "deleting breakpoints (timeout)" ; return 0 }
+ }
+
+ send "break $function\n"
+ expect {
+ -re "Break.* at .*: file .*, line $decimal.\r\n$prompt $" {}
+ -re "$prompt $" { fail "setting breakpoint at $function" ; return 0 }
+ timeout { fail "setting breakpoint at $function (timeout)" ; return 0 }
+ }
+
+ send "run\n"
+ expect {
+ -re "The program .* has been started already.* \(y or n\) $" {
+ send "y\n"
+ continue -expect
+ }
+ -re "Starting.*Break.*\(\) at .*:$decimal.*$prompt $" { return 1 }
+ -re "$prompt $" { fail "running to $function" ; return 0 }
+ timeout { fail "running to $function (timeout)" ; return 0 }
+ }
+}
+
+#
+# gdb_test -- send a command to gdb and test the result.
+# Takes three parameters.
+# Parameters:
+# First one is the command to execute,
+# Second one is the pattern to match for a PASS,
+# Third one is an optional message to be printed. If this
+# a null string "", then the pass/fail messages are not printed.
+# Returns:
+# 1 if the test failed,
+# 0 if the test passes,
+# -1 if there was an internal error.
+#
+proc gdb_test { args } {
+ global verbose
+ global prompt
+ global GDB
+ global spawn_id
+
+ if [llength $args]==3 then {
+ set message [lindex $args 2]
+ } else {
+ set message [lindex $args 0]
+ }
+ set command [lindex $args 0]
+ set pattern [lindex $args 1]
+
+ if $verbose>2 then {
+ send_user "Sending \"$command\" to gdb\n"
+ send_user "Looking to match \"$pattern\"\n"
+ send_user "Message is \"$message\"\n"
+ }
+
+ set result -1
+ set errmess ""
+ # trap the send so any problems don't crash things
+ catch "send \"$command\n\"" errmess
+ if ![string match "" $errmess] then {
+ error "send \"$command\" got expect error \"$errmess\""
+ return -1
+ }
+
+ expect {
+ -re ".*Ending remote debugging.*$prompt$" {
+ if ![isnative] then {
+ warning "Can`t communicate to remote target."
+ }
+ gdb_exit
+ gdb_start
+ set result -1
+ }
+ -re "$pattern.*$prompt $" {
+ if ![string match "" $message] then {
+ pass "$message"
+ }
+ set result 0
+ }
+ -re "Undefined command:.*$prompt" {
+ error "Undefined command \"$command\"."
+ }
+ -re "Ambiguous command.*$prompt $" {
+ error "\"$command\" is not a unique command name."
+ }
+ -re ".*$prompt $" {
+ if ![string match "" $message] then {
+ fail "$message"
+ }
+ set result 1
+ }
+ "<return>" {
+ send "\n"
+ error "Window too small."
+ }
+ -re "\(y or n\) " {
+ send "n\n"
+ error "Got interactive prompt."
+ }
+ buffer_full {
+ error "internal buffer is full."
+ }
+ eof {
+ error "eof -- pty is hosed."
+ }
+ timeout {
+ fail "(timeout) $message"
+ set result 1
+ }
+ }
+ return $result
+}
+
+# "virtual memory exhausted" {
+# error "virtual memory exhausted."
+# }
+
+proc gdb_reinitialize_dir { subdir } {
+ global prompt
+ global verbose
+
+ send "dir\n"
+ expect {
+ -re "Reinitialize source path to empty.*" {
+ send "y\n"
+ expect {
+ -re "Source directories searched.*$prompt $" {
+ send "dir $subdir\n"
+ expect {
+ -re "Source directories searched.*$prompt $" {
+ if $verbose>1 then {
+ send_user "Dir set to $subdir\n"
+ }
+ }
+ -re ".*$prompt $" {
+ error "Dir \"$subdir\" failed."
+ }
+ }
+ }
+ -re ".*$prompt $" {
+ error "Dir \"$subdir\" failed."
+ }
+ }
+ }
+ -re ".*$prompt $" {
+ error "Dir \"$subdir\" failed."
+ }
+ }
+}