]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Major revision to testsuites for cross-testing and DOS testing support.
authorBob Manson <manson@cygnus>
Wed, 29 Jan 1997 09:40:31 +0000 (09:40 +0000)
committerBob Manson <manson@cygnus>
Wed, 29 Jan 1997 09:40:31 +0000 (09:40 +0000)
96 files changed:
binutils/testsuite/binutils-all/objcopy.exp
gas/testsuite/lib/gas-defs.exp
gdb/testsuite/ChangeLog
gdb/testsuite/config/abug.exp
gdb/testsuite/config/d10v.exp [new file with mode: 0644]
gdb/testsuite/config/gdbserver.exp [new file with mode: 0644]
gdb/testsuite/config/m32r-stub.exp [new file with mode: 0644]
gdb/testsuite/config/mips-gdb.exp [deleted file]
gdb/testsuite/config/mips-idt.exp [new file with mode: 0644]
gdb/testsuite/config/mips.exp [new file with mode: 0644]
gdb/testsuite/config/monitor.exp
gdb/testsuite/config/netware.exp
gdb/testsuite/config/nind.exp [moved from gdb/testsuite/config/nind-gdb.exp with 55% similarity]
gdb/testsuite/config/sim.exp [moved from gdb/testsuite/config/sim-gdb.exp with 81% similarity]
gdb/testsuite/config/slite-gdb.exp [deleted file]
gdb/testsuite/config/slite.exp [new file with mode: 0644]
gdb/testsuite/config/sparclet-old.exp [new file with mode: 0644]
gdb/testsuite/config/sparclet.exp [new file with mode: 0644]
gdb/testsuite/config/udi.exp [moved from gdb/testsuite/config/udi-gdb.exp with 86% similarity]
gdb/testsuite/config/unix.exp [moved from gdb/testsuite/config/unix-gdb.exp with 58% similarity]
gdb/testsuite/config/vx.exp [moved from gdb/testsuite/config/vx-gdb.exp with 87% similarity]
gdb/testsuite/gdb.base/a1-selftest.exp
gdb/testsuite/gdb.base/a2-run.exp
gdb/testsuite/gdb.base/bitfields.exp
gdb/testsuite/gdb.base/break.exp
gdb/testsuite/gdb.base/callfuncs.exp
gdb/testsuite/gdb.base/commands.exp
gdb/testsuite/gdb.base/corefile.exp
gdb/testsuite/gdb.base/crossload.exp
gdb/testsuite/gdb.base/default.exp
gdb/testsuite/gdb.base/exprs.exp
gdb/testsuite/gdb.base/funcargs.exp
gdb/testsuite/gdb.base/gdbvars.exp
gdb/testsuite/gdb.base/help.exp
gdb/testsuite/gdb.base/interrupt.exp
gdb/testsuite/gdb.base/langs.exp
gdb/testsuite/gdb.base/list.exp
gdb/testsuite/gdb.base/nodebug.exp
gdb/testsuite/gdb.base/printcmds.exp
gdb/testsuite/gdb.base/ptype.exp
gdb/testsuite/gdb.base/recurse.exp
gdb/testsuite/gdb.base/return.exp
gdb/testsuite/gdb.base/scope.exp
gdb/testsuite/gdb.base/setshow.exp [new file with mode: 0644]
gdb/testsuite/gdb.base/setvar.exp
gdb/testsuite/gdb.base/sigall.exp
gdb/testsuite/gdb.base/signals.exp
gdb/testsuite/gdb.base/structs.exp
gdb/testsuite/gdb.base/term.exp
gdb/testsuite/gdb.base/watchpoint.exp
gdb/testsuite/gdb.chill/builtins.exp
gdb/testsuite/gdb.chill/callch.exp
gdb/testsuite/gdb.chill/chexp.exp
gdb/testsuite/gdb.chill/chillvars.exp
gdb/testsuite/gdb.chill/enum.exp
gdb/testsuite/gdb.chill/extstruct.exp
gdb/testsuite/gdb.chill/gch1041.exp
gdb/testsuite/gdb.chill/gch1272.exp
gdb/testsuite/gdb.chill/gch1280.exp
gdb/testsuite/gdb.chill/gch922.exp
gdb/testsuite/gdb.chill/gch981.exp
gdb/testsuite/gdb.chill/misc.exp
gdb/testsuite/gdb.chill/powerset.exp
gdb/testsuite/gdb.chill/pr-4975.exp
gdb/testsuite/gdb.chill/pr-5016.exp
gdb/testsuite/gdb.chill/pr-5020.exp
gdb/testsuite/gdb.chill/pr-5022.exp
gdb/testsuite/gdb.chill/pr-5646.exp
gdb/testsuite/gdb.chill/pr-5984.exp
gdb/testsuite/gdb.chill/pr-6292.exp
gdb/testsuite/gdb.chill/pr-6632.exp
gdb/testsuite/gdb.chill/pr-8134.exp
gdb/testsuite/gdb.chill/pr-8136.exp
gdb/testsuite/gdb.chill/pr-8405.exp
gdb/testsuite/gdb.chill/pr-8742.exp
gdb/testsuite/gdb.chill/pr-8894.exp
gdb/testsuite/gdb.chill/pr-9095.exp
gdb/testsuite/gdb.chill/pr-9946.exp
gdb/testsuite/gdb.chill/result.exp
gdb/testsuite/gdb.chill/string.exp
gdb/testsuite/gdb.chill/tests1.exp
gdb/testsuite/gdb.chill/tests2.exp
gdb/testsuite/gdb.chill/tuples.exp
gdb/testsuite/gdb.disasm/hppa.exp
gdb/testsuite/gdb.disasm/sh3.exp
gdb/testsuite/gdb.fortran/exprs.exp
gdb/testsuite/gdb.fortran/types.exp
gdb/testsuite/gdb.stabs/weird.exp
gdb/testsuite/gdb.threads/pthreads.exp
gdb/testsuite/gdb.threads/step.exp [new file with mode: 0644]
gdb/testsuite/gdb.threads/step2.exp [new file with mode: 0644]
gdb/testsuite/lib/gdb.exp
ld/testsuite/ld-cdtest/cdtest.exp
ld/testsuite/ld-empic/empic.exp
ld/testsuite/ld-sh/sh.exp [new file with mode: 0644]
ld/testsuite/lib/ld.exp

index a6e94c7aca94efc4c8a9df1f363e52c01be32b5d..cddbd4cf347804fe7138dba21be74ba0e01491c4 100644 (file)
@@ -26,7 +26,7 @@ if {[which $OBJCOPY] == 0} then {
 
 send_user "Version [binutil_version $OBJCOPY]"
 
-if {![binutils_assemble $AS $srcdir$subdir/bintest.s tmpdir/bintest.o]} then {
+if {![binutils_assemble $AS $srcdir/$subdir/bintest.s tmpdir/bintest.o]} then {
     unresolved "objcopy (simple copy)"
     return
 }
@@ -56,7 +56,7 @@ if ![string match "" $got] then {
     setup_xfail "i*86-*-sysv3" "i*86-*-isc*" "i*86-*-sco*" "i*86-*-coff"
     setup_xfail "i*86-*-aix*" "i*86-*-go32*"
     setup_xfail "a29k-*-udi" "a29k-*-coff" "a29k-*-vxworks*"
-    setup_xfail "i960-*-vxworks*" "i960-*-coff"
+    setup_xfail "i960-*-coff"
     setup_xfail "h8300-*-hms" "h8300-*-coff"
     setup_xfail "h8500-*-hms" "h8500-*-coff"
     setup_xfail "hppa*-*-*"
@@ -70,6 +70,12 @@ if ![string match "" $got] then {
        send_log "$exec_output\n"
        verbose "$exec_output" 1
 
+       # On OSF/1, this succeeds with gas and fails with /bin/as.
+       setup_xfail "alpha*-*-osf*"
+
+       # This fails for COFF i960-vxworks targets.
+       setup_xfail "i960-*-vxworks*"
+
        fail "objcopy (simple copy)"
     }
 }
@@ -87,19 +93,19 @@ if ![string match "" $got] then {
     gets $file line
     send_log "$line\n"
     verbose $line
-    if ![string match $line "S0130000746D706469722F636F70792E7372656397\r"] {
+    if ![string match "S0130000746D706469722F636F70792E7372656397*" $line] {
        send_log "bad header\n"
        fail "objcopy -O srec"
     } else {
        while {[gets $file line] != -1 \
-              && [regexp "^S\[123\]\[0-9a-fA-F\]+\r$" $line]} {
+              && [regexp "^S\[123\]\[0-9a-fA-F\]+\[\r\n\]*$" $line]} {
            send_log "$line\n"
            verbose $line
            set line "**EOF**"
        }
        send_log "$line\n"
        verbose $line
-       if ![regexp "^S\[789\]\[0-9a-fA-F\]+\r$" $line] then {
+       if ![regexp "^S\[789\]\[0-9a-fA-F\]+\[\r\n\]*$" $line] then {
            send_log "bad trailer\n"
            fail "objcopy -O srec"
        } else {
@@ -177,7 +183,7 @@ set lowname ""
 
 set headers [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h tmpdir/bintest.o"]
 
-set headers_regexp "SECTION\[  0-9\]+\\\[(\[^\]\]*)\\\]\[^\n\r\]*size\[        \]*(\[0-9a-fA-F\]+)\[0-9a-zA-Z  \]*lma\[        \]*(\[0-9a-fA-F\]+)(.*)"
+set headers_regexp "\[         0-9\]+(\[^      \]+)\[  \]*(\[0-9a-fA-F\]+)\[   \]+\[0-9a-fA-F\]+\[     \]+(\[0-9a-fA-F\]+)\[   \]+\[0-9a-fA-F\]+\[     \]+2\[*\]\[*\]\[0-9\]+(.*)"
 
 set got $headers
 while {[regexp $headers_regexp $got all name size vma rest]} {
@@ -200,7 +206,7 @@ if {$low == "" || $origstart == ""} then {
         fail "objcopy --adjust-vma"
     } else {
        set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -fh tmpdir/copy.srec"]
-       set want "file format srec.*start address\[     \]*(\[0-9a-fA-FxX\]+).*vma\[    \]*(\[0-9a-fA-F\]+)"
+       set want "file format srec.*start address\[     \]*(\[0-9a-fA-FxX\]+).*sec1\[   \]+\[0-9a-fA-F\]+\[     \]+(\[0-9a-fA-F\]+)"
        if ![regexp $want $got all start vma] then {
            fail "objcopy --adjust-vma"
        } else {
@@ -234,7 +240,7 @@ if {$low == "" || $origstart == ""} then {
        fail "objcopy --adjust-section-vma +"
     } else {
        set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h tmpdir/copy.srec"]
-       set want "file format srec.*SECTION\[   \]*0\[^\n\r\]*vma\[     \]*(\[0-9a-fA-F\]+)"
+       set want "file format srec.*sec1\[      \]+\[0-9a-fA-F\]+\[     \]+(\[0-9a-fA-F\]+)"
        if ![regexp $want $got all vma] then {
            fail "objcopy --adjust-section-vma +"
        } else {
@@ -254,7 +260,7 @@ if {$low == "" || $origstart == ""} then {
        fail "objcopy --adjust-section-vma ="
     } else {
        set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h tmpdir/copy.srec"]
-       set want "file format srec.*SECTION\[   \]*0\[^\n\r\]*vma\[     \]*(\[0-9a-fA-F\]+)"
+       set want "file format srec.*sec1\[      \]+\[0-9a-fA-F\]+\[     \]+(\[0-9a-fA-F\]+)"
        if ![regexp $want $got all vma] then {
            fail "objcopy --adjust-section-vma ="
        } else {
index 4a8cd7b814190cc5612f707f9dc2bede1a429891..a9eabf810575916e51194dff49d92cb7c543b2cb 100644 (file)
@@ -24,10 +24,11 @@ proc gas_version {} {
     catch "exec $AS -version < /dev/null" tmp
     # Should find a way to discard constant parts, keep whatever's
     # left, so the version string could be almost anything at all...
-    regexp "version (cygnus-|)\[-0-9.a-zA-Z-\]+" $tmp version
-    set tmp $version
-    clone_output "[which $AS] $version\n"
-    unset tmp
+    regexp "\[^\n\]* (cygnus-|)(\[-0-9.a-zA-Z-\]+)\[\r\n\].*" $tmp version cyg number
+    if ![info exists number] then {
+        return "[which $AS] (no version number)\n"
+    }
+    clone_output "[which $AS] $number\n"
     unset version
 }
 
@@ -37,9 +38,13 @@ proc gas_run { prog as_opts redir } {
     global comp_output
     global srcdir
     global subdir
+    global host_triplet
 
-    verbose "Executing $AS $ASFLAGS $as_opts $prog $redir"
+    verbose "Executing $srcdir/lib/run $AS $ASFLAGS $as_opts $srcdir/$subdir/$prog $redir"
     catch "exec $srcdir/lib/run $AS $ASFLAGS $as_opts $srcdir/$subdir/$prog $redir" comp_output
+    set comp_output [prune_system_crud $host_triplet $comp_output]
+    verbose "output was $comp_output"
+    return [list $comp_output ""];
 }
 
 proc all_ones { args } {
@@ -181,6 +186,7 @@ proc run_dump_test { name } {
     global subdir srcdir
     global OBJDUMP NM AS OBJCOPY
     global OBJDUMPFLAGS NMFLAGS ASFLAGS OBJCOPYFLAGS
+    global host_triplet
 
     if [string match "*/*" $name] {
        set file $name
@@ -258,6 +264,7 @@ proc run_dump_test { name } {
 
     send_log "$AS $ASFLAGS $opts(as) -o dump.o $sourcefile\n"
     catch "exec $srcdir/lib/run $AS $ASFLAGS $opts(as) -o dump.o $sourcefile" comp_output
+    set comp_output [prune_system_crud $host_triplet $comp_output]
 
     if ![string match "" $comp_output] then {
        send_log "$comp_output\n"
@@ -275,14 +282,18 @@ proc run_dump_test { name } {
     verbose "running $binary $progopts $progopts1" 3
     if { $program == "objcopy" } {
        send_log "$binary $progopts $progopts1 dump.o dump.out\n"
-       if [catch "exec $binary $progopts $progopts1 dump.o dump.out" comp_output] {
+       catch "exec $binary $progopts $progopts1 dump.o dump.out" comp_output
+       set comp_output [prune_system_crud $host_triplet $comp_output]
+       if ![string match "" $comp_output] then {
            send_log "$comp_output\n"
            fail $testname
            return
        }
     } else {
        send_log "$binary $progopts $progopts1 dump.o > dump.out\n"
-       if [catch "exec $binary $progopts $progopts1 dump.o > dump.out" comp_output] {
+       catch "exec $binary $progopts $progopts1 dump.o > dump.out" comp_output
+       set comp_output [prune_system_crud $host_triplet $comp_output]
+       if ![string match "" $comp_output] then {
            send_log "$comp_output\n"
            fail $testname
            return
@@ -292,6 +303,7 @@ proc run_dump_test { name } {
     verbose_eval {[file_contents "dump.out"]} 3
     if { [regexp_diff "dump.out" "${file}.d"] } then {
        fail $testname
+       verbose "output is [file_contents "dump.out"]" 2
        return
     }
 
@@ -328,8 +340,10 @@ proc slurp_options { file } {
 proc objdump { opts } {
     global OBJDUMP
     global comp_output
+    global host_triplet
 
     catch "exec $OBJDUMP $opts" comp_output
+    set comp_output [prune_system_crud $host_triplet $comp_output]
     verbose "objdump output=$comp_output\n" 3
 }
 
@@ -447,3 +461,29 @@ proc verbose_eval { expr { level 1 } } {
     global verbose
     if $verbose>$level then { eval verbose "$expr" $level }
 }
+
+# This definition is taken from an unreleased version of DejaGnu.  Once
+# that version gets released, and has been out in the world for a few
+# months at least, it may be safe to delete this copy.
+if ![string length [info proc prune_system_crud]] {
+    #
+    # prune_system_crud -- delete various system verbosities from TEXT on SYSTEM
+    #
+    # An example is:
+    # ld.so: warning: /usr/lib/libc.so.1.8.1 has older revision than expected 9
+    #
+    # SYSTEM is typical $target_triplet or $host_triplet.
+    #
+    # This is useful when trying to do pattern matches on program output.
+    # Sites with particular verbose os's may wish to override this in site.exp.
+    #
+    proc prune_system_crud { system text } {
+       # This is from sun4's.  Do it for all machines for now.
+       # The "\\1" is to try to preserve a "\n" but only if necessary.
+       regsub -all "(^|\n)(ld.so: warning:\[^\n\]*\n?)+" $text "\\1" text
+
+       # It might be tempting to get carried away and delete blank lines, etc.
+       # Just delete *exactly* what we're ask to, and that's it.
+       return $text
+    }
+}
index 43307c315591d86b257ae3b3c34c5ce408b396f5..d317dc348900c2814e940c306e869fbb5bfbfe06 100644 (file)
@@ -1,3 +1,51 @@
+Tue Jan 28 14:42:31 1997  Bob Manson  <manson@charmed.cygnus.com>
+
+          Major rewrite for testsuite revision.
+       
+       * lib/gdb.exp: Remove references to global CC, CXX, B_OPTIONS,
+       TARGET_INCLUDES, LDFLAGS and target_alias. Use gdb_spawn_id
+       instead of relying on spawn_id to always contain a valid
+       spawn id.
+       (get_compiler_info): New procedure to build the ${binfile}.ci
+       file, instead of replicating this in N different places.
+       (gdb_compile): New procedure.
+       
+       gdb.*/*.exp: Use gdb_compile and get_compiler_info (with
+       appropriate arguments) instead of compile. Use gdb_test in a lot
+       more places.  Use send_gdb instead of send. Always run gdb_start
+       at the start of a testcase, as this is no longer done magically.
+
+       config/*-gdb.exp: Rename without the -gdb suffix.
+
+       config/mips.exp: Use remote_close instead of exit_remote_shell.
+       config/monitor.exp: Use target_info instead of looking at
+       baud, timeout, etc.
+       config/sim.exp: Use gdb_spawn_id instead of relying on spawn_id.
+
+Sat Dec 14 00:43:57 1996  Peter Schauer  (pes@regent.e-technik.tu-muenchen.de)
+
+       * gdb.c++/templates.exp (test_ptype_of_templates),
+       gdb.c++/inherit.exp (test_ptype_si, test_print_anon_union):
+       Update expect patterns for destructors and assignment operators
+       to match corresponding c-typeprint.c changes.
+       * gdb.c++/templates.exp (test_template_breakpoints):  Revert change
+       to destructor breakpoint test, GDB should be able to set the
+       destructor breakpoint without specifying arguments.
+
+Tue Dec  3 20:17:52 1996  Fred Fish  <fnf@ninemoons.com>
+
+       * gdb.threads/pthreads.exp: Change result for failure to compile due
+       to lack of pthreads runtime support from an error to simply an
+       unsupported test, per dejagnu standards.
+
+Sun Dec  1 00:18:59 1996  Peter Schauer  (pes@regent.e-technik.tu-muenchen.de)
+
+       * lib/gdb.exp (gdb_test):  Simplify expect pattern for the case
+       where GDB exits to reduce pattern match time.
+       (skip_chill_tests):  Skip chill tests for mips*-sgi-irix6*.
+
+       * gdb.base/nodebug.exp:  Add mips*-sgi-irix6* xfails.
+
 Tue Nov 26 18:29:23 1996  Michael Snyder  <msnyder@cleaver.cygnus.com>
 
        * gdb.base/callfuncs.exp: Turn on function call tests for h8300.
index 8bd4532cc76d77d234e31d92f2b1a97e78c075fe..1a2f7a9bc395e8ab9d200b13b4234a1a551b390d 100644 (file)
@@ -1,2 +1 @@
-push_target mvme135
 load_lib ../config/monitor.exp
diff --git a/gdb/testsuite/config/d10v.exp b/gdb/testsuite/config/d10v.exp
new file mode 100644 (file)
index 0000000..7809093
--- /dev/null
@@ -0,0 +1 @@
+load_lib "../config/monitor.exp"
diff --git a/gdb/testsuite/config/gdbserver.exp b/gdb/testsuite/config/gdbserver.exp
new file mode 100644 (file)
index 0000000..e9e873e
--- /dev/null
@@ -0,0 +1,105 @@
+# Test Framework Driver for GDB using the extended gdb remote protocol
+#   Copyright 1995 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+#
+# For this to function correctly, you need to set a number of variables
+# in your gdb/site.exp file
+#
+#      set noargs 1            -- we can't pass arguments (yet)
+#      set noinferiorio 1      -- we can't get io to/from the inferior
+#      set targethost <host>   -- name of the remote system (runs gdbserver)
+#      set debughost <host>    -- name of the system running gdb
+#      set port <number>       -- starting port number for communication
+#      set gdbserver <path>    -- path (on the remote side) to find
+#                                 gdbserver
+#       set rsh <path>         -- path (on debughost side) to rsh
+#      set rcp <path>          -- path (on debughost side) to rcp
+#      
+# You will need to be able to spawn processes from gdbhost to run on
+# targethost via rsh (this is how we start gdbserver); similarly
+# you need to be able to rcp files from gdbhost to targethost.
+#
+# We don't do much error checking, if something goes wrong, you'll probably
+# just get a tcl error and everything will die.  FIXME
+#
+
+# Load the basic gdb testing library
+load_lib gdb.exp
+load_lib monitor.exp
+
+#
+# gdb_load -- load a file into the debugger.
+#             return a -1 if anything goes wrong.
+#
+# Loading a file in the gdbsrever framework is a little strange in that
+# we also create the inferior (which is stopped at the first instruction
+# in the program when we get control).
+#
+proc gdb_load { arg } {
+    global verbose
+    global loadpath
+    global loadfile
+    global GDB
+    global prompt
+    global debughost
+    global port
+
+    # first load the file into gdb
+    if [gdb_file_cmd $arg] then { return -1 }
+
+    # bump the port number to avoid conflicts with hung ports
+    set targethost [target_info gdb_server_host];
+    set debughost [target_info gdb_debug_host];
+    if [target_info exists gdb_server_prog] {
+       set gdbserver [target_info gdb_server_prog];
+    } else {
+       set gdbserver "gdbserver";
+    }
+    incr port
+    set serialport $targethost:$port
+     
+    # Copy the file down to the remote host.
+    set file [remote_download host $arg];
+
+    # now start gdbserver on the remote side
+    remote_spawn host "$gdbserver $debughost:$port $file >& /dev/null < /dev/null"
+    # give it plenty of time to get going (lynx)
+    sleep 30
+
+    # tell gdb we are remote debugging
+    gdb_target_monitor
+
+    return 1
+}
+
+#
+# gdb_start -- start GDB running.
+#
+proc gdb_start { } {
+    global prompt
+
+    # do the usual stuff
+    catch default_gdb_start
+
+    # FIXME: This shouldn't be necessary, but lots of PA tests fail
+    # without it.
+    send "set remotecache 0\n"
+    expect {
+       -re "set remotecache 0\[\r\n\]+.*$prompt $" {}
+       default { fail "gdb_start"}
+    }
+}
diff --git a/gdb/testsuite/config/m32r-stub.exp b/gdb/testsuite/config/m32r-stub.exp
new file mode 100644 (file)
index 0000000..d3c7058
--- /dev/null
@@ -0,0 +1,463 @@
+#   Copyright (C) 1996 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# DejaGnu@cygnus.com
+
+# This file was written by Michael Snyder <msnyder@cygnus.com>.
+
+# GDB support routines for a board using Mitsubishi M32R remote debugging
+# protocol.
+
+load_lib remote.exp
+load_lib gdb.exp
+
+
+#
+# M32R remote run command.
+#
+# This requires that we beep the user and ask him to push the board reset!
+# Then we will switch to the monitor target, run the program, use 2 ^C's
+# to interrupt the monitor target, and switch back to the remote target.
+# Then we have to do a continue to get past the stub breakpoint.
+#
+
+proc gdb_run_cmd {} {
+    global prompt
+    global gdb_spawn_id
+
+    set timeout 60
+    verbose "Timeout is now $timeout seconds, starting remote stub" 2
+    send_user "\aPlease reset the board now...\a\n"
+    sleep 1
+    send_user "\a\n"
+    sleep 1
+    send_user "\a\n"
+    sleep 1
+    send_user "\a\n"
+
+    # go back to monitor, run the program, interrupt it, and start remote.
+
+    if [target_info exists gdb_protocol] {
+       set protocol [target_info gdb_protocol];
+    } else {
+       set protocol "sparclet"
+    }
+    if [target_info exists serial] {
+       set targetname [target_info serial];
+       send_gdb "target $protocol [target_info serial]\n";
+    } else {
+       if ![target_info exists netport] {
+           perror "Need either netport or gdb_serial entry for [target_info name].";
+           return -1;
+       }
+       set targetname [target_info netport];
+       send_gdb "target $protocol udp [target_info netport]\n";
+    }
+
+    expect {
+       -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re "Remote target.*$prompt $" { }
+       -i $gdb_spawn_id -re ".*SPARCLET appears to be alive.*$prompt $" {
+           if $verbose>1 then {
+               send_user "Set target to $targetname\n"
+           }
+       }
+       -i $gdb_spawn_id timeout { 
+           set timeout 10
+           verbose "Timeout is now $timeout seconds" 2
+           perror "Couldn't set M32R target."
+           return -1
+       }
+    }
+
+    send_gdb "disable\n";
+    expect {
+       -i $gdb_spawn_id -re ".*$prompt $" {
+           verbose "Breakpoints disabled" 2
+       }
+       -i $gdb_spawn_id timeout { 
+           perror "(timeout) disabling breakpoints";
+           return -1 
+       }
+       -i $gdb_spawn_id default {
+           perror "error disabling breakpoints";
+       }
+    }
+    send_gdb "run\n";
+    expect {
+       -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re "The program being debugged .*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re ".*Starting program:.*$" { 
+           verbose "Starting remote stub succeeded" 
+       }
+       -i $gdb_spawn_id timeout { 
+           perror "(timeout) starting the remote stub" ; 
+           return -1 
+       }
+       -i $gdb_spawn_id default {
+           perror "error starting the remote stub";
+       }
+    }
+    sleep 2;
+    send_gdb "\ 3"
+    sleep 1;
+    send_gdb "\ 3"
+    verbose "Sent ^C^C"
+    expect {
+       -i $gdb_spawn_id -re ".*Give up .and stop debugging it.*$" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re ".*$prompt $" { 
+           verbose "interrupting remote stub succeeded"
+       }
+       -i $gdb_spawn_id timeout { 
+           perror "(timeout) interrupting the remote stub";
+           return -1 
+       }
+       -i $gdb_spawn_id default {
+           perror "error interrupting the remote stub";
+       }
+    }
+
+    if [target_info exists gdb_serial] {
+       send_gdb "target remote [target_info gdb_serial]\n"
+       expect {
+           -i $gdb_spawn_id -re ".*Kill it?.*y or n.*" {
+               send_gdb "y\n";
+               exp_continue
+           }
+           -i $gdb_spawn_id -re ".*$prompt $"  {
+               verbose "connected to stub at [target_info gdb_serial]" 2
+           }
+           -i $gdb_spawn_id timeout { 
+               set timeout 10
+               verbose "Timeout is now $timeout seconds" 2
+               perror "Couldn't set remote target."
+               return -1
+           }
+       }
+    }
+
+    send_gdb "enable\n";
+    expect {
+       -i $gdb_spawn_id -re ".*$prompt $" {
+           verbose "Breakpoints enabled" 2
+       }
+       -i $gdb_spawn_id timeout { 
+           perror "(timeout) enabling breakpoints";
+           return -1 
+       }
+       -i $gdb_spawn_id default {
+           perror "error enabling breakpoints";
+       }
+    }
+    send_gdb "continue\n";
+    return
+}
+
+
+#
+# gdb_load -- load a file into the GDB. 
+#             Returns a 0 if there was an error,
+#                       1 if it load successfully.
+#
+proc gdb_load { arg } {
+    global verbose
+    global loadpath
+    global loadfile
+    global prompt
+    global GDB
+    global expect_out
+    global gdb_spawn_id
+
+    set loadfile [file tail $arg]
+    set loadpath [file dirname $arg]
+
+    if [target_info exists gdb_protocol] {
+       set protocol [target_info gdb_protocol];
+    } else {
+       set protocol "m32r"
+    }
+
+    # get the stub-based loader for faster loading
+    send_gdb "file [target_info gdb_loader]\n"
+    expect {
+       -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+        -i $gdb_spawn_id -re "Load new symbol table.*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re "Reading symbols from.*done..*$prompt $" {}
+       -i $gdb_spawn_id -re "$prompt $" { perror "GDB couldn't find loader" }
+       -i $gdb_spawn_id timeout { 
+           perror "(timeout) read symbol file" ; 
+           return -1
+       }
+    }
+
+    if [target_info exists serial] {
+       set targetname [target_info serial];
+       send_gdb "target $protocol [target_info serial]\n";
+    } else {
+       if ![target_info exists netport] {
+           perror "Need either netport or gdb_serial entry for [target_info name].";
+           return -1;
+       }
+       set targetname [target_info netport];
+       send_gdb "target $protocol udp [target_info netport]\n";
+    }
+    expect {
+       -i $gdb_spawn_id -re "Remote target.*$prompt $" { }
+       -i $gdb_spawn_id -re ".*SPARCLET appears to be alive.*$prompt $" {
+           if $verbose>1 then {
+               send_user "Set target to $targetname\n"
+           }
+       }
+       -i $gdb_spawn_id timeout { 
+           set timeout 10
+           verbose "Timeout is now $timeout seconds" 2
+           perror "Couldn't set M32R target."
+           return -1
+       }
+    }
+
+    send_gdb "run\n";
+    expect {
+       -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re "The program being debugged .*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re ".*Starting program:.*loader.*$" { 
+           verbose "Starting loader succeeded" 
+       }
+       -i $gdb_spawn_id timeout { 
+           perror "(timeout) starting the loader" ; 
+           return -1 
+       }
+       -i $gdb_spawn_id default {
+           perror "error starting the loader";
+       }
+    }
+    sleep 2;
+    send_gdb "\ 3"
+    sleep 1;
+    send_gdb "\ 3"
+    verbose "Sent ^C^C"
+    expect {
+       -i $gdb_spawn_id -re ".*Give up .and stop debugging it.*$" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re ".*$prompt $" { 
+           verbose "Running loader succeeded" 
+       }
+       -i $gdb_spawn_id timeout { 
+           perror "(timeout) interrupting the loader" ; 
+           return -1 
+       }
+       -i $gdb_spawn_id default {
+           perror "error interrupting the loader";
+       }
+    }
+
+    # Now ready to actually load the file:
+
+    send_gdb "file $arg\n"
+    expect {
+       -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+        -i $gdb_spawn_id -re "Load new symbol table.*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re "Reading symbols from.*done..*$prompt $" {}
+       -i $gdb_spawn_id -re "$prompt $" { perror "GDB couldn't read file" }
+       -i $gdb_spawn_id timeout { 
+           perror "(timeout) read symbol file" ; 
+           return -1 
+       }
+    }
+
+    if [target_info exists gdb_serial] {
+       send_gdb "target remote [target_info gdb_serial]\n"
+       expect {
+           -i $gdb_spawn_id -re ".*Kill it?.*y or n.*" {
+               send_gdb "y\n";
+               exp_continue
+           }
+           -i $gdb_spawn_id -re ".*$prompt $"  {
+               verbose "Set remote target to [target_info serial]" 2
+           }
+           -i $gdb_spawn_id timeout { 
+               set timeout 10
+               verbose "Timeout is now $timeout seconds" 2
+               perror "Couldn't set remote target."
+               return -1
+           }
+       }
+    }
+    if [target_info exists gdb_load_offset] {
+       set offset "[target_info gdb_load_offset]";
+    } else {
+       set offset "";
+    }
+    send_gdb "load $arg $offset\n"
+    verbose "Loading $arg into $GDB" 2
+    set timeout 1200
+    verbose "Timeout is now $timeout seconds" 2
+    expect {
+       -i $gdb_spawn_id -re "Loading.*$prompt $" {
+           verbose "Loaded $arg into $GDB" 1
+           set timeout 60
+           verbose "Timeout is now $timeout seconds" 2
+       }
+       -i $gdb_spawn_id -re "$prompt $"     {
+           if $verbose>1 then {
+               perror "GDB couldn't load."
+           }
+       }
+       -i $gdb_spawn_id timeout {
+           if $verbose>1 then {
+               perror "Timed out trying to load $arg."
+           }
+       }
+    }
+
+    send_user "\aPlease reset the board now...\a\n"
+    sleep 1
+    send_user "\a\n"
+    sleep 1
+    send_user "\a\n"
+    sleep 1
+    send_user "\a\n"
+
+    # go back to monitor, run the program, interrupt it, and start remote.
+
+    if [target_info exists serial] {
+       set targetname [target_info serial];
+       send_gdb "target $protocol [target_info serial]\n";
+    } else {
+       if ![target_info exists netport] {
+           perror "Need either netport or gdb_serial entry for [target_info name].";
+           return -1;
+       }
+       set targetname [target_info netport];
+       send_gdb "target $protocol udp [target_info netport]\n";
+    }
+
+    expect {
+       -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re "Remote target.*$prompt $" { }
+       -i $gdb_spawn_id -re ".*SPARCLET appears to be alive.*$prompt $" {
+           if $verbose>1 then {
+               send_user "Set target to $targetname\n"
+           }
+       }
+       -i $gdb_spawn_id timeout { 
+           set timeout 10
+           verbose "Timeout is now $timeout seconds" 2
+           perror "Couldn't set M32R target."
+           return -1
+       }
+    }
+
+    send_gdb "run\n";
+    expect {
+       -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re "The program being debugged .*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re ".*Starting program:.*$" { 
+           verbose "Starting remote stub succeeded" 
+       }
+       -i $gdb_spawn_id timeout { 
+           perror "(timeout) starting the remote stub" ; 
+           return -1 
+       }
+       -i $gdb_spawn_id default {
+           perror "error starting the remote stub";
+       }
+    }
+    sleep 2;
+    send_gdb "\ 3"
+    sleep 1;
+    send_gdb "\ 3"
+    verbose "Sent ^C^C"
+    expect {
+       -i $gdb_spawn_id -re ".*Give up .and stop debugging it.*$" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re ".*$prompt $" { 
+           verbose "interrupting remote stub succeeded"
+       }
+       -i $gdb_spawn_id timeout { 
+           perror "(timeout) interrupting the remote stub";
+           return -1 
+       }
+       -i $gdb_spawn_id default {
+           perror "error interrupting the remote stub";
+       }
+    }
+
+    if [target_info exists gdb_serial] {
+       send_gdb "target remote [target_info gdb_serial]\n"
+       expect {
+           -i $gdb_spawn_id -re ".*Kill it?.*y or n.*" {
+               send_gdb "y\n";
+               exp_continue
+           }
+           -i $gdb_spawn_id -re ".*$prompt $"  {
+               verbose "connected to stub at [target_info gdb_serial]" 2
+           }
+           -i $gdb_spawn_id timeout { 
+               set timeout 10
+               verbose "Timeout is now $timeout seconds" 2
+               perror "Couldn't set remote target."
+               return -1
+           }
+       }
+    }
+    return 0
+}
+
diff --git a/gdb/testsuite/config/mips-gdb.exp b/gdb/testsuite/config/mips-gdb.exp
deleted file mode 100644 (file)
index ce58ee5..0000000
+++ /dev/null
@@ -1,251 +0,0 @@
-#   Copyright (C) 1993 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
-
-# Please email any bugs, comments, and/or additions to this file to:
-# DejaGnu@cygnus.com
-
-# This file was written by Ian Lance Taylor <ian@cygnus.com>.
-
-# GDB support routines for a board using the MIPS remote debugging
-# protocol.  These are actually pretty generic.
-
-# DejaGnu currently assumes that debugging is being done over the main
-# console port.  It would probably be more convenient for people using
-# IDT boards to permit the debugging port and the connected port to be
-# different, since an IDT board has two ports.  This would require
-# extending some of the tests in a fashion similar to that done for
-# VxWorks, because the test output would appear on the other port,
-# rather than being displayed by gdb.
-
-load_lib remote.exp
-load_lib gdb.exp
-
-#
-# gdb_version -- extract and print the version number of gdb
-#
-proc gdb_version {} {
-    global GDB
-    global GDBFLAGS
-    global prompt
-    set tmp [exec echo "q" | $GDB]
-    set version [lindex $tmp [lsearch $tmp "\[0-9\]*"]]
-    set version [string range $version 0 [expr [string length $version]-2]]
-    clone_output "[which $GDB] version $version $GDBFLAGS\n"
-}
-
-#
-# gdb_load -- load a file into the GDB. 
-#             Returns a 0 if there was an error,
-#                       1 if it load successfully.
-#
-proc gdb_load { arg } {
-    global verbose
-    global loadpath
-    global loadfile
-    global prompt
-    global spawn_id
-    global GDB
-    global expect_out
-    global targetname
-
-    set loadfile [file tail $arg]
-    set loadpath [file dirname $arg]
-
-    send "file $arg\n"
-    expect {
-       -re "A program is being debugged already..*Kill it.*y or n. $" {
-           send "y\n"
-           exp_continue
-       }
-       -re "Reading symbols from.*done..*$prompt $" {}
-       -re "$prompt $" { perror "GDB couldn't read file" }
-       timeout { perror "(timeout) read symbol file" ; return -1 }
-    }
-
-    send "target mips $targetname\n"
-    set timeout 60
-    verbose "Timeout is now $timeout seconds" 2
-    expect {
-       -re "Remote MIPS debugging.*$prompt $"  {
-           if $verbose>1 then {
-               send_user "Set target to $targetname\n"
-           }
-       }
-       timeout { 
-           perror "Couldn't set MIPS target."
-           set timeout 10
-           verbose "Timeout is now $timeout seconds" 2
-           return -1
-       }
-    }
-    
-    send "load $arg\n"
-    if $verbose>1 then {
-       send_user "Loading $arg into $GDB\n"
-    }
-    set timeout 2400
-    verbose "Timeout is now $timeout seconds" 2
-    expect {
-       -re "Loading.*$prompt $" {
-           if $verbose>1 then {
-               send_user "Loaded $arg into $GDB\n"
-           }
-           set timeout 30
-           verbose "Timeout is now $timeout seconds" 2
-       }
-       -re "$prompt $"     {
-           if $verbose>1 then {
-                perror "GDB couldn't load."
-           }
-       }
-       timeout {
-           if $verbose>1 then {
-                perror "Timed out trying to load $arg."
-           }
-       }
-    }
-    set timeout 10
-    verbose "Timeout is now $timeout seconds" 2
-    if [info exists expect_out(buffer)] then {
-       send_log $expect_out(buffer)
-    }
-    return 0
-}
-
-#
-# gdb_start -- start GDB running.
-#
-proc gdb_start { } {
-    global GDB
-    global GDBFLAGS
-    global spawn_id
-    global shell_id
-    global prompt
-    global verbose
-    global targetname
-    global connectmode
-    global reboot
-    global baud
-
-    # reboot the board to get a clean start
-    if $reboot then {
-       if ![info exists connectmode] then {
-           set connectmode "kermit"
-       }       
-       if ![info exists baud] then {
-           set baud 9600
-       }
-       set shell_id [ eval $connectmode "$targetname" ]
-       send -i $shell_id "\n"
-       expect {
-           -i $shell_id -re "<IDT>$" { }
-           timeout {
-               send -i $shell_id "\CC"
-               expect {
-                   -i $shell_id -re "<IDT>$" { }
-                   timeout {
-                perror "(timeout) board did not come up."; return -1
-                   }
-               }
-           }
-       }
-       send -i $shell_id "go 0xbfc00000\n"
-       expect {
-           -i $shell_id -re "<IDT>$" { }
-           timeout     { perror "(timeout) board did not come up."; return -1 }
-       }
-       verbose "about to exit kermit"
-       exit_remote_shell $shell_id
-    }
-
-    set GDB [which $GDB]
-    # start GDB
-    if [ llength $GDBFLAGS ] then {
-       spawn $GDB $GDBFLAGS
-    } else {
-       spawn $GDB
-    }
-    expect  {
-       -re ".*\r\n$prompt $" {
-           verbose "GDB initialized."
-       }
-       -re "$prompt $" {
-           perror "GDB never initialized."
-           return -1
-       }
-       timeout         {
-           perror "(timeout) GDB never initialized."
-           return -1
-       }
-    }
-
-    # force the height to "unlimited", so no pagers get used
-    send "set height 0\n"
-    expect -re ".*$prompt $" {}
-    # force the width to "unlimited", so no wraparound occurs
-    send "set width 0\n"
-    expect -re ".*$prompt $" {}
-
-    # Don't use floating point instructions, in case the board doesn't
-    # support them.
-    send "set mipsfpu off\n"
-    expect -re ".*$prompt $" {}
-
-#    if $verbose>1 then {
-#      send_user "Setting up target, please wait...\n"
-#    }
-#    send "target mips $targetname\n"
-#    set timeout 60
-#    verbose "Timeout is now $timeout seconds" 2
-#    expect {
-#      -re "Remote MIPS debugging.*$prompt $"  {
-#          if $verbose>1 then {
-#              send_user "Set target to $targetname\n"
-#          }
-#      }
-#      timeout { 
-#          perror "Couldn't set MIPS target."
-#          set timeout 10
-#          verbose "Timeout is now $timeout seconds" 2
-#          return -1
-#      }
-#    }
-    set timeout 10
-    verbose "Timeout is now $timeout seconds" 2
-}
-
-expect_after {
-    "<return>"            { send "\n"; perror "Window too small." }
-    -re "\(y or n\) "     { send "n\n"; perror "Got interactive prompt." }
-    full_buffer                   { perror "internal buffer is full." }
-    eof                           { perror "eof -- pty is hosed." }
-    timeout                       { perror "timeout." }
-    "virtual memory exhausted" { perror "virtual memory exhausted." }
-    "Undefined command"           { perror "send string probably wrong." }
-}
-
-proc gdb_exit { } {
-    catch default_gdb_exit
-}
-
-gdb_start
-
-# make sure gdb has actually started, otherwise if the first test
-# timesout, DejaGnu crashes
-send "\n"
-expect {
-    -re "$prompt"
-    }
diff --git a/gdb/testsuite/config/mips-idt.exp b/gdb/testsuite/config/mips-idt.exp
new file mode 100644 (file)
index 0000000..2adaa75
--- /dev/null
@@ -0,0 +1,22 @@
+#   Copyright (C) 1993 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+# Please email any bugs, comments, and/or additions to this file to:
+# DejaGnu@cygnus.com
+
+load_lib ../config/monitor.exp
+
+
diff --git a/gdb/testsuite/config/mips.exp b/gdb/testsuite/config/mips.exp
new file mode 100644 (file)
index 0000000..2adaa75
--- /dev/null
@@ -0,0 +1,22 @@
+#   Copyright (C) 1993 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+# Please email any bugs, comments, and/or additions to this file to:
+# DejaGnu@cygnus.com
+
+load_lib ../config/monitor.exp
+
+
index 9c6d9b12ecbc0f5f630481f72e64d1edf23b0075..a8e79bef79632945bd42f478cff8c97c231e1483 100644 (file)
 
 load_lib gdb.exp
 
-#
-# gdb_version -- extract and print the version number of gdb
-#
-proc gdb_version {} {
-    default_gdb_version
-}
-
 #
 # gdb_target_monitor
 # Set gdb to target the monitor
@@ -31,27 +24,41 @@ proc gdb_version {} {
 proc gdb_target_monitor { } {
     global prompt
     global exit_status
-    global targetname
-    global serialport
-    global baud
-    global target_info
+    global timeout
 
     set timeout 60
-    if {$baud != ""} then {
-       send "set remotebaud $baud\n"
+
+    verbose "Timeout is now $timeout seconds" 2
+    if [target_info exists gdb_protocol] {
+       set targetname "[target_info gdb_protocol]"
+    } else {
+       perror "No protocol specified for [target_info name].";
+       return -1;
     }
-    if [info exists target_info(target,cflags)] {
-       set targetname "$target_info(target,target)"
+    if [target_info exists baud] {
+       send_gdb "set remotebaud [target_info baud]\n"
     }
-    if [info exists target_info(target,netport)] {
-       set serialport "$target_info(target,netport)"
+    if [target_info exists netport] {
+       set serialport "[target_info netport]"
+    } else {
+       set serialport "[target_info serial]"
     }
-    for {set i 1} {$i <= 3} {incr i} {
-       send "target $targetname $serialport\n"
-       expect {
-               -re "Remote target $targetname connected to.*$prompt $" {
-                    verbose "Set target to $targetname"
-                    return
+
+    for {set j 1} {$j <= 2} {incr j} {
+       for {set i 1} {$i <= 3} {incr i} {
+           send_gdb "target $targetname $serialport\n"
+           expect {
+               -re "Remote MIPS debugging.*" {
+                   verbose "Set target to $targetname"
+                   return
+               }
+               -re "Remote debugging using $serialport.*" {
+                   verbose "Set target to $targetname"
+                   return
+               }
+               -re "Remote target $targetname connected to.*"  {
+                   verbose "Set target to $targetname"
+                   return
                }
                -re "Connection refused" {
                    verbose "Connection refused by remote target.  Pausing, and trying again."
@@ -61,10 +68,14 @@ proc gdb_target_monitor { } {
                timeout { 
                    break
                }
+           }
+       }
+       if { $j == 1 && ![reboot_target] } {
+           break;
        }
     }
 
-    perror "Couldn't set target for $targetname."
+    perror "Couldn't set target for $targetname, port is $serialport."
     cleanup
     exit $exit_status
 }
@@ -79,14 +90,23 @@ proc gdb_load { arg } {
     global loadfile
     global GDB
     global prompt
+    global timeout
 
-    if [gdb_file_cmd $arg] then { return -1 }
+    if { $arg != "" } {
+       if [gdb_file_cmd $arg] { return -1 }
+    }
 
     gdb_target_monitor
 
+    if [is_remote host] {
+       # FIXME:
+       set arg a.out;
+    }
+
     verbose "Loading $arg"
-    send "load $arg\n"
-    set timeout 600
+    send_gdb "load $arg\n"
+    set timeout 1000
+    verbose "Timeout is now $timeout seconds" 2
     expect {
        -re ".*$prompt $" {
            if { $verbose > 1 } {
@@ -101,24 +121,22 @@ proc gdb_load { arg } {
        }
        timeout {
            if { $verbose > 1 } {
-        perror "Timed out trying to load $arg."
+               perror "Timed out trying to load $arg."
            }
        }
     }
 }
 
-#
-# gdb_start -- start GDB running.
-#
 proc gdb_start { } {
-    default_gdb_start
-}
+    global timeout
+    global reboot
 
-#
-# gdb_exit -- exit gdb
-#
-proc gdb_exit { } {
-    catch default_gdb_exit
-}
+    # reboot the board to get a clean start
+    if $reboot then {
+       reboot_target;
+    }
+    catch default_gdb_start;
 
-gdb_start
+    set timeout 10
+    verbose "Timeout is now $timeout seconds" 2
+}
index 7dcad4d635082338b5397d8634fd3f03a9baf8de..aa170bb0558805eb7d12b202b99df140d40e984e 100644 (file)
@@ -23,7 +23,6 @@ load_lib gdb.exp
 load_lib remote.exp
 
 global shell_id
-global passwd
 
 global LD
 if ![info exists LD] then {
@@ -55,9 +54,11 @@ proc gdb_load { arg } {
     global LD
     global NLMCONV
     global errorCode
-    global targetname
     global shell_id
 
+    # FIXME: this is wrong.
+    set targetname [target_info name];
+
     set obj [file tail $arg]
     set nlm "$obj.nlm"
     set lnk "$obj.lnk"
@@ -101,21 +102,24 @@ proc gdb_load { arg } {
     gdb_file_cmd $nlm
 }
 
-proc gdb_start { } {
-    default_gdb_start
-}
-  
-proc gdb_exit { } {
-    catch default_gdb_exit
-}
-
 proc gdb_run_cmd { } {
     global shell_id
     global prompt
-    global baud serialport
-    global targetname
     global timeout
 
+    set connhost [target_info name];
+    if [board_info $connhost exists serial] {
+       set serialport [board_info $connhost serial];
+    } else {
+       set serialport [board_info $connhost netport];
+    }
+
+    if [board_info $connhost exists baud] {
+       set baud [board_info $connhost baud];
+    } else {
+       set baud 9600;
+    }
+    # FIXME: This is wrong.
     send "kill\n"
     expect {
        -re ".*Kill the program being debugged.*y or n. $" {
@@ -125,7 +129,7 @@ proc gdb_run_cmd { } {
        -re ".*$prompt $" {}
     }
 
-    verbose "Starting GDB stub on $targetname" 1
+    verbose "Starting GDB stub on [target_info name]" 1
     send -i $shell_id "load nlmstub BAUD=$baud x.nlm\r\n"
 
     send "set remotebaud $baud\n"
@@ -148,12 +152,14 @@ proc gdb_run_cmd { } {
        }
        -re "$prompt" {}
        timeout {
+           set timeout $otimeout
+           verbose "Timeout restored to $timeout seconds" 2
            perror "Couldn't set remote target"
            return
        }
     }
     set timeout $otimeout
-    verbose "Timeout is now $timeout seconds" 2
+    verbose "Timeout restored to $timeout seconds" 2
 
     send "continue\n"
     expect {
@@ -170,7 +176,7 @@ proc gdb_run_cmd { } {
 #
 
 set shell_prompt "Password:"
-set shell_id [ eval $connectmode "$targetname" ]
+set shell_id [remote_open target]
 
 if $shell_id<0 then {
     warning "Couldn't connect to target"
@@ -199,7 +205,8 @@ expect {
 }
 
 
-set shell_prompt "[string toupper $targetname]:"
+# FIXME: this is wrong.
+set shell_prompt "[string toupper [target_info name]]:"
 send -i $shell_id "1\n"
 
 expect {
@@ -209,5 +216,3 @@ expect {
        return -1
     }
 }
-
-gdb_start
similarity index 55%
rename from gdb/testsuite/config/nind-gdb.exp
rename to gdb/testsuite/config/nind.exp
index 52673f128b95db3da081e65ca8346478e7667d85..f44cc58c46f743b7992408b637f114c1ba087ceb 100644 (file)
 
 # This file was written by Rob Savoye. (rob@cygnus.com)
 
-# these need to be initialized only if site.exp doesn't set them
-if ![info exists prompt] then {
-    set prompt "\(gdb\)"
-}
-
-#
-# gdb_version -- extract and print the version number of gdb
-#
-proc gdb_version {} {
-    global GDB
-    global GDBFLAGS
-    global prompt
-    set tmp [exec echo "q" | $GDB]
-    set version [lindex $tmp [lsearch $tmp "\[0-9\]*"]]
-    set version [string range $version 0 [expr [string length $version]-2]]
-    clone_output "[which $GDB] version $version $GDBFLAGS\n"
-}
+load_lib gdb.exp
 
 #
 # gdb_load -- load a file into the debugger.
@@ -61,27 +45,5 @@ proc gdb_start { } {
     global spawn_id
     global prompt
     global verbose
-    global targetname
     send_user "Not implememted yet\n" ; return -1
 }
-
-expect_after {
-    "<return>"            { send "\n"; clone_output "ERROR: Window too small" }
-    -re "\(y or n\) "     { send "n\n"; clone_output "ERROR: Got interactive prompt" }
-    full_buffer                   { clone_output "ERROR: internal buffer is full" }
-    eof                           { clone_output "ERROR: eof -- pty is hosed" }
-    timeout                       { clone_output "ERROR: timeout" }
-    "virtual memory exhausted" { clone_output "ERROR: virtual memory exhausted" }
-    "Undefined command"           { clone_output "ERROR: send string probably wrong" }
-}
-
-load_lib gdb.exp
-
-gdb_start
-
-# make sure gdb has actually started, otherwise if the first test
-# timesout, DejaGnu crashes
-send "\n"
-expect {
-    -re "$prompt"
-    }
similarity index 81%
rename from gdb/testsuite/config/sim-gdb.exp
rename to gdb/testsuite/config/sim.exp
index 58dcca8508dc30b1495b61763880c1dd56efdebd..4c76cacf35cb64494c7b6e58604391830654906d 100644 (file)
 
 load_lib gdb.exp
 
-#
-# gdb_version -- extract and print the version number of gdb
-#
-proc gdb_version {} {
-    default_gdb_version
-}
-
 # The SH simulator by default will allocate 16M of memory, which is
 # convenient, but it slows down testing to chew up that much swap;
 # so supply an option that makes the simulator allocate 256K.
@@ -39,13 +32,14 @@ if [istarget "sh*-*-*"] then {
 # Set gdb to target the simulator
 #
 proc gdb_target_sim { } {
-    global targetname
     global prompt
     global verbose
     global exit_status
     global target_sim_options
+    global gdb_spawn_id
 
-    send "target sim $target_sim_options\n"
+    set spawn_id $gdb_spawn_id
+    send_gdb "target sim $target_sim_options\n"
     set timeout 60
     verbose "Timeout is now $timeout seconds" 2
     expect {
@@ -72,12 +66,15 @@ proc gdb_load { arg } {
     global loadfile
     global GDB
     global prompt
+    global gdb_spawn_id
+
+    set spawn_id $gdb_spawn_id
 
     if [gdb_file_cmd $arg] then { return -1 }
 
     gdb_target_sim
 
-    send "load\n"
+    send_gdb "load\n"
     set timeout 2400
     verbose "Timeout is now $timeout seconds" 2
     expect {
@@ -101,27 +98,3 @@ proc gdb_load { arg } {
        }
     }
 }
-
-#
-# gdb_start -- start GDB running.
-#
-proc gdb_start { } {
-    default_gdb_start
-    verbose "Setting up target, Please wait..."
-}
-
-#
-# gdb_exit -- exit gdb
-#
-proc gdb_exit { } {
-    catch default_gdb_exit
-}
-
-gdb_start
-
-# make sure gdb has actually started, otherwise if the first test
-# timesout, DejaGnu crashes
-send "\n"
-expect {
-    -re "$prompt"
-    }
diff --git a/gdb/testsuite/config/slite-gdb.exp b/gdb/testsuite/config/slite-gdb.exp
deleted file mode 100644 (file)
index 58fd2f2..0000000
+++ /dev/null
@@ -1,273 +0,0 @@
-#   Copyright (C) 1993 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-# 
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
-
-# Please email any bugs, comments, and/or additions to this file to:
-# DejaGnu@cygnus.com
-
-# This file was written by Ian Lance Taylor <ian@cygnus.com>.
-
-# GDB support routines for a board using the MIPS remote debugging
-# protocol.  These are actually pretty generic.
-
-# DejaGnu currently assumes that debugging is being done over the main
-# console port.  It would probably be more convenient for people using
-# IDT boards to permit the debugging port and the connected port to be
-# different, since an IDT board has two ports.  This would require
-# extending some of the tests in a fashion similar to that done for
-# VxWorks, because the test output would appear on the other port,
-# rather than being displayed by gdb.
-
-load_lib remote.exp
-load_lib gdb.exp
-
-#
-# gdb_version -- extract and print the version number of gdb
-#
-proc gdb_version {} {
-    global GDB
-    global GDBFLAGS
-    global prompt
-    set tmp [exec echo "q" | $GDB]
-    set version [lindex $tmp [lsearch $tmp "\[0-9\]*"]]
-    set version [string range $version 0 [expr [string length $version]-2]]
-    clone_output "[which $GDB] version $version $GDBFLAGS\n"
-}
-
-#
-# gdb_load -- load a file into the GDB. 
-#             Returns a 0 if there was an error,
-#                       1 if it load successfully.
-#
-proc gdb_load { arg } {
-    global verbose
-    global loadpath
-    global loadfile
-    global prompt
-    global spawn_id
-    global GDB
-    global expect_out
-    global targetname
-
-    set loadfile [file tail $arg]
-    set loadpath [file dirname $arg]
-
-    send "file $arg\n"
-    expect {
-       -re "A program is being debugged already..*Kill it.*y or n. $" {
-           send "y\n"
-           exp_continue
-       }
-        -re "Load new symbol table.*y or n. $" {
-           send "y\n"
-           exp_continue
-       }
-       -re "Reading symbols from.*done..*$prompt $" {}
-       -re "$prompt $" { perror "GDB couldn't read file" }
-       timeout { perror "(timeout) read symbol file" ; return -1 }
-    }
-
-    send "target sparclite $targetname\n"
-    set timeout 60
-    verbose "Timeout is now $timeout seconds" 2
-    expect {
-       -re ".*SPARClite appears to be alive.*$prompt $"        {
-           if $verbose>1 then {
-               send_user "Set target to $targetname\n"
-           }
-       }
-       timeout { 
-           perror "Couldn't set SLITE target."
-           set timeout 10
-           verbose "Timeout is now $timeout seconds" 2
-           return -1
-       }
-    }
-    
-    send "load $arg\n"
-    if $verbose>1 then {
-       send_user "Loading $arg into $GDB\n"
-    }
-    set timeout 2400
-    verbose "Timeout is now $timeout seconds" 2
-    expect {
-       -re "Loading.*$prompt $" {
-           if $verbose>1 then {
-               send_user "Loaded $arg into $GDB\n"
-           }
-           set timeout 30
-           verbose "Timeout is now $timeout seconds" 2
-       }
-       -re "$prompt $"     {
-           if $verbose>1 then {
-                perror "GDB couldn't load."
-           }
-       }
-       timeout {
-           if $verbose>1 then {
-                perror "Timed out trying to load $arg."
-           }
-       }
-    }
-    set timeout 10
-    verbose "Timeout is now $timeout seconds" 2
-
-    send "target remote $targetname\n"
-    set timeout 60
-    verbose "Timeout is now $timeout seconds" 2
-    expect {
-       -re ".*$prompt $"       {
-           if $verbose>1 then {
-               send_user "Set remote target to $targetname\n"
-           }
-       }
-       timeout { 
-           perror "Couldn't set remote target."
-           set timeout 10
-           verbose "Timeout is now $timeout seconds" 2
-           return -1
-       }
-    }
-
-    if [info exists expect_out(buffer)] then {
-       send_log $expect_out(buffer)
-    }
-    return 0
-}
-
-#
-# gdb_start -- start GDB running.
-#
-proc gdb_start { } {
-    global GDB
-    global GDBFLAGS
-    global spawn_id
-    global shell_id
-    global prompt
-    global verbose
-    global targetname
-    global connectmode
-    global reboot
-    global baud
-
-    # reboot the board to get a clean start
-    if $reboot then {
-       if ![info exists connectmode] then {
-           set connectmode "kermit"
-       }       
-       if ![info exists baud] then {
-           set baud 9600
-       }
-       set shell_id [ eval $connectmode "$targetname" ]
-       send -i $shell_id "\n"
-       expect {
-           -i $shell_id -re ">$" { }
-           timeout {
-               send -i $shell_id "\CC"
-               expect {
-                   -i $shell_id -re ">$" { }
-                   timeout {
-                perror "(timeout) board did not come up."; return -1
-                   }
-               }
-           }
-       }
-       send -i $shell_id "go 0xbfc00000\n"
-       expect {
-           -i $shell_id -re ">$" { }
-           timeout     { perror "(timeout) board did not come up."; return -1 }
-       }
-       verbose "about to exit kermit"
-       exit_remote_shell $shell_id
-    }
-
-    set GDB [which $GDB]
-    # start GDB
-    if [ llength $GDBFLAGS ] then {
-       spawn $GDB $GDBFLAGS
-    } else {
-       spawn $GDB
-    }
-    expect  {
-       -re ".*\r\n$prompt $" {
-           verbose "GDB initialized."
-       }
-       -re "$prompt $" {
-           perror "GDB never initialized."
-           return -1
-       }
-       timeout         {
-           perror "(timeout) GDB never initialized."
-           return -1
-       }
-    }
-
-    # force the height to "unlimited", so no pagers get used
-    send "set height 0\n"
-    expect -re ".*$prompt $" {}
-    # force the width to "unlimited", so no wraparound occurs
-    send "set width 0\n"
-    expect -re ".*$prompt $" {}
-
-    # Don't use floating point instructions, in case the board doesn't
-    # support them.
-    # send "set mipsfpu off\n"
-    # expect -re ".*$prompt $" {}
-
-#    if $verbose>1 then {
-#      send_user "Setting up target, please wait...\n"
-#    }
-#    send "target mips $targetname\n"
-#    set timeout 60
-#    verbose "Timeout is now $timeout seconds" 2
-#    expect {
-#      -re "Remote MIPS debugging.*$prompt $"  {
-#          if $verbose>1 then {
-#              send_user "Set target to $targetname\n"
-#          }
-#      }
-#      timeout { 
-#          perror "Couldn't set MIPS target."
-#          set timeout 10
-#          verbose "Timeout is now $timeout seconds" 2
-#          return -1
-#      }
-#    }
-    set timeout 10
-    verbose "Timeout is now $timeout seconds" 2
-}
-
-expect_after {
-    "<return>"            { send "\n"; perror "Window too small." }
-    -re "\(y or n\) "     { send "n\n"; perror "Got interactive prompt." }
-    full_buffer                   { perror "internal buffer is full." }
-    eof                           { perror "eof -- pty is hosed." }
-    timeout                       { perror "timeout." }
-    "virtual memory exhausted" { perror "virtual memory exhausted." }
-    "Undefined command"           { perror "send string probably wrong." }
-}
-
-proc gdb_exit { } {
-    catch default_gdb_exit
-}
-
-gdb_start
-
-# make sure gdb has actually started, otherwise if the first test
-# timesout, DejaGnu crashes
-send "\n"
-expect {
-    -re "$prompt"
-    }
diff --git a/gdb/testsuite/config/slite.exp b/gdb/testsuite/config/slite.exp
new file mode 100644 (file)
index 0000000..7109a2e
--- /dev/null
@@ -0,0 +1,168 @@
+#   Copyright (C) 1993 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+# Please email any bugs, comments, and/or additions to this file to:
+# DejaGnu@cygnus.com
+
+# This file was written by Ian Lance Taylor <ian@cygnus.com>.
+
+# GDB support routines for a board using the MIPS remote debugging
+# protocol.  These are actually pretty generic.
+
+# DejaGnu currently assumes that debugging is being done over the main
+# console port.  It would probably be more convenient for people using
+# IDT boards to permit the debugging port and the connected port to be
+# different, since an IDT board has two ports.  This would require
+# extending some of the tests in a fashion similar to that done for
+# VxWorks, because the test output would appear on the other port,
+# rather than being displayed by gdb.
+
+load_lib remote.exp
+load_lib gdb.exp
+set prompt "\\(gdb\\)"
+
+#
+# gdb_load -- load a file into the GDB. 
+#             Returns a 0 if there was an error,
+#                       1 if it load successfully.
+#
+proc gdb_load { arg } {
+    global verbose
+    global loadpath
+    global loadfile
+    global prompt
+    global GDB
+    global expect_out
+    global gdb_spawn_id
+
+    set loadfile [file tail $arg]
+    set loadpath [file dirname $arg]
+
+    send_gdb "file $arg\n"
+    expect {
+       -i $gdb_spawn_id -re "A program is being debugged already..*Kill it.*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+        -i $gdb_spawn_id -re "Load new symbol table.*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re "Reading symbols from.*done..*$prompt $" {}
+       -i $gdb_spawn_id -re "$prompt $" { perror "GDB couldn't read file" }
+       -i $gdb_spawn_id timeout { perror "(timeout) read symbol file" ; return -1 }
+    }
+
+    if [target_info exists gdb_protocol] {
+       set protocol [target_info gdb_protocol];
+    } else {
+       set protocol "sparclite"
+    }
+
+    if [target_info exists serial] {
+       set targetname [target_info serial];
+       send_gdb "target $protocol [target_info serial]\n";
+    } else {
+       if ![target_info exists netport] {
+           perror "Need either netport or gdb_serial entry for [target_info name].";
+           return -1;
+       }
+       set targetname [target_info netport];
+       send_gdb "target $protocol udp [target_info netport]\n";
+    }
+    set timeout 60
+    verbose "Timeout is now $timeout seconds" 2
+    expect {
+       -i $gdb_spawn_id -re "Remote target.*$prompt $" { }
+       -i $gdb_spawn_id -re ".*SPARClite appears to be alive.*$prompt $"       {
+           if $verbose>1 then {
+               send_user "Set target to $targetname\n"
+           }
+       }
+       -i $gdb_spawn_id timeout { 
+           perror "Couldn't set SLITE target."
+           set timeout 10
+           verbose "Timeout is now $timeout seconds" 2
+           return -1
+       }
+    }
+    
+    if [target_info exists gdb_load_offset] {
+       set offset "[target_info gdb_load_offset]";
+    } else {
+       set offset "";
+    }
+    if { 1 } {
+       send_gdb "load $arg $offset\n"
+       verbose "Loading $arg into $GDB" 2
+       set timeout 2400
+       verbose "Timeout is now $timeout seconds" 2
+       expect {
+           -i $gdb_spawn_id -re "Loading.*$prompt $" {
+               verbose "Loaded $arg into $GDB" 1
+               set timeout 30
+               verbose "Timeout is now $timeout seconds" 2
+           }
+           -i $gdb_spawn_id -re "$prompt $"     {
+               if $verbose>1 then {
+                   perror "GDB couldn't load."
+               }
+           }
+           -i $gdb_spawn_id timeout {
+               if $verbose>1 then {
+                   perror "Timed out trying to load $arg."
+               }
+           }
+       }
+    }
+    set timeout 10
+    verbose "Timeout is now $timeout seconds, doing monitor run" 2
+    send_gdb "monitor run\n";
+    sleep 2;
+    send_gdb "\ 3";
+    expect {
+       -i $gdb_spawn_id -re ".*$prompt $" { verbose "Run command succeded" }
+       -i $gdb_spawn_id default {
+           perror "error sending monitor run command";
+       }
+    }
+
+    if [target_info exists gdb_serial] {
+       send_gdb "target remote [target_info gdb_serial]\n"
+       set timeout 60
+       verbose "Timeout is now $timeout seconds" 2
+       expect {
+           -i $gdb_spawn_id -re ".*Kill it?.*y or n.*" {
+               send_gdb "y\n";
+               exp_continue
+           }
+           -i $gdb_spawn_id -re ".*$prompt $"  {
+               verbose "Set remote target to [target_info serial]" 2
+           }
+           -i $gdb_spawn_id timeout { 
+               perror "Couldn't set remote target."
+               set timeout 10
+               verbose "Timeout is now $timeout seconds" 2
+               return -1
+           }
+       }
+    }
+
+    if [info exists expect_out(buffer)] then {
+       send_log $expect_out(buffer)
+    }
+    return 0
+}
diff --git a/gdb/testsuite/config/sparclet-old.exp b/gdb/testsuite/config/sparclet-old.exp
new file mode 100644 (file)
index 0000000..ea97d19
--- /dev/null
@@ -0,0 +1,463 @@
+#   Copyright (C) 1996 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# DejaGnu@cygnus.com
+
+# This file was written by Michael Snyder <msnyder@cygnus.com>.
+
+# GDB support routines for a board using the sparclet remote debugging
+# protocol.
+
+load_lib remote.exp
+load_lib gdb.exp
+set prompt "\\(gdbslet\\)"
+
+
+#
+# Sparclet remote run command.
+#
+# This requires that we beep the user and ask him to push the board reset!
+# Then we will switch to the monitor target, run the program, use 2 ^C's
+# to interrupt the monitor target, and switch back to the remote target.
+# Then we have to do a continue to get past the stub breakpoint.
+#
+
+proc gdb_run_cmd {} {
+    global prompt
+    global gdb_spawn_id
+
+    set timeout 60
+    verbose "Timeout is now $timeout seconds, starting remote stub" 2
+    send_user "\aPlease reset the board now...\a\n"
+    sleep 1
+    send_user "\a\n"
+    sleep 1
+    send_user "\a\n"
+    sleep 1
+    send_user "\a\n"
+
+    # go back to monitor, run the program, interrupt it, and start remote.
+
+    if [target_info exists gdb_protocol] {
+       set protocol [target_info gdb_protocol];
+    } else {
+       set protocol "sparclet"
+    }
+    if [target_info exists serial] {
+       set targetname [target_info serial];
+       send_gdb "target $protocol [target_info serial]\n";
+    } else {
+       if ![target_info exists netport] {
+           perror "Need either netport or gdb_serial entry for [target_info name].";
+           return -1;
+       }
+       set targetname [target_info netport];
+       send_gdb "target $protocol udp [target_info netport]\n";
+    }
+
+    expect {
+       -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re "Remote target.*$prompt $" { }
+       -i $gdb_spawn_id -re ".*SPARCLET appears to be alive.*$prompt $" {
+           if $verbose>1 then {
+               send_user "Set target to $targetname\n"
+           }
+       }
+       -i $gdb_spawn_id timeout { 
+           set timeout 10
+           verbose "Timeout is now $timeout seconds" 2
+           perror "Couldn't set SPARCLET target."
+           return -1
+       }
+    }
+
+    send_gdb "disable\n";
+    expect {
+       -i $gdb_spawn_id -re ".*$prompt $" {
+           verbose "Breakpoints disabled" 2
+       }
+       -i $gdb_spawn_id timeout { 
+           perror "(timeout) disabling breakpoints";
+           return -1 
+       }
+       -i $gdb_spawn_id default {
+           perror "error disabling breakpoints";
+       }
+    }
+    send_gdb "run\n";
+    expect {
+       -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re "The program being debugged .*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re ".*Starting program:.*$" { 
+           verbose "Starting remote stub succeeded" 
+       }
+       -i $gdb_spawn_id timeout { 
+           perror "(timeout) starting the remote stub" ; 
+           return -1 
+       }
+       -i $gdb_spawn_id default {
+           perror "error starting the remote stub";
+       }
+    }
+    sleep 2;
+    send_gdb "\ 3"
+    sleep 1;
+    send_gdb "\ 3"
+    verbose "Sent ^C^C"
+    expect {
+       -i $gdb_spawn_id -re ".*Give up .and stop debugging it.*$" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re ".*$prompt $" { 
+           verbose "interrupting remote stub succeeded"
+       }
+       -i $gdb_spawn_id timeout { 
+           perror "(timeout) interrupting the remote stub";
+           return -1 
+       }
+       -i $gdb_spawn_id default {
+           perror "error interrupting the remote stub";
+       }
+    }
+
+    if [target_info exists gdb_serial] {
+       send_gdb "target remote [target_info gdb_serial]\n"
+       expect {
+           -i $gdb_spawn_id -re ".*Kill it?.*y or n.*" {
+               send_gdb "y\n";
+               exp_continue
+           }
+           -i $gdb_spawn_id -re ".*$prompt $"  {
+               verbose "connected to stub at [target_info gdb_serial]" 2
+           }
+           -i $gdb_spawn_id timeout { 
+               set timeout 10
+               verbose "Timeout is now $timeout seconds" 2
+               perror "Couldn't set remote target."
+               return -1
+           }
+       }
+    }
+
+    send_gdb "enable\n";
+    expect {
+       -i $gdb_spawn_id -re ".*$prompt $" {
+           verbose "Breakpoints enabled" 2
+       }
+       -i $gdb_spawn_id timeout { 
+           perror "(timeout) enabling breakpoints";
+           return -1 
+       }
+       -i $gdb_spawn_id default {
+           perror "error enabling breakpoints";
+       }
+    }
+    send_gdb "continue\n";
+    return
+}
+
+
+#
+# gdb_load -- load a file into the GDB. 
+#             Returns a 0 if there was an error,
+#                       1 if it load successfully.
+#
+proc gdb_load { arg } {
+    global verbose
+    global loadpath
+    global loadfile
+    global prompt
+    global GDB
+    global expect_out
+    global gdb_spawn_id
+
+    set loadfile [file tail $arg]
+    set loadpath [file dirname $arg]
+
+    if [target_info exists gdb_protocol] {
+       set protocol [target_info gdb_protocol];
+    } else {
+       set protocol "sparclet"
+    }
+
+    # get the stub-based loader for faster loading
+    send_gdb "file [target_info gdb_loader]\n"
+    expect {
+       -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+        -i $gdb_spawn_id -re "Load new symbol table.*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re "Reading symbols from.*done..*$prompt $" {}
+       -i $gdb_spawn_id -re "$prompt $" { perror "GDB couldn't find loader" }
+       -i $gdb_spawn_id timeout { 
+           perror "(timeout) read symbol file" ; 
+           return -1
+       }
+    }
+
+    if [target_info exists serial] {
+       set targetname [target_info serial];
+       send_gdb "target $protocol [target_info serial]\n";
+    } else {
+       if ![target_info exists netport] {
+           perror "Need either netport or gdb_serial entry for [target_info name].";
+           return -1;
+       }
+       set targetname [target_info netport];
+       send_gdb "target $protocol udp [target_info netport]\n";
+    }
+    expect {
+       -i $gdb_spawn_id -re "Remote target.*$prompt $" { }
+       -i $gdb_spawn_id -re ".*SPARCLET appears to be alive.*$prompt $" {
+           if $verbose>1 then {
+               send_user "Set target to $targetname\n"
+           }
+       }
+       -i $gdb_spawn_id timeout { 
+           set timeout 10
+           verbose "Timeout is now $timeout seconds" 2
+           perror "Couldn't set SPARCLET target."
+           return -1
+       }
+    }
+
+    send_gdb "run\n";
+    expect {
+       -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re "The program being debugged .*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re ".*Starting program:.*loader.*$" { 
+           verbose "Starting loader succeeded" 
+       }
+       -i $gdb_spawn_id timeout { 
+           perror "(timeout) starting the loader" ; 
+           return -1 
+       }
+       -i $gdb_spawn_id default {
+           perror "error starting the loader";
+       }
+    }
+    sleep 2;
+    send_gdb "\ 3"
+    sleep 1;
+    send_gdb "\ 3"
+    verbose "Sent ^C^C"
+    expect {
+       -i $gdb_spawn_id -re ".*Give up .and stop debugging it.*$" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re ".*$prompt $" { 
+           verbose "Running loader succeeded" 
+       }
+       -i $gdb_spawn_id timeout { 
+           perror "(timeout) interrupting the loader" ; 
+           return -1 
+       }
+       -i $gdb_spawn_id default {
+           perror "error interrupting the loader";
+       }
+    }
+
+    # Now ready to actually load the file:
+
+    send_gdb "file $arg\n"
+    expect {
+       -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+        -i $gdb_spawn_id -re "Load new symbol table.*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re "Reading symbols from.*done..*$prompt $" {}
+       -i $gdb_spawn_id -re "$prompt $" { perror "GDB couldn't read file" }
+       -i $gdb_spawn_id timeout { 
+           perror "(timeout) read symbol file" ; 
+           return -1 
+       }
+    }
+
+    if [target_info exists gdb_serial] {
+       send_gdb "target remote [target_info gdb_serial]\n"
+       expect {
+           -i $gdb_spawn_id -re ".*Kill it?.*y or n.*" {
+               send_gdb "y\n";
+               exp_continue
+           }
+           -i $gdb_spawn_id -re ".*$prompt $"  {
+               verbose "Set remote target to [target_info serial]" 2
+           }
+           -i $gdb_spawn_id timeout { 
+               set timeout 10
+               verbose "Timeout is now $timeout seconds" 2
+               perror "Couldn't set remote target."
+               return -1
+           }
+       }
+    }
+    if [target_info exists gdb_load_offset] {
+       set offset "[target_info gdb_load_offset]";
+    } else {
+       set offset "";
+    }
+    send_gdb "load $arg $offset\n"
+    verbose "Loading $arg into $GDB" 2
+    set timeout 1200
+    verbose "Timeout is now $timeout seconds" 2
+    expect {
+       -i $gdb_spawn_id -re "Loading.*$prompt $" {
+           verbose "Loaded $arg into $GDB" 1
+           set timeout 60
+           verbose "Timeout is now $timeout seconds" 2
+       }
+       -i $gdb_spawn_id -re "$prompt $"     {
+           if $verbose>1 then {
+               perror "GDB couldn't load."
+           }
+       }
+       -i $gdb_spawn_id timeout {
+           if $verbose>1 then {
+               perror "Timed out trying to load $arg."
+           }
+       }
+    }
+
+    send_user "\aPlease reset the board now...\a\n"
+    sleep 1
+    send_user "\a\n"
+    sleep 1
+    send_user "\a\n"
+    sleep 1
+    send_user "\a\n"
+
+    # go back to monitor, run the program, interrupt it, and start remote.
+
+    if [target_info exists serial] {
+       set targetname [target_info serial];
+       send_gdb "target $protocol [target_info serial]\n";
+    } else {
+       if ![target_info exists netport] {
+           perror "Need either netport or gdb_serial entry for [target_info name].";
+           return -1;
+       }
+       set targetname [target_info netport];
+       send_gdb "target $protocol udp [target_info netport]\n";
+    }
+
+    expect {
+       -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re "Remote target.*$prompt $" { }
+       -i $gdb_spawn_id -re ".*SPARCLET appears to be alive.*$prompt $" {
+           if $verbose>1 then {
+               send_user "Set target to $targetname\n"
+           }
+       }
+       -i $gdb_spawn_id timeout { 
+           set timeout 10
+           verbose "Timeout is now $timeout seconds" 2
+           perror "Couldn't set SPARCLET target."
+           return -1
+       }
+    }
+
+    send_gdb "run\n";
+    expect {
+       -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re "The program being debugged .*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re ".*Starting program:.*$" { 
+           verbose "Starting remote stub succeeded" 
+       }
+       -i $gdb_spawn_id timeout { 
+           perror "(timeout) starting the remote stub" ; 
+           return -1 
+       }
+       -i $gdb_spawn_id default {
+           perror "error starting the remote stub";
+       }
+    }
+    sleep 2;
+    send_gdb "\ 3"
+    sleep 1;
+    send_gdb "\ 3"
+    verbose "Sent ^C^C"
+    expect {
+       -i $gdb_spawn_id -re ".*Give up .and stop debugging it.*$" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re ".*$prompt $" { 
+           verbose "interrupting remote stub succeeded"
+       }
+       -i $gdb_spawn_id timeout { 
+           perror "(timeout) interrupting the remote stub";
+           return -1 
+       }
+       -i $gdb_spawn_id default {
+           perror "error interrupting the remote stub";
+       }
+    }
+
+    if [target_info exists gdb_serial] {
+       send_gdb "target remote [target_info gdb_serial]\n"
+       expect {
+           -i $gdb_spawn_id -re ".*Kill it?.*y or n.*" {
+               send_gdb "y\n";
+               exp_continue
+           }
+           -i $gdb_spawn_id -re ".*$prompt $"  {
+               verbose "connected to stub at [target_info gdb_serial]" 2
+           }
+           -i $gdb_spawn_id timeout { 
+               set timeout 10
+               verbose "Timeout is now $timeout seconds" 2
+               perror "Couldn't set remote target."
+               return -1
+           }
+       }
+    }
+    return 0
+}
diff --git a/gdb/testsuite/config/sparclet.exp b/gdb/testsuite/config/sparclet.exp
new file mode 100644 (file)
index 0000000..c97f5fc
--- /dev/null
@@ -0,0 +1,332 @@
+#   Copyright (C) 1996 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# DejaGnu@cygnus.com
+
+# This file was written by Michael Snyder <msnyder@cygnus.com>.
+
+# GDB support routines for a board using the sparclet remote debugging
+# protocol.
+
+load_lib remote.exp
+load_lib gdb.exp
+set prompt "\\(gdbslet\\)"
+
+
+#
+# Sparclet remote run command.
+#
+# This requires that we beep the user and ask him to push the board reset!
+# Then we will switch to the monitor target, run the program, use 2 ^C's
+# to interrupt the monitor target, and switch back to the remote target.
+# Then we have to do a continue to get past the stub breakpoint.
+#
+
+proc gdb_start { } {
+    global gdb_spawn_id;
+    global prompt
+    global GDB
+
+    if { [default_gdb_start] != 0 } {
+       return -1;
+    }
+
+    if [target_info exists baud] {
+       send_gdb "set remotebaud [target_info baud]\n"
+       expect {
+           -i $gdb_spawn_id -re ".*$prompt" { }
+           -i $gdb_spawn_id default { 
+               perror "Error setting baud rate."
+               return -1;
+           }
+       }
+    }
+
+    for {set x 1;} { $x < 4 } {incr x} {
+       if { [gdb_sparclet_startup] > 0 } {
+           break;
+       }
+       reboot_target;
+    }
+    return 1;
+}
+
+proc gdb_sparclet_startup { } {
+    global gdb_spawn_id;
+    global prompt
+    global GDB
+
+    set timeout 5;
+    set is_running_stub 0;
+
+    send_gdb "target sparclet [target_info serial]\n";
+    expect {
+       -i $gdb_spawn_id -re ".*already.*y or n." {
+           gdb_send "y\n";
+           exp_continue;
+       }
+       -i $gdb_spawn_id -re "Remote target.*connected to.*$prompt" { }
+       -i $gdb_spawn_id timeout {
+           verbose "timed out, checking if stub is already running"
+           set timeout 10
+           send_gdb "\003";
+           expect {
+               -i $gdb_spawn_id -re ".*$prompt" {
+               }
+               -i $gdb_spawn_id default {
+                   perror "sparclet board isn't responding";
+                   return -1;
+               }
+           }
+           send_gdb "target remote [target_info gdb_serial]\n";
+           expect {
+               -i $gdb_spawn_id -re ".*Remote debugging.*$prompt" {
+                   verbose "stub is already running"
+                   set is_running_stub 1;
+               }
+               -i $gdb_spawn_id default {
+                   perror "sparclet board isn't responding";
+                   return -1;
+               }
+           }
+       }
+    }
+
+    if { $is_running_stub == 0 } {
+       global srcdir
+
+       if ![file exists loader] {
+           set result [target_compile "${srcdir}/config/sparclet-loader.c" "loader" executable "libs=-Wl,-Ttext,[target_info gdb_stub_offset]"];
+       }
+       set loader "loader";
+       send_gdb "file $loader\n";
+       expect {
+           -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
+               send_gdb "y\n"
+               exp_continue
+           }
+           -i $gdb_spawn_id -re "Load new symbol table.*y or n. $" {
+               send_gdb "y\n"
+               exp_continue
+           }
+           -i $gdb_spawn_id -re "Reading symbols from.*done..*$prompt $" {}
+           -i $gdb_spawn_id -re "$prompt $" { perror "GDB couldn't find loader" }
+           -i $gdb_spawn_id timeout { 
+               perror "(timeout) read symbol file" ; 
+               return -1
+           }
+       }
+
+       send_gdb "target [target_info gdb_protocol] [target_info serial]\n";
+       expect {
+           -i $gdb_spawn_id -re "Remote target.*connected to.*$prompt" { }
+           -i $gdb_spawn_id default {
+               perror "Error reconnecting to sparclet.";
+               return -1;
+           }
+       }
+
+       send_gdb "load $loader [target_info gdb_stub_offset]\n"
+       verbose "Loading $loader into $GDB" 2
+       set timeout 1200
+       verbose "Timeout is now $timeout seconds" 2
+       expect {
+           -i $gdb_spawn_id -re "Loading.*$prompt $" {
+               verbose "Loaded $loader into $GDB" 1
+               set timeout 60
+               verbose "Timeout is now $timeout seconds" 2
+           }
+           -i $gdb_spawn_id -re "$prompt $"     {
+               if $verbose>1 then {
+                   perror "GDB couldn't load."
+               }
+           }
+           -i $gdb_spawn_id timeout {
+               if $verbose>1 then {
+                   perror "Timed out trying to load $arg."
+               }
+           }
+       }
+
+       send_gdb "run\n";
+       expect {
+           -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
+               send_gdb "y\n"
+               exp_continue
+           }
+           -i $gdb_spawn_id -re "The program being debugged .*y or n. $" {
+               send_gdb "y\n"
+               exp_continue
+           }
+           -i $gdb_spawn_id -re ".*Starting program:.*loader.*$" { 
+               verbose "Starting loader succeeded" 
+           }
+           -i $gdb_spawn_id timeout { 
+               perror "(timeout) starting the loader" ; 
+               return -1 
+           }
+           -i $gdb_spawn_id default {
+               perror "error starting the loader";
+           }
+       }
+       sleep 2;
+       send_gdb "\ 3"
+       sleep 1;
+       send_gdb "\ 3"
+       verbose "Sent ^C^C"
+       expect {
+           -i $gdb_spawn_id -re ".*Give up .and stop debugging it.*$" {
+               send_gdb "y\n"
+               exp_continue
+           }
+           -i $gdb_spawn_id -re ".*$prompt $" { 
+               verbose "Running loader succeeded" 
+           }
+           -i $gdb_spawn_id timeout { 
+               perror "(timeout) interrupting the loader" ;
+               return -1 
+           }
+           -i $gdb_spawn_id default {
+               perror "error interrupting the loader";
+           }
+       }
+
+       gdb_exit;
+       return [gdb_start];
+    }
+    return 1;
+}
+
+proc gdb_run_cmd { args } {
+    global gdb_spawn_id
+    global prompt
+
+    gdb_breakpoint exit;
+    send_gdb "set \$fp=0\n";
+    expect {
+       -i $gdb_spawn_id -re ".*$prompt" { }
+    }
+    send_gdb "jump start\n";
+    expect {
+       -i $gdb_spawn_id -re ".*y or n. $" {
+           send_gdb "y\n"
+       }
+       -i $gdb_spawn_id -re "Continuing at.*\[\r\n\]" { }
+       -i $gdb_spawn_id default {
+           return "failed"
+       }
+    }
+    return "";
+}
+
+
+#
+# gdb_load -- load a file into the GDB. 
+#             Returns a 0 if there was an error,
+#                       1 if it load successfully.
+#
+proc gdb_load { arg } {
+    global verbose
+    global loadpath
+    global loadfile
+    global prompt
+    global GDB
+    global expect_out
+    global gdb_spawn_id
+
+    set loadfile [file tail $arg]
+    set loadpath [file dirname $arg]
+
+    if [target_info exists gdb_protocol] {
+       set protocol [target_info gdb_protocol];
+    } else {
+       set protocol "sparclet"
+    }
+
+    send_gdb "file $arg\n"
+    expect {
+       -i $gdb_spawn_id -re "A program is being debug.*Kill it.*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+        -i $gdb_spawn_id -re "Load new symbol table.*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -i $gdb_spawn_id -re "Reading symbols from.*done..*$prompt $" {}
+       -i $gdb_spawn_id -re "$prompt $" { perror "GDB couldn't read file" }
+       -i $gdb_spawn_id timeout { 
+           perror "(timeout) read symbol file" ; 
+           return -1 
+       }
+    }
+
+    if [target_info exists gdb_serial] {
+       send_gdb "target remote [target_info gdb_serial]\n"
+       expect {
+           -i $gdb_spawn_id -re ".*Kill it?.*y or n.*" {
+               send_gdb "y\n";
+               exp_continue
+           }
+           -i $gdb_spawn_id -re ".*$prompt $"  {
+               verbose "Set remote target to [target_info serial]" 2
+           }
+           -i $gdb_spawn_id timeout { 
+               set timeout 10
+               verbose "Timeout is now $timeout seconds" 2
+               perror "Couldn't set remote target."
+               return -1
+           }
+       }
+    }
+    if [target_info exists gdb_load_offset] {
+       set offset "[target_info gdb_load_offset]";
+    } else {
+       set offset "";
+    }
+    send_gdb "load $arg $offset\n"
+    verbose "Loading $arg into $GDB" 2
+    set timeout 1200
+    verbose "Timeout is now $timeout seconds" 2
+    expect {
+       -i $gdb_spawn_id -re "Loading.*$prompt $" {
+           verbose "Loaded $arg into $GDB" 1
+           set timeout 60
+           verbose "Timeout is now $timeout seconds" 2
+       }
+       -i $gdb_spawn_id -re "$prompt $"     {
+           if $verbose>1 then {
+               perror "GDB couldn't load."
+           }
+       }
+       -i $gdb_spawn_id timeout {
+           if $verbose>1 then {
+               perror "Timed out trying to load $arg."
+           }
+       }
+    }
+    send_gdb "list main\n";
+    expect {
+       -i $gdb_spawn_id -re ".*$prompt" { }
+       -i $gdb_spawn_id default {
+           perror "command for list main never completed";
+           return -1;
+       }
+    }
+
+    return 0
+}
similarity index 86%
rename from gdb/testsuite/config/udi-gdb.exp
rename to gdb/testsuite/config/udi.exp
index 9a369fde4cee40cff72589807eefa51f07f0ac82..1d497224ee593e556034a5f659e73aafa7b7128b 100644 (file)
 
 # This file was written by Rob Savoye. (rob@cygnus.com)
 
-#
-# NOTE: these test assume that there is a udi_soc file in th
-#
-
 load_lib gdb.exp
-load_lib udi.exp
-
-#
-# gdb_version -- extract and print the version number of gdb
-#
-proc gdb_version {} {
-    default_gdb_version
-}
 
 #
 # gdb_target_udi
 # Set gdb to the desired UDI target
 #
 proc gdb_target_udi { } {
-    global targetname
     global prompt
     global verbose
     global exit_status
 
+    set targetname [target_info remote_host];
     # set targets hostname
     send "target udi $targetname\n"
     set timeout 60
@@ -79,6 +67,7 @@ proc gdb_target_udi { } {
 # gdb_load -- load a file into the debugger.
 #             return a -1 if anything goes wrong.
 #
+
 proc gdb_load { arg } {
     global verbose
     global loadpath
@@ -86,7 +75,9 @@ proc gdb_load { arg } {
     global GDB
     global prompt
 
-    if [gdb_file_cmd $arg] then { return -1 }
+    if [gdb_file_cmd $arg] {
+       return -1 
+    }
 
     gdb_target_udi
 }
@@ -117,12 +108,3 @@ proc gdb_exit { } {
     }
     close $in
 }
-
-gdb_start
-
-# make sure gdb has actually started, otherwise if the first test
-# timesout, DejaGnu crashes
-send "\n"
-expect {
-    -re "$prompt"
-    }
similarity index 58%
rename from gdb/testsuite/config/unix-gdb.exp
rename to gdb/testsuite/config/unix.exp
index c53a28ff18dbbf7089c3216e0161586d063c3cb8..8d0530f0df57f4737fb1b74f44861ef796e63656 100644 (file)
@@ -27,57 +27,3 @@ set timeout 60
 verbose "Timeout is now $timeout seconds" 2
 
 load_lib gdb.exp
-
-# variables that need to set up
-#
-if ![info exists prompt] then {
-    set prompt "\[(\]gdb\[)\]"
-}
-# some convenience abbreviations
-#
-if ![info exists hex] then {
-    set hex "0x\[0-9A-Fa-f\]+"
-}
-if ![info exists decimal] then {
-    set decimal "\[0-9\]+"
-}
-
-#
-# gdb_version -- extract and print the version number of gcc
-#
-proc gdb_version {} {
-    default_gdb_version
-}
-
-#
-# gdb_unload -- unload a file if one is loaded
-#
-
-#
-# gdb_load -- load a file into the debugger.
-#             return a -1 if anything goes wrong.
-#
-proc gdb_load { arg } {
-    global verbose
-    global loadpath
-    global loadfile
-    global GDB
-    global prompt
-    upvar timeout timeout
-
-    return [gdb_file_cmd $arg]
-}
-
-proc gdb_start { } {
-    default_gdb_start
-}
-  
-proc gdb_exit { } {
-    catch default_gdb_exit
-}
-
-set binpath /s1/users/rob/vxworks/bin/somewhere-bogus-that-needs-configuring
-global GDB
-set bin $GDB
-
-gdb_start
similarity index 87%
rename from gdb/testsuite/config/vx-gdb.exp
rename to gdb/testsuite/config/vx.exp
index 6a6ea6bfd15dfc0e9132d02b913ad0b32d782cf1..c2b2632b1e785a880509b7235f4ca4bab4ab1c91 100644 (file)
@@ -43,13 +43,9 @@ proc gdb_version {} {
 # take precedence. Returns -1 on error, else 0.
 #
 proc gdb_load { arg } {
-    global shell_id
-
-#    gdb_exit
-#    spawn_vxgdb
     set result 0
 
-    if { [vxworks_ld $shell_id $arg] != 0 } {
+    if { [vxworks_ld target $arg] != 0 } {
        perror "Couldn't load $arg"
        return -1
     }
@@ -58,20 +54,18 @@ proc gdb_load { arg } {
 }
 
 #
-# gdb_start -- start gdb running and 
+# gdb_start -- start gdb running
 #
 proc gdb_start { } {
     global prompt
     global verbose
-    global targetname
     global connectmode
     global reboot
-    global shell_id
 
     # get a connection to the board
-    set shell_id [ eval $connectmode "$targetname" ]
+    set shell_id [remote_open target]
     if { $shell_id < 0 } then {
-       perror "Couldn't connect to $targetname."
+       perror "Couldn't connect to target."
        return -1
     }
     verbose "Spawn id for remote shell is $shell_id"
@@ -108,7 +102,6 @@ proc gdb_start { } {
 proc spawn_vxgdb { } {
     global prompt
     global verbose
-    global targetname
 
     default_gdb_start
 
@@ -119,15 +112,15 @@ proc spawn_vxgdb { } {
 
     verbose "Setting up target, Please wait..."
     # set targets hostname
-    send "target vxworks $targetname\n"
+    send "target vxworks [target_info netport]\n"
     set timeout 60
     verbose "Timeout is now $timeout seconds" 2
     expect {
        -re "Done\..*$prompt $" {
-           verbose "Set target to $targetname" 1
+           verbose "Set target to [target_info netport]" 1
        }
        -re "net_connect: RPC: Program not registered.*$" {
-           perror "Couldn't set GDB to target $targetname."
+           perror "Couldn't set GDB to target [target_info netport]."
            exit 1
        }
        timeout { 
@@ -142,10 +135,7 @@ proc spawn_vxgdb { } {
 }
 
 proc gdb_exit { } {
-    global shell_id
-    if [info exists shell_id] then {
-       exit_remote_shell $shell_id
-    }
+    remote_close target;
     catch default_gdb_exit
 }
 
@@ -159,5 +149,3 @@ proc gdb_exit { } {
 #    "Undefined command"          { perror "send string probably wrong." }
 #}
 
-gdb_start
-
index 8bde035f2baa0a7c483c963da6b146f7c926d846..37a42671bbca8460d8f4868d8c3e289af494453e 100644 (file)
 # This file was written by Rob Savoye. (rob@cygnus.com)
 
 if $tracelevel then {
-       strace $tracelevel
-       }
+    strace $tracelevel
+}
 
 set prms_id 0
 set bug_id 0
 
 # are we on a target board
-if ![isnative] then {
+if [is_remote target] {
     return
 }
+
 if [istarget "m68k*-*-hpux*"] then {
     # The top-level makefile passes CFLAGS= (no -g) for hp300.  This probably
     # should be fixed (it is only needed for gcc bootstrapping, not gdb),
@@ -160,7 +161,7 @@ proc do_steps_and_nexts {} {
     }
 }
 
-proc test_with_self {} {
+proc test_with_self { executable } {
     global prompt
     global tool
     global det_file
@@ -180,7 +181,7 @@ proc test_with_self {} {
     set oldtimeout $timeout
     set timeout 600
     verbose "Timeout is now $timeout seconds" 2
-    if {[gdb_load "./x$tool"] <0} then {
+    if {[gdb_load $executable] <0} then {
        set timeout $oldtimeout
        verbose "Timeout is now $timeout seconds" 2
        return -1
@@ -189,27 +190,14 @@ proc test_with_self {} {
     verbose "Timeout is now $timeout seconds" 2
 
     # disassemble yourself
-    send "x/10i main\n"
-    expect {
-       -re "x/10i.*main.*main.$decimal.*main.$decimal.*$prompt $"\
-           { pass "Disassemble main" }
-       -re ".*$prompt $"       { fail "Disassemble main" }
-       timeout         { fail "(timeout) Disassemble main" }
-    }
+    gdb_test "x/10i main" \
+           "x/10i.*main.*main.$decimal.*main.$decimal.*" \
+           "Disassemble main"
 
-    set description "set breakpoint at main"
-    send "break main\n"
-    expect {
-       -re "Breakpoint.*at.* file.*, line.*$prompt $" {
-           pass "$description"
-       }
-       -re ".*$prompt $" {
-           fail "$description"
-       }
-       timeout {
-           fail "$description (timeout)"
-       }
-    }
+    # Set a breakpoint at main
+    gdb_test "break main" \
+           "Breakpoint.*at.* file.*, line.*" \
+           "breakpoint in main"
 
     # We'll need this when we send a ^C to GDB.  Need to do it before we
     # run the program and gdb starts saving and restoring tty states.
@@ -223,7 +211,7 @@ proc test_with_self {} {
     # FIXME: If we put this after the run to main, the first list
     # command doesn't print the same line as the current line where
     # gdb is stopped.
-    send "set listsize 1\n" ; expect -re "$prompt $"
+    gdb_test "set listsize 1" "" "set listsize to 1"
 
     # run yourself
     # It may take a very long time for the inferior gdb to start (lynx),
@@ -274,19 +262,7 @@ proc test_with_self {} {
 
     do_steps_and_nexts
 
-    set description "print a string"
-    send "print \"foo\"\n"
-    expect {
-       -re ".\[0-9\]+ = \"foo\".*$prompt $" {
-           pass "$description"
-       }
-       -re ".*$prompt $" {
-           fail "$description"
-       }
-       timeout {
-           fail "$description (timeout)"
-       }
-    }
+    gdb_test "print \"foo\"" ".\[0-9\]+ = \"foo\"" "print a string"
 
     # do_steps_and_nexts left us ready to execute an xmalloc call,
     # so give that a try.
@@ -432,26 +408,20 @@ proc find_gdb { arg } {
 }
 
 # Run the test with self.
-# Copy the file executable file in case this OS doesn't like to edit it's own
+# Copy the file executable file in case this OS doesn't like to edit its own
 # text space.
 
 set GDB_FULLPATH [find_gdb $GDB]
 
 # Remove any old copy lying around.
-catch "exec rm -f ./x$tool"
-
-if ![file executable $GDB_FULLPATH] then {
-    fail "couldn't convert $GDB to absolute pathname to make local copy"
-} else {
-    if [catch "exec cp $GDB_FULLPATH ./x$tool"] then {
-       fail "couldn't copy $GDB_FULLPATH to current directory"
-    } else {
-       verbose "\t\tCopied $GDB_FULLPATH to ./x$tool"
-       if {[test_with_self] <0} then {
-           warning "Couldn't test self"
-           catch "exec rm -f ./x$tool"
-           return -1
-       }
-       catch "exec rm -f ./x$tool"
-    }
+remote_file build delete x$tool
+
+gdb_start
+set file [remote_download build $GDB_FULLPATH x$tool]
+set result [test_with_self $file];
+remote_file build delete $file;
+
+if {$result <0} then {
+    warning "Couldn't test self"
+    return -1
 }
index 88392b9c6d3e4e75eecbfc7565aea8b8c49fef96..89f2c7d9f6e1c4b5bf34f631e2746f684d15ca7f 100644 (file)
 
 # These tests don't work for targets can't take arguments...
 
-if $noargs then {
-       verbose "Skipping a2-run.exp because of noargs."
-       return
-       }
+if [target_info exists gdb,noargs] then {
+    verbose "Skipping a2-run.exp because of noargs."
+    return
+}
+
+if [target_info exists gdb,noinferiorio] {
+    verbose "Skipping a2-run.exp because of noinferiorio."
+    return
+}
 
 if $tracelevel then {
-       strace $tracelevel
-       }
+    strace $tracelevel
+}
 
 #
 # test running programs
@@ -37,9 +42,9 @@ set prms_id 0
 set bug_id 0
 
 set testfile "run"
-set srcfile ${srcdir}/$subdir/${testfile}.c
+set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
-if  { [compile "${srcfile} -g -o ${binfile}"] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     perror "Couldn't compile ${srcfile}"
     return -1
 }
@@ -51,102 +56,109 @@ gdb_load ${binfile}
 
 # Run with no arguments.
 # On VxWorks this justs make sure the program was run.
-send "run\n"
-expect -re "run\[\r\n\]+" {}
+gdb_run_cmd
+
 if [istarget "*-*-vxworks*"] then {
     set timeout 120
+    verbose "Timeout is now $timeout seconds" 2
     expect {
-       -i $shell_id "Program exited normally" {
-           unresolved "run \"$binfile\" with no args"
+       -i $gdb_spawn_id "Program exited normally" {
+           unresolved "run \"$testfile\" with no args"
        }
-       -i $shell_id -re "usage:  factorial <number>" {
-           pass "run \"$binfile\" with no args"
+       -i $gdb_spawn_id -re "usage:  factorial <number>" {
+           pass "run \"$testfile\" with no args"
        }
        timeout {
-           fail "(timeout) run \"$binfile\" with no args"
+           fail "(timeout) run \"$testfile\" with no args"
        }
     }
     set timeout 10
+    verbose "Timeout is now $timeout seconds" 2
     expect -re "$prompt $" {}
 } else {
     expect {
-       -re "Starting program.*usage:  factorial <number>.*Program exited with code 01.*$prompt $" {
-           pass "run \"$binfile\" with no args"
+       -re ".*usage:  factorial <number>.*Program exited with code 01.*$prompt $" {
+           pass "run \"$testfile\" with no args"
        }
        -re ".*$prompt $" {
-           fail "run \"$binfile\" with no args"
+           fail "run \"$testfile\" with no args"
+           verbose "expect_out is $expect_out(buffer)" 2
        }
        timeout {
-           fail "(timeout) run \"$binfile\" no args"
+           fail "(timeout) run \"$testfile\" no args"
        }
     }
 }
-
 # Now run with some arguments
 if [istarget "*-*-vxworks*"] then {
-    send "run vxmain \"5\"\n"
+    send_gdb "run vxmain \"5\"\n"
     expect -re "run vxmain \"5\"\r\n" {}
     set timeout 120
+    verbose "Timeout is now $timeout seconds" 2
     expect {
        -i $shell_id "Program exited normally" {
-           unresolved "run \"$binfile\" with arg"
+           unresolved "run \"$testfile\" with arg"
        }
        -i $shell_id "120" {
-           pass "run \"$binfile\" with arg"
+           pass "run \"$testfile\" with arg"
        }
        timeout {
-           fail "(timeout) run \"$binfile\" with arg"
+           fail "(timeout) run \"$testfile\" with arg"
        }
     }
     set timeout 10
+    verbose "Timeout is now $timeout seconds" 2
     expect -re "$prompt $" {}
 } else {
        setup_xfail "mips-idt-*"
-       send "run 5\n"
+       gdb_run_cmd 5
        expect {
-           -re "Starting program.*$binfile.*120.*$prompt $"\
-                               { pass "run \"$binfile\" with arg" }
-           -re ".*$prompt $"   { fail "run \"$binfile\" with arg" }
-           timeout             { fail "(timeout) run \"$binfile\" with arg" }
+           -re ".*120.*$prompt $"\
+                               { pass "run \"$testfile\" with arg" }
+           -re ".*$prompt $"   { fail "run \"$testfile\" with arg" }
+           timeout             { fail "(timeout) run \"$testfile\" with arg" }
        }
 }
 
 # Run again with same arguments.
 setup_xfail "mips-idt-*"
-send "run\n"
-expect -re "run\[\r\n\]+" {}
+gdb_run_cmd
+
 if [istarget "*-*-vxworks*"] then {
     set timeout 120
+    verbose "Timeout is now $timeout seconds" 2
     expect {
        -i $shell_id "Program exited normally" {
-           unresolved "run \"$binfile\" again with same args"
+           unresolved "run \"$testfile\" again with same args"
        }
-       -i $shell_id "120" { pass "run \"$binfile\" again with same args" }
-       timeout { fail "(timeout) run \"$binfile\" again with same args" }
+       -i $shell_id "120" { pass "run \"$testfile\" again with same args" }
+       timeout { fail "(timeout) run \"$testfile\" again with same args" }
     }
     set timeout 10
+    verbose "Timeout is now $timeout seconds" 2
     expect -re "$prompt $" {}
 } else {
     expect {
-           -re "Starting program.*120.*$prompt $"\
-                               { pass "run \"$binfile\" again with same args" }
-           -re ".*$prompt $"   { fail "run \"$binfile\" again with same args" }
-           timeout             { fail "(timeout) run \"$binfile\" again with same args" }
+           -re ".*120.*$prompt $"\
+                               { pass "run \"$testfile\" again with same args" }
+           -re ".*$prompt $"   { fail "run \"$testfile\" again with same args" }
+           timeout             { fail "(timeout) run \"$testfile\" again with same args" }
        }
 }
 
 # Use "set args" command to specify no arguments as default and run again.
 if [istarget "*-*-vxworks*"] then {
-    send "set args main\n"
+    send_gdb "set args main\n"
 } else {
-    send "set args\n"
+    send_gdb "set args\n"
 }
 expect -re "$prompt $"
 
-send "run\n"
-expect -re "run\[\r\n\]+" {}
+gdb_run_cmd
+
 if [istarget "*-*-vxworks*"] then {
     set timeout 120
+    verbose "Timeout is now $timeout seconds" 2
     expect {
        -i $shell_id "Program exited normally" {
            unresolved "run after setting args to nil"
@@ -159,10 +171,11 @@ if [istarget "*-*-vxworks*"] then {
        }
     }
     set timeout 10
+    verbose "Timeout is now $timeout seconds" 2
     expect -re "$prompt $" {}
 } else {
     expect {
-       -re "Starting program.*usage:  factorial <number>.*$prompt $" {
+       -re ".*usage:  factorial <number>.*$prompt $" {
            pass "run after setting args to nil"
        }
        -re ".*$prompt $" {
@@ -177,38 +190,40 @@ if [istarget "*-*-vxworks*"] then {
 # Use "set args" command to specify an argument and run again.
 setup_xfail "mips-idt-*"
 if [istarget "*-*-vxworks*"] then {
-   send "set args vxmain \"6\"\n"
+   send_gdb "set args vxmain \"6\"\n"
 } else {
-       send "set args 6\n"
+       send_gdb "set args 6\n"
 }
 expect -re "$prompt $"
-send "run\n"
-expect -re "run\[\r\n\]+" {}
+gdb_run_cmd
+
 if [istarget "*-*-vxworks*"] then {
     set timeout 120
+    verbose "Timeout is now $timeout seconds" 2
     expect {
        -i $shell_id "Program exited normally" {
-           unresolved "run \"$binfile\" again after setting args"
+           unresolved "run \"$testfile\" again after setting args"
        }
        -i $shell_id "720" {
-           pass "run \"$binfile\" again after setting args"
+           pass "run \"$testfile\" again after setting args"
        }
        timeout {
-           fail "(timeout) run \"$binfile\" again after setting args"
+           fail "(timeout) run \"$testfile\" again after setting args"
        }
     }
     set timeout 10
+    verbose "Timeout is now $timeout seconds" 2
     expect -re "$prompt $" {}
 } else {
     expect {
-           -re "Starting program.*720.*$prompt $" {
-               pass "run \"$binfile\" again after setting args"
+           -re ".*720.*$prompt $" {
+               pass "run \"$testfile\" again after setting args"
            }
            -re ".*$prompt $" {
-               fail "run \"$binfile\" again after setting args"
+               fail "run \"$testfile\" again after setting args"
            }
            timeout {
-               fail "(timeout) run \"$binfile\" again after setting args"
+               fail "(timeout) run \"$testfile\" again after setting args"
            }
        }
 }
@@ -216,23 +231,22 @@ if [istarget "*-*-vxworks*"] then {
 # GOAL: Test that shell is being used with "run".  For remote debugging
 # targets, there is no guarantee that a "shell" (whatever that is) is used.
 if [isnative] then {
-    send "run `echo 8`\n"
+    send_gdb "run `echo 8`\n"
     expect {
        -re "Starting program.*40320.*$prompt $" {
-           pass "run \"$binfile\" with shell"
+           pass "run \"$testfile\" with shell"
        }
        -re ".*$prompt $" {
-           fail "run \"$binfile\" with shell"
+           fail "run \"$testfile\" with shell"
        }
        timeout {
-           fail "(timeout) run \"$binfile\" with shell"
+           fail "(timeout) run \"$testfile\" with shell"
        }
     }
 }
 
 # Reset the default arguments for VxWorks
 if [istarget "*-*-vxworks*"] then {
-    send "set args main\n"
+    send_gdb "set args main\n"
     expect -re ".*$prompt $" {}
 }
-
index a5ed12d286aa2680a00149ab66a7c1fa9734fcbe..158c6683fba71a25afa7346a6020f4e053b6e94a 100644 (file)
@@ -27,9 +27,9 @@ set prms_id 0
 set bug_id 0
 
 set testfile "bitfields"
-set srcfile ${srcdir}/$subdir/${testfile}.c
+set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
-if  { [compile "${srcfile} -g -o ${binfile}"] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     perror "Couldn't compile ${srcfile}"
     return -1
 }
@@ -55,7 +55,7 @@ proc bitfield_uniqueness {} {
        -re "Break.*break1 \\(\\) at .*$srcfile:$decimal.*$prompt $" {
            pass "running to break1"
        }
-       timeout { fail "running to break1"; return }
+       timeout { fail "(timeout) running to break1"; return }
     }
        
     if [gdb_test "print flags" ".*uc = 1 .*, s1 = 0, u1 = 0, s2 = 0, u2 = 0, s3 = 0, u3 = 0, s9 = 0, u9 = 0, sc = 0.*"] {
@@ -145,7 +145,7 @@ proc bitfield_containment {} {
        -re "Break.*break2 \\(\\) at .*$srcfile:$decimal.*$prompt $" {
            pass "running to break2"
        }
-       timeout { fail "running to break2"; return }
+       timeout { fail "(timeout) running to break2"; return }
     }
 
     if [gdb_test "print/x flags" "= {uc = 0xff, s1 = 0x0, u1 = 0x1, s2 = 0x0, u2 = 0x3, s3 = 0x0, u3 = 0x7, s9 = 0x0, u9 = 0x1ff, sc = 0x0}" "bitfield containment #1"] {
@@ -185,7 +185,7 @@ proc bitfield_unsignedness {} {
        -re "Break.*break3 \\(\\) at .*$srcfile:$decimal.*$prompt $" {
            pass "running to break3"
        }
-       timeout { fail "running to break3"; return }
+       timeout { fail "(timeout) running to break3"; return }
     }
 
     if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 1, s2 = 0, u2 = 3, s3 = 0, u3 = 7, s9 = 0, u9 = 511, sc = 0.*" "unsigned bitfield ranges"] {
@@ -217,7 +217,7 @@ proc bitfield_signedness {} {
        -re "Break.*break4 \\(\\) at .*$srcfile:$decimal.*$prompt $" {
            pass "running to break4"
        }
-       timeout { fail "running to break4"; return }
+       timeout { fail "(timeout) running to break4"; return }
     }
 
     if [gdb_test "print flags" "= {uc = 0 .*, s1 = 0, u1 = 0, s2 = 1, u2 = 0, s3 = 3, u3 = 0, s9 = 255, u9 = 0, sc = 0 .*}" "signed bitfields, max positive values"] {
@@ -230,7 +230,7 @@ proc bitfield_signedness {} {
 
     # Determine if the target has signed bitfields so we can xfail the
     # the signed bitfield tests if it doesn't.
-    send "print i\n"
+    send_gdb "print i\n"
     expect {
        -re ".* = -256.*$prompt $" {
            pass "determining signed-ness of bitfields"
@@ -259,14 +259,11 @@ proc bitfield_signedness {} {
     }
 }
 
-# Start with a fresh gdb.
-
-gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
 
-send "set print sevenbit-strings\n" ; expect -re "$prompt $"
+send_gdb "set print sevenbit-strings\n" ; expect -re "$prompt $"
 bitfield_uniqueness
 if [istarget "mips-idt-*"] then {
     # Restart because IDT/SIM runs out of file descriptors.
index 68fb51c925aebedb6f63421da76affe3a77f3372..2c6b11f10eba2371524f83b77e93f0074628bc04 100644 (file)
 # This file was written by Rob Savoye. (rob@cygnus.com)
 
 if $tracelevel then {
-       strace $tracelevel
-       }
+    strace $tracelevel
+}
 
-global usestubs
 
 #
 # test running programs
@@ -32,9 +31,9 @@ set prms_id 0
 set bug_id 0
 
 set testfile "break"
-set srcfile ${srcdir}/${subdir}/${testfile}.c
+set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
-if  { [compile "${srcfile} -g -o ${binfile}"] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
     perror "Couldn't compile ${srcfile}"
     return -1
 }
@@ -44,13 +43,8 @@ gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
 
-if $usestubs {
-    send "step\n"
-    # if use stubs step out of the breakpoint() function.
-    expect {
-        -re "main.* at .*$prompt $" {}
-        timeout { fail "single step at breakpoint() (timeout)" ; return 0 }
-    }
+if [target_info exists gdb_stub] {
+    gdb_test "step" "(main.* at .*|.*in .*start.*)" "step for stub"
 }
 #
 # test simple breakpoint setting commands
@@ -62,20 +56,20 @@ if $usestubs {
 # Note that gdb-init.exp provides a "delete_breakpoints" proc
 # for general use elsewhere.
 
-send "delete breakpoints\n"
+send_gdb "delete breakpoints\n"
 expect {
-    -re "Delete all breakpoints.*y or n. $"\
-       { send "y\n"
+    -i $gdb_spawn_id -re "Delete all breakpoints.*$" {
+           send_gdb "y\n"
            expect {
-               -re ".*$prompt $" {
-                   setup_xfail "i*86-*-sysv4*" "sparc-sun-sunos4*" "alpha-dec-osf2*"
-                   fail "Delete all breakpoints when none"
+               -re "$prompt $" {
+                   setup_xfail "i*86-*-sysv4*" "sparc-sun-sunos4*" "alpha-dec-osf*" "mips-dec-ultrix*"
+                   fail "Delete all breakpoints when none (unexpected prompt)"
                }
-               timeout { fail "Delete all breakpoints when none (timeout)" }
+               timeout { fail "Delete all breakpoints when none (timeout after unexpected prompt)" }
            }
        }
-    -re ".*$prompt $"       { pass "Delete all breakpoints when none" }
-    timeout                { fail "Delete all breakpoints when none" }
+    -i $gdb_spawn_id -re ".*$prompt $"       { pass "Delete all breakpoints when none" }
+    timeout                { fail "Delete all breakpoints when none (timeout)" }
 }
 
 #
@@ -117,7 +111,7 @@ gdb_test "break $srcfile:70" \
 #
 # check to see what breakpoints are set
 #
-if $usestubs then {
+if [target_info exists gdb_stub] {
     set main_line 57
 } else {
     set main_line 60
@@ -135,6 +129,8 @@ gdb_test "info break" \
 
 # FIXME: The rest of this test doesn't work with anything that can't
 # handle arguments.
+# Huh? There doesn't *appear* to be anything that passes arguments
+# below.
 if [istarget "mips-idt-*"] then {
     return
 }
@@ -142,23 +138,27 @@ if [istarget "mips-idt-*"] then {
 #
 # run until the breakpoint at main is hit. For non-stubs-using targets.
 #
-if !$usestubs then {
+if ![target_info exists use_gdb_stub] {
   if [istarget "*-*-vxworks*"] then {
-    send "run vxmain \"2\"\n"
+    send_gdb "run vxmain \"2\"\n"
     set timeout 120
+    verbose "Timeout is now $timeout seconds" 2
   } else {
-       send "run\n"
+       send_gdb "run\n"
   }
   expect {
     -re "The program .* has been started already.*y or n. $" {
-       send "y\n"
+       send_gdb "y\n"
        exp_continue
     }
     -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:60.*60\[\t \]+if .argc.* \{.*$prompt $"\
                            { pass "run until function breakpoint" }
     -re ".*$prompt $"       { fail "run until function breakpoint" }
-    timeout                { fail "(timeout) run until function breakpoint" }
+    timeout                { fail "run until function breakpoint (timeout)" }
   }
+} else {
+    gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:60.*60\[\t \]+if .argc.*\{" \
+           "stubs continue"
 }
 
 #
@@ -184,28 +184,7 @@ gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*,
 #
 # delete all breakpoints so we can start over, course this can be a test too
 #
-send "delete breakpoints\n"
-expect {
-    -re "Delete all breakpoints.*y or n.*$" {
-       send "y\n"
-       expect {
-           -re ".*$prompt $" {
-               send "info breakpoints\n"
-               expect {
-                   -re "No breakpoints or watchpoints..*$prompt $" {
-                       pass "Deleted all breakpoints"
-                   }
-                   -re ".*$prompt $"       { fail "Deleted all breakpoints" }
-                   timeout                 { fail "Deleted all breakpoints" }
-               }
-           }
-           timeout                 { fail "Deleted all breakpoints" }      
-       }
-    }
-    -re ".*$prompt $"       { fail "Deleted all breakpoints" }
-    timeout                { fail "Deleted all breakpoints" }
-}
-
+delete_breakpoints
 
 #
 # test temporary breakpoint at function
@@ -223,11 +202,11 @@ gdb_test "tbreak $srcfile:factorial" "Breakpoint.*at.* file .*$srcfile, line.*"
 #
 # test break at line number
 #
-send "tbreak 64\n"
+send_gdb "tbreak 64\n"
 expect {
     -re "Breakpoint.*at.* file .*$srcfile, line 64.*$prompt $" { pass "Temporary breakpoint line number" }
        -re ".*$prompt $"   { pass "Temporary breakpoint line number" }
-       timeout     { fail "(timeout) breakpoint line number" }
+       timeout     { fail "breakpoint line number (timeout)" }
 }
 
 gdb_test "tbreak 60" "Breakpoint.*at.* file .*$srcfile, line 60.*" "Temporary breakpoint line number"
@@ -235,11 +214,11 @@ gdb_test "tbreak 60" "Breakpoint.*at.* file .*$srcfile, line 60.*" "Temporary br
 #
 # test break at line number in file
 #
-send "tbreak $srcfile:70\n"
+send_gdb "tbreak $srcfile:70\n"
 expect {
     -re "Breakpoint.*at.* file .*$srcfile, line 70.*$prompt $" { pass "Temporary breakpoint line number in file" }
        -re ".*$prompt $"   { pass "Temporary breakpoint line number in file" }
-       timeout     { fail "(timeout) breakpoint line number in file" }
+       timeout     { fail "Temporary breakpoint line number in file (timeout)" }
 }
 
 gdb_test  "tbreak $srcfile:66" "Breakpoint.*at.* file .*$srcfile, line 66.*" "Temporary breakpoint line number in file"
@@ -247,18 +226,7 @@ gdb_test  "tbreak $srcfile:66" "Breakpoint.*at.* file .*$srcfile, line 66.*" "Te
 #
 # check to see what breakpoints are set (temporary this time)
 #
-send "info break\n"
-expect {
-    -re "Num Type.*Disp Enb Address.*What.*
-\[0-9\]+\[\t \]+breakpoint     del.*y.*in main at .*$srcfile:$main_line.*
-\[0-9\]+\[\t \]+breakpoint     del.*y.*in factorial at .*$srcfile:76.*
-\[0-9\]+\[\t \]+breakpoint     del.*y.*in main at .*$srcfile:64.*
-\[0-9\]+\[\t \]+breakpoint     del.*y.*in main at .*$srcfile:70.*$prompt $" {
-        pass "Temporary breakpoint info"
-    }
-    -re ".*$prompt $"   { fail "Temporary breakpoint info" }
-    timeout        { fail "(timeout) Temporary breakpoint info" }
-}
+gdb_test "info break" "Num Type.*Disp Enb Address.*What.*\[\r\n\]\[0-9\]+\[\t \]+breakpoint     del.*y.*in main at .*$srcfile:$main_line.*\[\r\n\]\[0-9\]+\[\t \]+breakpoint     del.*y.*in factorial at .*$srcfile:76.*\[\r\n\]\[0-9\]+\[\t \]+breakpoint     del.*y.*in main at .*$srcfile:64.*\[\r\n\]\[0-9\]+\[\t \]+breakpoint     del.*y.*in main at .*$srcfile:70.*" "Temporary breakpoint info"
 
 proc test_clear_command {} {
     gdb_test "break main" "Breakpoint.*at.*"
@@ -274,55 +242,59 @@ proc test_clear_command {} {
 #
 
 proc test_next_with_recursion {} { 
-   global prompt
-   global decimal
-
-# FIXME: should be using runto
-    send "kill\n"
-    expect {
-       -re ".*Kill the program being debugged.*y or n. $" {
-           send "y\n"
-           exp_continue
-       }
-       -re ".*$prompt $" {}
-       timeout { fail "killing inferior" ; return }
+    global prompt
+    global decimal
+    global noresults
+    global binfile
+
+    if [istarget "d10v-*-*"] {
+       # Doesn't work right now.
+       return;
     }
+    if [target_info exists use_gdb_stub] {
+       # Reload the program.
+       delete_breakpoints
+       gdb_load ${binfile};
+    } else {
+       # FIXME: should be using runto
+       gdb_test "kill" "" "kill program" "Kill the program being debugged.*y or n. $" "y"
 
-    delete_breakpoints
+       delete_breakpoints
+    }
 
     gdb_test "break factorial" "Breakpoint $decimal at .*" "break at factorial"
 
     # Run until we call factorial with 6
 
     if [istarget "*-*-vxworks*"] then {
-       send "run vxmain \"6\"\n"
+       send_gdb "run vxmain \"6\"\n"
     } else {
        gdb_run_cmd
     }
     expect {
        -re "Break.* factorial .value=6. .*$prompt $" {}
-       timeout { fail "run to factorial(6)" ; return }
+       timeout { fail "run to factorial(6) (timeout)" ; return }
     }
 
     # Continue until we call factorial recursively with 5.
 
-    send "continue\n"
+    send_gdb "continue\n"
     expect {
        -re "Continuing.*Break.* factorial .value=5. .*$prompt $" {}
-       timeout { fail "continue to factorial(5)" ; return }
+       timeout { fail "continue to factorial(5) (timeout)" ; return }
     }
 
     # Do a backtrace just to confirm how many levels deep we are.
 
     set result [gdb_test "backtrace" \
-                       "#0\[ \t\]+ factorial .value=5..*" \
-                       "backtrace from factorial(5)"]
+           "#0\[ \t\]+ factorial .value=5..*" \
+           "backtrace from factorial(5)"]
     if $result!=0 then { return }
 
     # Now a "next" should position us at the recursive call, which
     # we will be performing with 4.
 
-    send "next\n"
+    send_gdb "next\n"
     expect {
        -re ".* factorial .value - 1.;.*$prompt $" {}
        timeout { fail "next to recursive call (timeout)" ; return }
@@ -337,30 +309,37 @@ proc test_next_with_recursion {} {
     delete_breakpoints
 
     gdb_test next "\[0-9\]*\[\t \]+return \\(value\\);.*" \
-       "next over recursive call"
+           "next over recursive call"
 
     # OK, we should be back in the same stack frame we started from.
     # Do a backtrace just to confirm.
 
     set result [gdb_test "backtrace" \
-                        "#0\[ \t\]+ factorial .value=120.*\r\n#1\[ \t\]+ \[0-9a-fx\]+ in factorial .value=6..*" \
-                        "backtrace from factorial(5)"]
-    if $result!=0 then { return }
-
+           "#0\[ \t\]+ factorial .value=120.*\r\n#1\[ \t\]+ \[0-9a-fx\]+ in factorial .value=6..*" \
+           "backtrace from factorial(5.1)"]
+    if { $result != 0 } { return }
+
+    if { $noresults == 1 } { return }
+    if [target_info exists use_gdb_stub] {
+       gdb_breakpoint "exit"
+       gdb_test "continue" "Continuing..*Breakpoint .*exit .code=0.*" "continue until exit in recursive next test"
+    } else {
     # Continue until we exit.  Should not stop again.
     # Don't bother to check the output of the program, that may be
     # extremely tough for some remote systems.
-    gdb_test "continue"\
-               "Continuing.\[\r\n0-9\]+Program exited normally\\."\
+       gdb_test "continue"\
+               "Continuing.\[\r\n0-9\]+Program exited normally\\..*"\
                "continue until exit in recursive next test"
+    }
 }
 
 test_clear_command
 test_next_with_recursion
 
 # Reset the default arguments for VxWorks
-if [istarget "*-*-vxworks*"] then {
+if [istarget "*-*-vxworks*"] {
     set timeout 10
-    send "set args main\n"
+    verbose "Timeout is now $timeout seconds" 2
+    send_gdb "set args main\n"
     expect -re ".*$prompt $" {}
 }
index 9a7fa5dcf3c8603f4f48015f2d2e653ed48395ec..1f0ca64ea1e1ebceb0f77bacc48bf78892642b2e 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 1992 Free Software Foundation, Inc.
+# Copyright (C) 92, 96, 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
 # 
 # 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.  */
+# 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 Fred Fish. (fnf@cygnus.com)
+# and modified by Bob Manson. (manson@cygnus.com)
 
 if $tracelevel then {
        strace $tracelevel
@@ -26,19 +27,16 @@ if $tracelevel then {
 set prms_id 0
 set bug_id 0
 
-set prototypes 0
 set testfile "callfuncs"
 set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
 
-# build the first test case
-execute_anywhere "echo set prototypes 1 > ${objdir}/${subdir}/callfuncs.tmp"
-if  { [compile "-g ${srcdir}/${subdir}/${srcfile} -o ${binfile} "] != "" } {
-    execute_anywhere "rm -f ${objdir}/${subdir}/callfuncs.tmp"    
+set prototypes 1
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+    set prototypes 0;
     # built the second test case since we can't use prototypes
     warning "Prototypes not supported, rebuilding with -DNO_PROTOTYPES"
-    execute_anywhere "echo set prototypes 0 > ${objdir}/${subdir}/callfuncs.tmp"
-    if  { [compile "-g -DNO_PROTOTYPES ${srcdir}/${subdir}/${srcfile} -o ${binfile} "] != "" } {
+    if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DNO_PROTOTYPES}] != "" } {
        perror "Couldn't compile ${testfile}.c"
        return -1
     }
@@ -46,39 +44,31 @@ if  { [compile "-g ${srcdir}/${subdir}/${srcfile} -o ${binfile} "] != "" } {
 
 # Create and source the file that provides information about the compiler
 # used to compile the test case.
-execute_anywhere "rm -f ${binfile}.ci"
-if  { [compile "-E ${srcdir}/${subdir}/compiler.c >> ${binfile}.ci"] != "" } {
-    perror "Couldn't make ${binfile}.ci"
-    return -1
+
+if [get_compiler_info ${binfile}] {
+    return -1;
 }
-source ${binfile}.ci
 
 # The a29k can't call functions, so don't even bother with this test.
-if [istarget "a29k-*-udi"] then {
-    setup_xfail "a29k-*-udi" 2416
-    fail "a29k-*-udi can not call functions"
+if [target_info exists gdb,cannot_call_functions] {
+    setup_xfail "*-*-*" 2416
+    fail "This target can not call functions"
     continue
 }
 
-# The h8300 simulator can't call functions, so don't even bother with this test.
-if [istarget "h8300*-*-*"] then {
-    setup_xfail "h8300*-*-*" 
-    fail "h8300*-*-* simulator can not call functions"
-    continue
-}
 # Set the current language to C.  This counts as a test.  If it
 # fails, then we skip the other tests.
 
 proc set_lang_c {} {
     global prompt
 
-    send "set language c\n"
+    send_gdb "set language c\n"
     expect {
        -re ".*$prompt $" {}
        timeout { fail "set language c (timeout)" ; return 0 }
     }
 
-    send "show language\n"
+    send_gdb "show language\n"
     expect {
        -re ".* source language is \"c\".*$prompt $" {
            pass "set language to \"c\""
@@ -234,12 +224,13 @@ gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
 
-send "set print sevenbit-strings\n" ; expect -re "$prompt $"
-send "set print address off\n" ; expect -re "$prompt $"
-send "set width 0\n" ; expect -re "$prompt $"
+gdb_test "set print sevenbit-strings" ""
+gdb_test "set print address off" ""
+gdb_test "set width 0" ""
 
 if [set_lang_c] then {
     if [runto_main] then {
+       gdb_test "next" ".*"
        do_function_calls
     } else {
        fail "C function calling tests suppressed"
index c49ec6c547d8749cfc73ae3b77694fc6398d326b..5932d243fe859b4dbdb19b4ebe88fff286e160b4 100644 (file)
@@ -28,9 +28,9 @@ set prms_id 0
 set bug_id 0
 
 set testfile "run"
-set srcfile ${srcdir}/$subdir/${testfile}.c
+set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
-if  { [compile "${srcfile} -g -o ${binfile}"] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     perror "Couldn't compile ${srcfile}"
     return -1
 }
@@ -69,9 +69,8 @@ proc gdbvar_complex_if_while_test {} {
 
 proc progvar_simple_if_test {} {
     global prompt
-    global noargs
 
-    if $noargs { 
+    if [target_info exists gdb,noargs] { 
         verbose "Skipping progvar_simple_if_test because of noargs."
         return
     }
@@ -86,9 +85,8 @@ proc progvar_simple_if_test {} {
 
 proc progvar_simple_while_test {} {
     global prompt
-    global noargs
 
-    if $noargs { 
+    if [target_info exists gdb,noargs] { 
         verbose "Skipping progvar_simple_while_test because of noargs."
         return
     }
@@ -101,9 +99,8 @@ proc progvar_simple_while_test {} {
 
 proc progvar_complex_if_while_test {} {
     global prompt
-    global noargs
 
-    if $noargs { 
+    if [target_info exists gdb,noargs] { 
         verbose "Skipping progvar_simple_if_while_test because of noargs."
         return
     }
@@ -115,9 +112,7 @@ proc progvar_complex_if_while_test {} {
 }
 
 proc if_while_breakpoint_command_test {} {
-    global noargs
-
-    if $noargs { 
+    if [target_info exists gdb,noargs] { 
         verbose "Skipping if_while_breakpoint_command_test because of noargs."
         return
     }
@@ -127,7 +122,7 @@ proc if_while_breakpoint_command_test {} {
     delete_breakpoints
     gdb_test "break factorial" "Breakpoint.*at.*"
 
-    send "commands\n"
+    send_gdb "commands\n"
     expect {
        -re "End with" {
            pass "commands in if_while_breakpoint_command_test"
@@ -144,9 +139,7 @@ proc if_while_breakpoint_command_test {} {
 
 # Test that we can run the inferior from breakpoint commands.
 proc infrun_breakpoint_command_test {} {
-    global noargs
-
-    if $noargs { 
+    if [target_info exists gdb,noargs] { 
         verbose "Skipping infrun_breakpoint_command_test because of noargs."
         return
     }
@@ -173,9 +166,7 @@ factorial \\(value=3\\) at .*
 }
 
 proc breakpoint_command_test {} {
-    global noargs
-
-    if $noargs { 
+    if [target_info exists gdb,noargs] { 
         verbose "Skipping breakpoint_command_test because of noargs."
         return
     }
@@ -197,7 +188,7 @@ proc user_defined_command_test {} {
 
     gdb_test "set \$foo = 4" "" "set foo in user_defined_command_test"
 
-    send "define mycommand\n"
+    send_gdb "define mycommand\n"
     expect {
        -re "End with"  {
            pass "define mycommand in user_defined_command_test"
index 1ca0ca4dc037385585f4b47690160326635dfded..d2f78948d64b0914bffa92fd50aa5c5dadc5ffbe 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -34,19 +34,16 @@ if ![isnative] then {
 set testfile "coremaker"
 set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
-if  { [compile "${srcdir}/${subdir}/${srcfile} -g -o ${binfile}"] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     perror "Couldn't compile ${srcfile}"
     return -1
 }
 
 # Create and source the file that provides information about the compiler
 # used to compile the test case.
-execute_anywhere "rm -f ${binfile}.ci"
-if  { [compile "-E ${srcdir}/${subdir}/compiler.c > ${binfile}.ci"] != "" } {
-    perror "Couldn't make ${binfile}.ci file"
-    return -1
+if [get_compiler_info ${binfile}] {
+    return -1;
 }
-source ${binfile}.ci
 
 # Create a core file named "corefile" rather than just "core", to
 # avoid problems with sys admin types that like to regularly prune all
@@ -60,13 +57,10 @@ source ${binfile}.ci
 # the name of the program to "core".
 set found 0
 catch "system \"(cd ${objdir}/${subdir}; ulimit -c unlimited; ${binfile}; true) >/dev/null 2>&1\""
-#    execute_anywhere "${binfile}"
+#      remote_exec "${binfile}"
 foreach i "${objdir}/${subdir}/core ${objdir}/${subdir}/core.coremaker.c ${binfile}.core" {
-    set exec_output [execute_anywhere "ls $i"]
-    if [ regexp "No such file or directory|not found" ${exec_output} ] {
-       continue
-    } else {
-       execute_anywhere "mv $i ${objdir}/${subdir}/corefile"
+    if [remote_file build exists $i] {
+       remote_exec build "mv $i ${objdir}/${subdir}/corefile"
        set found 1
     }
 }
@@ -136,13 +130,14 @@ expect {
 # See previous comments above, they are still applicable.
 #
 
-gdb_exit
+close;
+
 if $verbose>1 then {
     send_user "Spawning $GDB -nw $GDBFLAGS $binfile -core=$objdir/$subdir/corefile\n"
 }
 
 
-spawn $GDB -nw $GDBFLAGS $binfile -core=$objdir/$subdir/corefile
+eval "spawn $GDB -nw $GDBFLAGS $binfile -core=$objdir/$subdir/corefile";
 expect {
     -re "Core was generated by .*coremaker.*\r\n\#0  .*\(\).*\r\n$prompt $" {
        pass "args: execfile -core=corefile"
@@ -159,16 +154,17 @@ expect {
 set timeout $oldtimeout
 verbose "Timeout is now $timeout seconds" 2
 
+close;
+
 # Now restart normally.
 
-gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
 
 # Test basic corefile recognition via core-file command.
 
-send "core-file $objdir/$subdir/corefile\n"
+send_gdb "core-file $objdir/$subdir/corefile\n"
 expect {
     -re "Core was generated by .*coremaker.*\r\n\#0  .*\(\).*\r\n$prompt $" {
        pass "core-file command"
@@ -189,7 +185,7 @@ gdb_test "print coremaker_data" "\\\$$decimal = 202"
 gdb_test "print coremaker_bss" "\\\$$decimal = 10"
 gdb_test "print coremaker_ro" "\\\$$decimal = 201"
 
-setup_xfail "i*86-*-sysv4*" "i*86-*-linux*" "m68*-*-hpux*"
+setup_xfail "i*86-*-sysv4*" "i*86-pc-linux*-gnu" "m68*-*-hpux*"
 if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
 gdb_test "print func2::coremaker_local" "\\\$$decimal = {0, 1, 2, 3, 4}"
 
@@ -197,22 +193,22 @@ gdb_test "print func2::coremaker_local" "\\\$$decimal = {0, 1, 2, 3, 4}"
 # file correctly.  I don't think the other tests do this.
 
 # Haven't investigated this xfail
-setup_xfail "m68k-*-hpux*" "i*86-*-sysv4*" "i*86-*-linux*"
+setup_xfail "m68k-*-hpux*" "i*86-*-sysv4*" "i*86-pc-linux*-gnu"
 gdb_test "bt" "abort.*func2.*func1.*main.*" "backtrace in corefile.exp"
 
 # Test ability to read mmap'd data
 
 gdb_test "x/8bd buf1" ".*:.*0.*1.*2.*3.*4.*5.*6.*7" "accessing original mmap data in core file"
 setup_xfail "*-*-sunos*" "*-*-ultrix*" "*-*-aix*"
-send "x/8bd buf2\n"
+send_gdb "x/8bd buf2\n"
 expect {
     -re ".*:.*0.*1.*2.*3.*4.*5.*6.*7.*$prompt $" {
        pass "accessing mmapped data in core file"
     }
-    -re "0x\[f\]*:.*Cannot access memory at address 0x\[f\]*" {
+    -re "0x\[f\]*:.*Cannot access memory at address 0x\[f\]*.*$prompt $" {
        fail "accessing mmapped data (mapping failed at runtime)"
     }
-    -re "0x.*:.*Cannot access memory at address 0x.*" {
+    -re "0x.*:.*Cannot access memory at address 0x.*$prompt $" {
        fail "accessing mmapped data (mapping address not found in core file)"
     }
     -re ".*$prompt $" {
index ef0bfdce1b7d5ac4623896bcfdb106db566c058a..eed58b4d24016f0d8893d19d19fe8d230eeb702b 100644 (file)
@@ -74,10 +74,10 @@ proc bfddefault {} {
 
     gdb_unload
     set file_loaded 0
-    send "file $objdir/$subdir/$binfile\n"
+    send_gdb "file $objdir/$subdir/$binfile\n"
     expect {
        -re "A program is being debugged already.  Kill it.*y or n." {
-           send "y\n"
+           send_gdb "y\n"
            exp_continue
        }
        -re "Reading symbols from $objdir/$subdir/$binfile\[.\]+done\..*$prompt $" {
@@ -135,10 +135,10 @@ proc bfdexplicit {} {
        return
     }
 
-    send "file $objdir/$subdir/$binfile\n"
+    send_gdb "file $objdir/$subdir/$binfile\n"
     expect {
        -re "A program is being debugged already.  Kill it.*y or n." {
-           send "y\n"
+           send_gdb "y\n"
            exp_continue
        }
        -re "Reading symbols from $objdir/$subdir/$binfile\[.\]+done\..*$prompt $" {
@@ -166,7 +166,7 @@ proc test_ptype_functions {} {
     global binfile
     global bfdformat
     global det_file
-    send "ptype main\n"
+    send_gdb "ptype main\n"
     expect {
        -re "type = int \[)(\]+\r\n$prompt $" {}
        timeout { fail "(timeout) $binfile ($bfdformat) function main" ; return }
index 3705e614a37b684e3a49378de31903a3f4073057..f82849ea975dbbd0d75cecedd726734754ab4c2d 100644 (file)
@@ -3,16 +3,18 @@
 gdb_exit
 gdb_start
 
+match_max 8000
+
 #
 # test default actions of gdb commands
 #
 
-load_lib gdb.exp
+#load_lib gdb.exp
 
-gdb_test "add-symbol-file" "add-symbol-file takes a file name and an address"
+gdb_test "add-symbol-file" "add-symbol-file takes a file name and an address" "add-symbol-file"
 
 setup_xfail "mips-idt-*"
-send "attach\n"
+send_gdb "attach\n"
 expect {
     -re "Argument required .(process-id|program) to attach.*$prompt $"\
                        { pass "attach" }
@@ -21,7 +23,7 @@ expect {
     -re "Don't know how to attach.  Try \"help target\"..*$prompt $"\
                        { pass "attach" }
     -re "Kill it. .y or n." {
-       send "y\n"
+       send_gdb "y\n"
        exp_continue
     }
     -re "$prompt $" { fail "attach" }
@@ -29,27 +31,32 @@ expect {
 }
 
 # FIXME: attach kills the udi connection
-if [istarget "a29k-*-udi"] then {
+if { [istarget "a29k-*-udi"] } {
     gdb_exit
     gdb_start
 }
 
-gdb_test "break" "No default breakpoint address now."
-foreach i "b br bre brea" {
-    gdb_test $i "No default breakpoint address now." "break \"$i\" abbreviation"
-       }
+if ![target_info exists use_gdb_stub] {
+    gdb_test "break" "No default breakpoint address now." "break"
+    foreach i "b br bre brea" {
+       gdb_test $i "No default breakpoint address now." "break \"$i\" abbreviation"
+    }
 
-setup_xfail "mips-idt-*" "a29k-*-udi" "h8300-*-hms"
-gdb_test "backtrace" "No stack."
-foreach i "bt ba bac" {
-    setup_xfail "mips-idt-*" "a29k-*-udi" "h8300-*-hms"
-    gdb_test $i "No stack." "backtrace \"$i\" abbreviation"
+    
+    setup_xfail "mips-idt-*" "a29k-*-udi"
+    gdb_test "backtrace" "No stack."
+    foreach i "bt ba bac" {
+       setup_xfail "mips-idt-*" "a29k-*-udi"
+       gdb_test $i "No stack." "backtrace \"$i\" abbreviation"
+    }
+} else {
+    warning "Skipping backtrace and break tests because of GDB stub."
 }
 
 # This works on the MIPS IDT board, but confuses future tests.
 if ![istarget "mips-idt-*"] then {
     setup_xfail "a29k-*-udi"
-    gdb_test "continue" "The program is not being run."
+    gdb_test "continue" "The program is not being run." "continue"
     setup_xfail "a29k-*-udi"
     gdb_test "c" "The program is not being run." "continue \"c\" abbreviation"
 }
@@ -61,138 +68,51 @@ if [istarget "a29k-*-udi"] then {
 }
 
 #test call
-send "call\n"
-expect {
-       -re "The history is empty..*$prompt $"\
-                       { pass "call" }
-       -re ".*$prompt $"       { fail "call" }
-       timeout         { fail "(timeout) call" }
-       }
+gdb_test "call" "The history is empty..*" "call"
 
 
 #test catch
-send "catch\n"
-expect {
-       -re "No selected frame..*$prompt $"\
-                       { pass "catch" }
-       -re ".*$prompt $"       { fail "catch" }
-       timeout         { fail "(timeout) catch" }
-       }
-
+gdb_test "catch" "No selected frame..*" "catch"
 
 #test cd
-send "cd\n"
-expect {
-       -re "Argument required .new working directory.*$prompt $"\
-                       { pass "cd" }
-       -re ".*$prompt $"       { fail "cd" }
-       timeout         { fail "(timeout) cd" }
-       }
-
+gdb_test "cd" "Argument required .new working directory.*" "cd"
 
 #test clear
-send "clear\n"
-expect {
-       -re "No source file specified..*$prompt $"\
-                       { pass "clear" }
-       -re ".*$prompt $"       { fail "clear" }
-       timeout         { fail "(timeout) clear" }
-       }
-
+gdb_test "clear" "No source file specified..*" "clear"
 
 #test commands
-send "commands\n"
-expect {
-       -re "No breakpoint number 0..*$prompt $"\
-                       { pass "commands" }
-       -re ".*$prompt $"       { fail "commands" }
-       timeout         { fail "(timeout) commands" }
-       }
-
+gdb_test "commands" "No breakpoint number 0..*" "commands"
 
 #test condition
-send "condition\n"
-expect {
-       -re "Argument required .breakpoint number.*$prompt $"\
-                       { pass "condition" }
-       -re ".*$prompt $"       { fail "condition" }
-       timeout         { fail "(timeout) condition" }
-       }
-
+gdb_test "condition" "Argument required .breakpoint number.*" "condition"
 
 #test core-file
-send "core-file\n"
-expect {
-       -re "No core file now..*$prompt $"\
-                       { pass "core-file" }
-       -re "GDB can't read core files on this machine..*$prompt $"\
-                       { pass "core-file" }
-       -re ".*$prompt $"       { fail "core-file" }
-       timeout         { fail "(timeout) core-file" }
-       }
-
-
+gdb_test "core-file" "No core file now.|GDB can't read core files on this machine." "core-file"
 #test delete "d" abbreviation
-send "d\n"
-expect {
-       -re "$prompt $"\
-                       { pass "delete \"d\" abbreviation" }
-       timeout         { fail "(timeout) delete \"d\" abbreviation" }
-       }
-
-
+gdb_test "d" "" "delete \"d\" abbreviation"
 #test delete
-send "delete\n"
-expect {
-       -re "$prompt $"\
-                       { pass "delete" }
-       timeout         { fail "(timeout) delete" }
-       }
-
-
+gdb_test "delete" "" "delete"
 #test define
-send "define\n"
-expect {
-       -re "Argument required \[(\]name of command to define\[)\]..*$prompt $"\
-                       { pass "define" }
-       timeout         { fail "(timeout) define" }
-       }
-
-
+gdb_test "define" "Argument required \[(\]name of command to define\[)\]." "define"
 #test delete breakpoints
-send "delete breakpoints\n"
-expect {
-       -re "$prompt $"\
-                       { pass "delete breakpoints" }
-       timeout         { fail "(timeout) delete breakpoints" }
-       }
-
-
+gdb_test "delete breakpoints" "" "delete breakpoints"
 #test delete display
 # FIXME -- need to dump full output to detailed log
-send "delete display\n"
+send_gdb "delete display\n"
 expect {
-       -re "delete display.*Delete all auto-display expressions.*y or n. $"\
-           { send "y\n"
-               expect {
-                   -re "$prompt $"\
-                       { pass "delete display prompt" }
-                   timeout             { fail "(timeout) delete display prompt" }
-                   }
-               }
-       timeout         { fail "(timeout) delete display prompt" }
-
+    -re "Delete all auto-display expressions.*y or n. $" {
+       send_gdb "y\n"
+       expect {
+           -re "$prompt $"     { pass "delete display prompt" }
+           timeout             { fail "(timeout) delete display prompt" }
        }
+    }
+    timeout            { fail "(timeout) delete display prompt" }
 
+}
 
 #test detach
-gdb_test "detach" ""
-#send "detach\n"
-#expect {
-#      -re "$prompt $"\
-#                      { pass "detach" }
-#      timeout         { fail "(timeout) detach" }
-#      }
+gdb_test "detach" "" "detach"
 
 # FIXME: continue kills the udi connection
 if [istarget "a29k-*-udi"] then {
@@ -206,207 +126,65 @@ if [istarget "h8300-*-hms"] then {
 
 #test directory
 # FIXME -- need to dump full output to detailed log
-send "directory\n"
-expect {
-       -re "Reinitialize source path to empty.*y or n. $"\
-           { send "y\n"
-               expect {
-                   -re "Source directories searched: .cdir:.cwd.*$prompt $"\
-                       { pass "directory prompt" }
-                   timeout             { fail "(timeout) directory prompt" }
-                   }
-           }
-       }
-
 
-#test disable "dis" abbreviation
-send "dis\n"
+send_gdb "directory\n"
 expect {
-       -re "$prompt $"\
-                       { pass "disable \"dis\" abbreviation" }
-       timeout         { fail "(timeout) disable \"dis\" abbreviation" }
+    -re "Reinitialize source path to empty.*y or n. $"  {
+       send_gdb "y\n"
+       expect {
+           -re "Source directories searched: .cdir:.cwd.*$prompt $"\
+                   { pass "directory prompt" }
+           timeout             { fail "(timeout) directory prompt" }
        }
+    }
+}
 
-
+#test disable "dis" abbreviation
+gdb_test "dis" "" "disable \"dis\" abbreviation"
 #test disable "disa" abbreviation
-send "disa\n"
-expect {
-       -re "$prompt $"\
-                       { pass "disable \"disa\" abbreviation" }
-       timeout         { fail "(timeout) disable \"disa\" abbreviation" }
-       }
-
-
+gdb_test "disa" "" "disable \"disa\" abbreviation"
 #test disable
-send "disable\n"
-expect {
-       -re "$prompt $"\
-                       { pass "disable" }
-       timeout         { fail "(timeout) disable" }
-       }
-
-
+gdb_test "disable" "" "disable"
 #test disable breakpoints
-send "disable breakpoints\n"
-expect {
-       -re "$prompt $"\
-                       { pass "disable breakpoints" }
-       timeout         { fail "(timeout) disable breakpoints" }
-       }
-
-
+gdb_test "disable breakpoints" "" "disable breakpoints"
 #test disable display
-send "disable display\n"
-expect {
-       -re "$prompt $"\
-                       { pass "disable display" }
-       timeout         { fail "(timeout) disable display" }
-       }
-
-
+gdb_test "disable display" "" "disable display"
 #test disassemble
-send "disassemble\n"
-expect {
-       -re "No frame selected..*$prompt $"\
-                       { pass "disassemble" }
-       -re ".*$prompt $"       { fail "disassemble" }
-       timeout         { fail "(timeout) disassemble" }
-       }
-
-
+gdb_test "disassemble" "No frame selected." "disassemble"
 #test display
-send "display\n"
-expect {
-       -re "$prompt $"\
-                       { pass "display" }
-       timeout         { fail "(timeout) display" }
-       }
-
-
+gdb_test "display" "" "display"
 #test do
-send "do\n"
-expect {
-       -re "No stack..*$prompt $"\
-                       { pass "do" }
-       -re ".*$prompt $"       { fail "do" }
-       timeout         { fail "(timeout) do" }
-       }
-
-
+gdb_test "do" "No stack." "do"
 #test document
-send "document\n"
-expect {
-       -re "Argument required .name of command to define.*$prompt $"\
-                       { pass "document" }
-       -re ".*$prompt $"       { fail "document" }
-       timeout         { fail "(timeout) document" }
-       }
-
-
+gdb_test "document" "Argument required .name of command to define.*" "document"
 #test down
-send "down\n"
-expect {
-       -re "No stack.*$prompt $"\
-                       { pass "down" }
-       -re ".*$prompt $"       { fail "down" }
-       timeout         { fail "(timeout) down" }
-       }
-
-
+gdb_test "down" "No stack.*" "down"
 #test down-silently
-send "down-silently\n"
-expect {
-       -re "No stack..*$prompt $"\
-                       { pass "down-silently" }
-       -re ".*$prompt $"       { fail "down-silently" }
-       timeout         { fail "(timeout) down-silently" }
-       }
-
-
+gdb_test "down-silently" "No stack." "down-silently"
 #test echo
-send "echo\n"
-expect {
-       -re "$prompt $"\
-                       { pass "echo" }
-       timeout         { fail "(timeout) echo" }
-       }
-
-
+gdb_test "echo" "" "echo"
 #test enable breakpoints delete
-send "enable breakpoints delete\n"
-expect {
-       -re "Argument required .one or more breakpoint numbers.*$prompt $"\
-                       { pass "enable breakpoints delete" }
-       -re ".*$prompt $"       { fail "enable breakpoints delete" }
-       timeout         { fail "(timeout) enable breakpoints delete" }
-       }
-
-
+gdb_test "enable breakpoints delete" "Argument required .one or more breakpoint numbers.*" "enable breakpoints delete"
 #test enable breakpoints once
-send "enable breakpoints once\n"
-expect {
-       -re "Argument required .one or more breakpoint numbers.*$prompt $"\
-                       { pass "enable breakpoints once" }
-       -re ".*$prompt $"       { fail "enable breakpoints once" }
-       timeout         { fail "(timeout) enable breakpoints once" }
-       }
-
-
+gdb_test "enable breakpoints once" "Argument required .one or more breakpoint numbers.*" "enable breakpoints once"
 #test enable breakpoints
-send "enable breakpoints\n"
-expect {
-       -re "$prompt $"\
-                       { pass "enable breakpoints" }
-       timeout         { fail "(timeout) enable breakpoints" }
-       }
-
-
+gdb_test "enable breakpoints" "" "enable breakpoints"
 #test enable delete
-send "enable delete\n"
-expect {
-       -re "Argument required .one or more breakpoint numbers.*$prompt $"\
-                       { pass "enable delete" }
-       -re ".*$prompt $"       { fail "enable delete" }
-       timeout         { fail "(timeout) enable delete" }
-       }
-
-
+gdb_test "enable delete" "Argument required .one or more breakpoint numbers.*" "enable delete"
 #test enable display
-send "enable display\n"
-expect {
-       -re "$prompt $"\
-                       { pass "enable display" }
-       timeout         { fail "(timeout) enable display" }
-       }
-
-
+gdb_test "enable display" "" "enable display"
 #test enable once
-send "enable once\n"
-expect {
-       -re "Argument required .one or more breakpoint numbers.*$prompt $"\
-                       { pass "enable once" }
-       -re ".*$prompt $"       { fail "enable once" }
-       timeout         { fail "(timeout) enable once" }
-       }
-
-
+gdb_test "enable once" "Argument required .one or more breakpoint numbers.*" "enable once"
 #test enable
-send "enable\n"
-expect {
-       -re "$prompt $"\
-                       { pass "enable" }
-       timeout         { fail "(timeout) enable" }
-       }
-
-
+gdb_test "enable" "" "enable"
 #test exec-file
-send "exec-file\n"
+send_gdb "exec-file\n"
 expect {
     -re "No exec file now..*$prompt $" {
        pass "exec-file"
     }
     -re "exec-file.*A program is being debugged already.  Kill it. .y or n.*$" {
-       send "n\n"
+       send_gdb "n\n"
        if $verbose>1 then {
            send_user "\tDidn't kill program being debugged\n"
        }
@@ -414,680 +192,173 @@ expect {
        pass "exec-file"
     }
     -re "$prompt $"    { fail "exec-file" }
-       timeout         { fail "(timeout) exec-file" }
-       }
-
+    timeout            { fail "(timeout) exec-file" }
+}
 
 #test frame "f" abbreviation
 setup_xfail "a29k-*-udi"
-send "f\n"
-expect {
-       -re "No stack..*$prompt $"\
-                       { pass "frame \"f\" abbreviation" }
-       -re ".*$prompt $"       { fail "frame \"f\" abbreviation" }
-       timeout         { fail "(timeout) frame \"f\" abbreviation" }
-       }
-
-
+gdb_test "f" "No stack." "frame \"f\" abbreviation"
 #test frame
 setup_xfail "a29k-*-udi"
-send "frame\n"
-expect {
-       -re "No stack..*$prompt $"\
-                       { pass "frame" }
-       -re ".*$prompt $"       { fail "frame" }
-       timeout         { fail "(timeout) frame" }
-       }
-
-
+gdb_test "frame" "No stack." "frame"
 #test fg
 setup_xfail "a29k-*-udi"
-send "fg\n"
-expect {
-       -re "The program is not being run..*$prompt $"\
-                       { pass "fg" }
-       -re ".*$prompt $"       { fail "fg" }
-       timeout         { fail "(timeout) fg" }
-       }
-
+gdb_test "fg" "The program is not being run." "fg"
 # FIXME: fg kills the udi connection
-if [istarget "a29k-*-udi"] then {
-    gdb_exit
-    gdb_start
-}
-
 #test file
-send "file\n"
+send_gdb "file\n"
 expect {
-       -re "No exec file now..*$prompt $"\
-                       { pass "file" }
-       -re ".*A program is being debugged already.  Kill it. .y or n.*$" {
-           send "n\n"
-           if $verbose>1 then {
-               send_user "\t\tDidn't kill program being debugged\n"
-           }
-           expect -re "$prompt $" { }
-           pass "file"
-       }
-       -re ".*$prompt $"       { fail "file" }
-       timeout         { fail "(timeout) file" }
+    -re "No exec file now..*$prompt $"\
+           { pass "file" }
+    -re ".*A program is being debugged already.  Kill it. .y or n.*$" {
+       send_gdb "n\n"
+       if $verbose>1 then {
+           send_user "\t\tDidn't kill program being debugged\n"
        }
-
+       expect -re "$prompt $" { }
+       pass "file"
+    }
+    -re ".*$prompt $"  { fail "file" }
+    timeout            { fail "(timeout) file" }
+}
 
 #test finish
 setup_xfail "a29k-*-udi"
-send "finish\n"
-expect {
-       -re "The program is not running..*$prompt $"\
-                       { pass "finish" }
-       -re ".*$prompt $"       { fail "finish" }
-       timeout         { fail "(timeout) finish" }
-       }
-
-
+gdb_test "finish" "The program is not running." "finish"
 #test forward-search
 # The message here comes from the regexp library, not gdb, and so can
 # vary on different systems.
-send "forward-search\n"
-expect {
-       -re "No previous regular expression.*$prompt $"\
-                       { pass "forward-search" }
-       -re "There is no previous regular expression.*$prompt $"\
-                       { pass "forward-search" }
-       -re ".*$prompt $"       { fail "forward-search" }
-       timeout         { fail "(timeout) forward-search" }
-       }
-
-
+gdb_test "forward-search" "No previous regular expression.*|There is no previous regular expression.*" "forward-search"
 #test help "h" abbreviation
-send "h\n"
-expect {
-       -re "List of classes of commands:.*
-running -- Running the program.*
-stack -- Examining the stack.*
-data -- Examining data.*
-breakpoints -- Making program stop at certain points.*
-files -- Specifying and examining files.*
-status -- Status inquiries.*
-support -- Support facilities.*
-user-defined -- User-defined commands.*
-aliases -- Aliases of other commands.*
-obscure -- Obscure features.*
-Type \"help\" followed by a class name for a list of commands in that class..*
-Type \"help\" followed by command name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help \"h\" abbreviation" }
-       -re ".*$prompt $"       { fail "help \"h\" abbreviation" }
-       timeout         { fail "(timeout) help \"h\" abbreviation" }
-       }
-
-
+gdb_test "h" "List of classes of commands:.*\[\r\n\]+running -- Running the program.*\[\r\n\]+stack -- Examining the stack.*\[\r\n\]+data -- Examining data.*\[\r\n\]+breakpoints -- Making program stop at certain points.*\[\r\n\]+files -- Specifying and examining files.*\[\r\n\]+status -- Status inquiries.*\[\r\n\]+support -- Support facilities.*\[\r\n\]+user-defined -- User-defined commands.*\[\r\n\]+aliases -- Aliases of other commands.*\[\r\n\]+obscure -- Obscure features.*\[\r\n\]+Type \"help\" followed by a class name for a list of commands in that class..*\[\r\n\]+Type \"help\" followed by command name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help \"h\" abbreviation"
 #test help
-send "help\n"
-expect {
-       -re "List of classes of commands:.*
-running -- Running the program.*
-stack -- Examining the stack.*
-data -- Examining data.*
-breakpoints -- Making program stop at certain points.*
-files -- Specifying and examining files.*
-status -- Status inquiries.*
-support -- Support facilities.*
-user-defined -- User-defined commands.*
-aliases -- Aliases of other commands.*
-obscure -- Obscure features.*
-Type \"help\" followed by a class name for a list of commands in that class..*
-Type \"help\" followed by command name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help" }
-       -re ".*$prompt $"       { fail "help" }
-       timeout         { fail "(timeout) help" }
-       }
-
-
+gdb_test "help" "List of classes of commands:.*\[\r\n\]+running -- Running the program.*\[\r\n\]+stack -- Examining the stack.*\[\r\n\]+data -- Examining data.*\[\r\n\]+breakpoints -- Making program stop at certain points.*\[\r\n\]+files -- Specifying and examining files.*\[\r\n\]+status -- Status inquiries.*\[\r\n\]+support -- Support facilities.*\[\r\n\]+user-defined -- User-defined commands.*\[\r\n\]+aliases -- Aliases of other commands.*\[\r\n\]+obscure -- Obscure features.*\[\r\n\]+Type \"help\" followed by a class name for a list of commands in that class..*\[\r\n\]+Type \"help\" followed by command name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help"
 #test handle
-send "handle\n"
-expect {
-       -re "Argument required .signal to handle.*$prompt $"\
-                       { pass "handle" }
-       -re ".*$prompt $"       { fail "handle" }
-       timeout         { fail "(timeout) handle" }
-       }
-
-
+gdb_test "handle" "Argument required .signal to handle.*" "handle"
 #test info "i" abbreviation 
-send "i\n"
-expect {
-       -re "\"info\" must be followed by the name of an info command..*
-List of info subcommands:.*
-Type \"help info\" followed by info subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "info \"i\" abbreviation" }
-       -re ".*$prompt $"       { fail "info \"i\" abbreviation" }
-       timeout         { fail "(timeout) info \"i\" abbreviation" }
-       }
-
-
+gdb_test "i" "\"info\" must be followed by the name of an info command..*\[\r\n\]+List of info subcommands:.*\[\r\n\]+Type \"help info\" followed by info subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "info \"i\" abbreviation"
 #test info
-send "info\n"
-expect {
-       -re "\"info\" must be followed by the name of an info command..*
-List of info subcommands:.*
-Type \"help info\" followed by info subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "info" }
-       -re ".*$prompt $"       { fail "info" }
-       timeout         { fail "(timeout) info" }
-       }
-
-
+gdb_test "info" "\"info\" must be followed by the name of an info command..*\[\r\n\]+List of info subcommands:.*\[\r\n\]+Type \"help info\" followed by info subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "info"
 #test ignore
-send "ignore\n"
-expect {
-       -re "Argument required .a breakpoint number.*$prompt $"\
-                       { pass "ignore" }
-       -re ".*$prompt $"       { fail "ignore" }
-       timeout         { fail "(timeout) ignore" }
-       }
-
-
+gdb_test "ignore" "Argument required .a breakpoint number.*" "ignore"
 #test info address
-send "info address\n"
-expect {
-       -re "Argument required..*$prompt $"\
-                       { pass "info address" }
-       -re ".*$prompt $"       { fail "info address" }
-       timeout         { fail "(timeout) info address" }
-       }
-
-
+gdb_test "info address" "Argument required." "info address"
 #test info all-registers
 setup_xfail "a29k-*-udi"
-send "info all-registers\n"
-expect {
-       -re "The program has no registers now..*$prompt $"\
-                       { pass "info all-registers" }
-       -re ".*$prompt $"       { fail "info all-registers" }
-       timeout         { fail "(timeout) info all-registers" }
-       }
-
-
+gdb_test "info all-registers" "The program has no registers now." "info all-registers"
 #test info args
-send "info args\n"
-expect {
-       -re "No frame selected..*$prompt $"\
-                       { pass "info args" }
-       -re ".*$prompt $"       { fail "info args" }
-       timeout         { fail "(timeout) info args" }
-       }
-
-
+gdb_test "info args" "No frame selected." "info args"
 #test info bogus-gdb-command
-send "info bogus-gdb-command\n"
-expect {
-       -re "Undefined info command: \"bogus-gdb-command\".  Try \"help info\"..*$prompt $"\
-                       { pass "info bogus-gdb-command" }
-       -re ".*$prompt $"       { fail "info bogus-gdb-command" }
-       timeout         { fail "(timeout) info bogus-gdb-command" }
-       }
-
-
+gdb_test "info bogus-gdb-command" "Undefined info command: \"bogus-gdb-command\".  Try \"help info\".*" "info bogus-gdb-command"
 #test info breakpoints
-send "info breakpoints\n"
-expect {
-       -re "No breakpoints or watchpoints..*$prompt $"\
-                       { pass "info breakpoints" }
-       -re ".*$prompt $"       { fail "info breakpoints" }
-       timeout         { fail "(timeout) info breakpoints" }
-       }
-
-
+gdb_test "info breakpoints" "No breakpoints or watchpoints." "info breakpoints"
 #test info catch
-send "info catch\n"
-expect {
-       -re "No frame selected..*$prompt $"\
-                       { pass "info catch" }
-       -re ".*$prompt $"       { fail "info catch" }
-       timeout         { fail "(timeout) info catch" }
-       }
-
-
+gdb_test "info catch" "No frame selected." "info catch"
 #test info copying
 # FIXME -- doesn't work worth a shit
-#send "info copying\n"
-#expect {
-#      -re "GNU GENERAL PUBLIC LICENSE.*\
-#of preserving the free status of all derivatives of our free software and.*\
-#of promoting the sharing and reuse of software generally..*$prompt $"\
-#                      { pass "info copying" }
-#      timeout         { fail "(timeout) info copying" }
+#send_gdb "info copying"
+#      -re "GNU GENERAL PUBLIC LICENSE.*#of preserving the free status of all derivatives of our free software and.*#of promoting the sharing and reuse of software generally."# 
+gdb_test "info copying"
 #      }
 #
 #
-
 #test info display
-send "info display\n"
-expect {
-       -re "There are no auto-display expressions now..*$prompt $"\
-                       { pass "info display" }
-       -re ".*$prompt $"       { fail "info display" }
-       timeout         { fail "(timeout) info display" }
-       }
-
-
+gdb_test "info display" "There are no auto-display expressions now." "info display"
 #test info frame "f" abbreviation
-send "info f\n"
-expect {
-       -re "No stack..*$prompt $"\
-                       { pass "info frame \"f\" abbreviation" }
-       -re "No selected frame..*$prompt $"\
-                       { pass "info frame \"f\" abbreviation" }
-       -re ".*$prompt $"       { fail "info frame \"f\" abbreviation" }
-       timeout         { fail "(timeout) info frame \"f\" abbreviation" }
-       }
-
-
+gdb_test "info f" "No stack.*|No selected frame.*" "info frame \"f\" abbreviation"
 #test info frame
-send "info frame\n"
-expect {
-       -re "No stack..*$prompt $"\
-                       { pass "info frame" }
-       -re "No selected frame..*$prompt $"\
-                       { pass "info frame" }
-       -re ".*$prompt $"       { fail "info frame" }
-       timeout         { fail "(timeout) info frame" }
-       }
-
-
+gdb_test "info frame" "No stack.|No selected frame." "info frame"
 #test info files
-send "info files\n"
-expect {
-       -re "$prompt $"\
-                       { pass "info files" }
-       timeout         { fail "(timeout) info files" }
-       }
-
-
+gdb_test "info files" "" "info files"
 #test info float
-send "info float\n"
-expect {
-       -re "No floating point info available for this processor..*$prompt $"\
-                       { pass "info float" }
-       -re ".*$prompt $"       { fail "info float" }
-       timeout         { fail "(timeout) info float" }
-       }
-
-
+gdb_test "info float" "No floating point info available for this processor." "info float"
 #test info functions
-send "info functions\n"
-expect {
-       -re "All defined functions:.*$prompt $"\
-                       { pass "info functions" }
-       -re ".*$prompt $"       { fail "info functions" }
-       timeout         { fail "(timeout) info functions" }
-       }
-
-gdb_test "info line" "No line number information.*" "info line"
-
+gdb_test "info functions" "All defined functions:" "info functions"
 #test info locals
-send "info locals\n"
-expect {
-       -re "No frame selected..*$prompt $"\
-                       { pass "info locals" }
-       -re ".*$prompt $"       { fail "info locals" }
-       timeout         { fail "(timeout) info locals" }
-       }
-
-
+gdb_test "info locals" "No frame selected." "info locals"
 #test info program
 setup_xfail "a29k-*-udi"
-send "info program\n"
-expect {
-       -re "The program being debugged is not being run..*$prompt $"\
-                       { pass "info program" }
-       -re ".*$prompt $"       { fail "info program" }
-       timeout         { fail "(timeout) info program" }
-       }
-
-
+gdb_test "info program" "The program being debugged is not being run." "info program"
 #test info registers
 setup_xfail "a29k-*-udi"
-send "info registers\n"
-expect {
-       -re "The program has no registers now..*$prompt $"\
-                       { pass "info registers" }
-       -re ".*$prompt $"       { fail "info registers" }
-       timeout         { fail "(timeout) info registers" }
-       }
-
-
+gdb_test "info registers" "The program has no registers now." "info registers"
 #test info stack "s" abbreviation
 setup_xfail "a29k-*-udi"
-send "info s\n"
-expect {
-       -re "No stack..*$prompt $"\
-                       { pass "info stack \"s\" abbreviation" }
-       -re ".*$prompt $"       { fail "info stack \"s\" abbreviation" }
-       timeout         { fail "(timeout) info stack \"s\" abbreviation" }
-       }
-
-
+gdb_test "info s" "No stack." "info stack \"s\" abbreviation"
 #test info stack
 setup_xfail "a29k-*-udi"
-send "info stack\n"
-expect {
-       -re "No stack..*$prompt $"\
-                       { pass "info stack" }
-       -re ".*$prompt $"       { fail "info stack" }
-       timeout         { fail "(timeout) info stack" }
-       }
-
-
+gdb_test "info stack" "No stack." "info stack"
 #test info set
 # FIXME -- needs to match the entire output
-send "info set\n"
-expect {
-       -re "confirm:  Whether to confirm potentially dangerous operations is on..*
-history filename:  The filename in which to record the command history is .*
-listsize:  Number of source lines gdb will list by default is 10..*$prompt $"\
-                       { pass "info set" }
-       -re "\n$prompt $"       { fail "info set" }
-       timeout         { fail "(timeout) info set" }
-       }
-
-
+gdb_test "info set" "confirm:  Whether to confirm potentially dangerous operations is o\[a-z\]*..*\[\r\n\]+history filename:  The filename in which to record the command history is .*\[\r\n\]+listsize:  Number of source lines gdb will list by default is 10.*" "info set"
 #test info source
-send "info source\n"
-expect {
-       -re "No current source file..*$prompt $"\
-                       { pass "info source" }
-       -re ".*$prompt $"       { fail "info source" }
-       timeout         { fail "(timeout) info source" }
-       }
-
-
+gdb_test  "info source" "No current source file..*" "info source"
 #test info sources
-send "info sources\n"
-expect {
-       -re "No symbol table is loaded.  Use the \"file\" command..*$prompt $"\
-                       { pass "info sources" }
-       -re ".*$prompt $"       { fail "info sources" }
-       timeout         { fail "(timeout) info sources" }
-       }
-
-
+gdb_test "info sources" "No symbol table is loaded.  Use the \"file\" command.*" "info sources"
 #test info target
-send "info target\n"
-expect {
-       -re "$prompt $"\
-                       { pass "info target" }
-       timeout         { fail "(timeout) info target" }
-       }
-
-
+gdb_test "info target" "" "info target"
 #test info terminal
-send "info terminal\n"
-expect {
-       -re "No saved terminal information..*$prompt $"\
-                       { pass "info terminal" }
-       -re ".*$prompt $"       { fail "info terminal" }
-       timeout         { fail "(timeout) info terminal" }
-       }
-
-
+gdb_test "info terminal" "No saved terminal information." "info terminal"
 #test info types
-send "info types\n"
-expect {
-       -re "All defined types:.*$prompt $"\
-                       { pass "info types" }
-       -re ".*$prompt $"       { fail "info types" }
-       timeout         { fail "(timeout) info types" }
-       }
-
-
+gdb_test "info types" "All defined types:" "info types"
 #test info variables
-send "info variables\n"
-expect {
-       -re "All defined variables:.*$prompt $"\
-                       { pass "info variables" }
-       -re ".*$prompt $"       { fail "info variables" }
-       timeout         { fail "(timeout) info variables" }
-       }
-
-
+gdb_test "info variables" "All defined variables:" "info variables"
 #test info warranty
-send "info warranty\n"
-expect {
-       -re "NO WARRANTY.*
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY.*
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN.*
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES.*
-PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED.*
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF.*
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS.*
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE.*
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,.*
-REPAIR OR CORRECTION..*
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING.*
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR.*
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,.*
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING.*
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM .INCLUDING BUT NOT LIMITED.*
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY.*
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER.*
-PROGRAMS., EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE.*
-POSSIBILITY OF SUCH DAMAGES..*$prompt $"\
-                       { pass "info warranty" }
-       -re ".*$prompt $"       { fail "info warranty" }
-       timeout         { fail "(timeout) info warranty" }
-       }
-
-
+gdb_test "info warranty" "NO WARRANTY.*\[\r\n\]+  *11.  *BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY.*\[\r\n\]+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN.*\[\r\n\]+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES.*\[\r\n\]+PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED.*\[\r\n\]+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF.*\[\r\n\]+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS.*\[\r\n\]+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE.*\[\r\n\]+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,.*\[\r\n\]+REPAIR OR CORRECTION..*\[\r\n\]+  *12.  *IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING.*\[\r\n\]+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR.*\[\r\n\]+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,.*\[\r\n\]+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING.*\[\r\n\]+OUT OF THE USE OR INABILITY TO USE THE PROGRAM .INCLUDING BUT NOT LIMITED.*\[\r\n\]+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY.*\[\r\n\]+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER.*\[\r\n\]+PROGRAMS., EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE.*\[\r\n\]+POSSIBILITY OF SUCH DAMAGES.*" "info warranty"
 #test info watchpoints
-send "info watchpoints\n"
-expect {
-       -re "No breakpoints or watchpoints..*$prompt $"\
-                       { pass "info watchpoints" }
-       -re ".*$prompt $"       { fail "info watchpoints" }
-       timeout         { fail "(timeout) info watchpoints" }
-       }
-
-
+gdb_test "info watchpoints" "No breakpoints or watchpoints." "info watchpoints"
 #test inspect
-send "inspect\n"
-expect {
-       -re "The history is empty..*$prompt $"\
-                       { pass "inspect" }
-       -re ".*$prompt $"       { fail "inspect" }
-       timeout         { fail "(timeout) inspect" }
-       }
-
-
+gdb_test "inspect" "The history is empty." "inspect"
 #test jump
 setup_xfail "a29k-*-udi"
-send "jump\n"
-expect {
-       -re "The program is not being run..*$prompt $"\
-                       { pass "jump" }
-       -re ".*$prompt $"       { fail "jump" }
-       timeout         { fail "(timeout) jump" }
-       }
-
-
+gdb_test "jump" "The program is not being run." "jump"
 #test kill
-send "kill\n"
-expect {
-       -re "The program is not being run..*$prompt $"\
-                       { pass "kill" }
-       -re ".*$prompt $"       { fail "kill" }
-       timeout         { fail "(timeout) kill" }
-       }
-
-
+gdb_test "kill" "The program is not being run." "kill"
 #test list "l" abbreviation
-send "l\n"
-expect {
-       -re "No symbol table is loaded.  Use the \"file\" command..*$prompt $"\
-                       { pass "list \"l\" abbreviation" }
-       -re ".*$prompt $"       { fail "list \"l\" abbreviation" }
-       timeout         { fail "(timeout) list \"l\" abbreviation" }
-       }
-
-
+gdb_test "l" "No symbol table is loaded.  Use the \"file\" command.*" "list \"l\" abbreviation"
 #test list
-send "list\n"
-expect {
-       -re "No symbol table is loaded.  Use the \"file\" command..*$prompt $"\
-                       { pass "list" }
-       -re ".*$prompt $"       { fail "list" }
-       timeout         { fail "(timeout) list" }
-       }
-
-
+gdb_test "list" "No symbol table is loaded.  Use the \"file\" command.*" "list"
 #test load
 # The ``takes a file name'' case is for vxgdb.
 # The ``Use the "file" command'' case is for newer GDB versions which try
 # to deduce the filename from the exec file.
-send "load\n"
-expect {
-       -re "You can't do that when your target is `None'.*$prompt $"\
-                       { pass "load" }
-       -re "The load command takes a file name.*$prompt $"\
-                       { pass "load" }
-       -re "Must specify at least a file name with the load command.*$prompt $"\
-                       { pass "load" }
-       -re "Use the .file. or .exec-file. command.*$prompt $"\
-                       { pass "load" }
-       -re ".*$prompt $"       { fail "load" }
-       timeout         { fail "(timeout) load" }
-       }
-
-
+gdb_test "load" "You can't do that when your target is `None'.*|The load command takes a file name.*|Must specify at least a file name with the load command.*|.*Use the .file. or .exec-file. command.*" "load"
 #test next "n" abbreviation
 setup_xfail "a29k-*-udi"
-send "n\n"
-expect {
-       -re "The program is not being run..*$prompt $"\
-                       { pass "next \"n\" abbreviation" }
-       -re ".*$prompt $"       { fail "next \"n\" abbreviation" }
-       timeout         { fail "(timeout) next \"n\" abbreviation" }
-       }
-
-
+gdb_test "n" "The program is not being run." "next \"n\" abbreviation"
 #test next
 setup_xfail "a29k-*-udi"
-send "next\n"
-expect {
-       -re "The program is not being run..*$prompt $"\
-                       { pass "next" }
-       -re ".*$prompt $"       { fail "next" }
-       timeout         { fail "(timeout) next" }
-       }
-
-
+gdb_test "next" "The program is not being run." "next"
 #test nexti "ni" abbreviation
 setup_xfail "a29k-*-udi"
-send "ni\n"
-expect {
-       -re "The program is not being run..*$prompt $"\
-                       { pass "nexti \"ni\" abbreviation" }
-       -re ".*$prompt $"       { fail "nexti \"ni\" abbreviation" }
-       timeout         { fail "(timeout) nexti \"ni\" abbreviation" }
-       }
-
-
+gdb_test "ni" "The program is not being run." "nexti \"ni\" abbreviation"
 #test nexti
 setup_xfail "a29k-*-udi"
-send "nexti\n"
-expect {
-       -re "The program is not being run..*$prompt $"\
-                       { pass "nexti" }
-       -re ".*$prompt $"       { fail "nexti" }
-       timeout         { fail "(timeout) nexti" }
-       }
-
-
+gdb_test "nexti" "The program is not being run." "nexti"
 #test output
-send "output\n"
-expect {
-       -re "Argument required .expression to compute.*$prompt $"\
-                       { pass "output" }
-       -re ".*$prompt $"       { fail "output" }
-       timeout         { fail "(timeout) output" }
-       }
-
-
+gdb_test "output" "Argument required .expression to compute.*" "output"
 #test print "p" abbreviation
-send "p\n"
-expect {
-       -re "The history is empty..*$prompt $"\
-                       { pass "print \"p\" abbreviation" }
-       -re ".*$prompt $"       { fail "print \"p\" abbreviation" }
-       timeout         { fail "(timeout) print \"p\" abbreviation" }
-       }
-
-
+gdb_test "p" "The history is empty." "print \"p\" abbreviation"
 #test print
-send "print\n"
-expect {
-       -re "The history is empty..*$prompt $"\
-                       { pass "print" }
-       -re ".*$prompt $"       { fail "print" }
-       timeout         { fail "(timeout) print" }
-       }
-
-
+gdb_test "print" "The history is empty." "print"
 #test printf
-send "printf\n"
-expect {
-       -re "Argument required .format-control string and values to print.*$prompt $"\
-                       { pass "printf" }
-       -re ".*$prompt $"       { fail "printf" }
-       timeout         { fail "(timeout) printf" }
-       }
-
-
-# this command was removed from GDB 4.5.8
-#test printsyms
-#send "printsyms\n"
-#expect {
-#      -re "printsyms takes an output file name and optional symbol file name.*$prompt $"\
-#                      { pass "printsyms" }
-#      -re ".*$prompt $"       { fail "printsyms" }
-#      timeout         { fail "(timeout) printsyms" }
-#      }
-
+gdb_test "printf" "Argument required .format-control string and values to print.*" "printf"
 #test ptype
-send "ptype\n"
-expect {
-       -re "The history is empty..*$prompt $"\
-                       { pass "ptype" }
-       -re ".*$prompt $"       { fail "ptype" }
-       timeout         { fail "(timeout) ptype" }
-       }
-
-
+gdb_test "ptype" "The history is empty." "ptype"
 #test pwd
-send "pwd\n"
-expect {
-       -re "Working directory .*$prompt $"\
-                       { pass "pwd" }
-       -re ".*$prompt $"       { fail "pwd" }
-       timeout         { fail "(timeout) pwd" }
-       }
-
+gdb_test "pwd" "Working directory .*" "pwd"
 
 #test run "r" abbreviation
-if [istarget "*-*-vxworks"] then {
-    send "set args\n"
+if [istarget "*-*-vxworks*"] then {
+    send_gdb "set args\n"
     expect -re "$prompt $" {}
     gdb_test "r" "Starting program: .*
 You must specify a function name to run, and arguments if any"\
                "run \"r\" abbreviation"
-    send "set args main\n"
+    send_gdb "set args main\n"
     expect -re "$prompt $" {}
 } else {
-    send "r\n"
+    send_gdb "r\n"
     expect {
            -re "Starting program:  .*
 You can't do that when your target is `None'.*$prompt $"\
@@ -1099,6 +370,9 @@ Use the \"file\" or \"exec-file\" command.*$prompt $"\
            -re "Starting program:  .*
 No image loaded into target.*$prompt $"\
                        { pass "run \"r\" abbreviation" }
+           -re "Starting program:  .*
+No program loaded.*$prompt $"\
+                       { pass "run \"r\" abbreviation" }
            -re "Don't know how to run.  Try \"help target\"..*$prompt $"\
                        { pass "run \"r\" abbreviation" }
            -re ".*$prompt $"   { fail "run \"r\" abbreviation" }
@@ -1107,15 +381,15 @@ No image loaded into target.*$prompt $"\
 }
 
 #test run
-if [istarget "*-*-vxworks"] then {
-    send "set args\n"
+if [istarget "*-*-vxworks*"] then {
+    send_gdb "set args\n"
     expect -re "$prompt $" {}
     gdb_test "run" "Starting program: .*
 You must specify a function name to run, and arguments if any"
-    send "set args main\n"
+    send_gdb "set args main\n"
     expect -re "$prompt $" {}
 } else {
-    send "run\n"
+    send_gdb "run\n"
     expect {
            -re "Starting program:.*You can't do that when your target is `None'.*$prompt $" { pass "run" }
            -re "Starting program:  .*
@@ -1125,6 +399,9 @@ Use the \"file\" or \"exec-file\" command.*$prompt $"\
            -re "Starting program:  .*
 No image loaded into target.*$prompt $"\
                        { pass "run" }
+           -re "Starting program:  .*
+No program loaded.*$prompt $"\
+                       { pass "run \"r\" abbreviation" }
            -re "Don't know how to run.  Try \"help target\"..*$prompt $"\
                        { pass "run" }
            -re ".*$prompt $"   { fail "run" }
@@ -1133,1099 +410,264 @@ No image loaded into target.*$prompt $"\
 }
 
 #test rbreak
-send "rbreak\n"
-expect {
-       -re "$prompt $"\
-                       { pass "rbreak" }
-       timeout         { fail "(timeout) rbreak" }
-       }
-
+gdb_test "rbreak" "" "rbreak"
 
 #test return
 # The middle case accommodates the a29k, where doing the "ni" above causes
 # an initial stack to be created.
-send "return\n"
+send_gdb "return\n"
 expect {
        -re "No selected frame..*$prompt $"\
                        { pass "return" }
        -re "Make .* return now.*y or n. $" {
-           send "y\n"
+           send_gdb "y\n"
            exp_continue
        }
        -re ".*$prompt $"       { fail "return" }
        timeout         { fail "(timeout) return" }
        }
 
-
 #test reverse-search
-send "reverse-search\n"
-expect {
-       -re "No previous regular expression.*$prompt $"\
-                       { pass "reverse-search" }
-       -re "There is no previous regular expression.*$prompt $"\
-                       { pass "forward-search" }
-       -re ".*$prompt $"       { fail "reverse-search" }
-       timeout         { fail "(timeout) reverse-search" }
-       }
-
-
+gdb_test "reverse-search" "No previous regular expression.*|There is no previous regular expression.*" "reverse-search"
 #test step "s" abbreviation
 setup_xfail "a29k-*-udi"
-send "s\n"
-expect {
-       -re "The program is not being run..*$prompt $"\
-                       { pass "step \"s\" abbreviation" }
-       -re ".*$prompt $"       { fail "step \"s\" abbreviation" }
-       timeout         { fail "(timeout) step \"s\" abbreviation" }
-       }
-
-
+gdb_test "s" "The program is not being run." "step \"s\" abbreviation"
 #test step
 setup_xfail "a29k-*-udi"
-send "step\n"
-expect {
-       -re "The program is not being run..*$prompt $"\
-                       { pass "step" }
-       -re ".*$prompt $"       { fail "step" }
-       timeout         { fail "(timeout) step" }
-       }
-
-
+gdb_test "step" "The program is not being run." "step"
 #test search
-send "search\n"
-expect {
-       -re "No previous regular expression.*$prompt $"\
-                       { pass "search" }
-       -re "There is no previous regular expression.*$prompt $"\
-                       { pass "forward-search" }
-       -re ".*$prompt $"       { fail "search" }
-       timeout         { fail "(timeout) search" }
-       }
-
-
+gdb_test "search" "No previous regular expression.*|There is no previous regular expression.*" "search"
 #test section
-send "section\n"
-expect {
-       -re "Must specify section name and its virtual address.*$prompt $"\
-                       { pass "section" }
-       -re ".*$prompt $"       { fail "section" }
-       timeout         { fail "(timeout) section" }
-       }
-
-
+gdb_test "section" "Must specify section name and its virtual address.*" "section"
+#test set annotate
+gdb_test "set annotate" "Argument required .integer to set it to.*" "set annotate"
 #test set args
-send "set args\n"
-expect {
-       -re "$prompt $"\
-                       { pass "set args" }
-       timeout         { fail "(timeout) set args" }
-       }
-
-
+gdb_test "set args" "" "set args"
 #test set check "c" abbreviation
-send "set c\n"
-expect {
-       -re "\"set check\" must be followed by the name of a check subcommand..*
-List of set check subcommands:.*
-set check range -- Set range checking.*
-set check type -- Set type checking.*
-Type \"help set check\" followed by set check subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "set check \"c\" abbreviation" }
-       -re ".*$prompt $"       { fail "set check \"c\" abbreviation" }
-       timeout         { fail "(timeout) set check \"c\" abbreviation" }
-       }
-
-
+gdb_test "set c" "\"set check\" must be followed by the name of a check subcommand..*\[\r\n\]+List of set check subcommands:.*\[\r\n\]+set check range -- Set range checking.*\[\r\n\]+set check type -- Set type checking.*\[\r\n\]+Type \"help set check\" followed by set check subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "set check \"c\" abbreviation"
 #test set check "ch" abbreviation
-send "set ch\n"
-expect {
-       -re "\"set check\" must be followed by the name of a check subcommand..*
-List of set check subcommands:.*
-set check range -- Set range checking.*
-set check type -- Set type checking.*
-Type \"help set check\" followed by set check subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "set check \"ch\" abbreviation" }
-       -re ".*$prompt $"       { fail "set check \"ch\" abbreviation" }
-       timeout         { fail "(timeout) set check \"ch\" abbreviation" }
-       }
-
-
+gdb_test "set ch" "\"set check\" must be followed by the name of a check subcommand..*\[\r\n\]+List of set check subcommands:.*\[\r\n\]+set check range -- Set range checking.*\[\r\n\]+set check type -- Set type checking.*\[\r\n\]+Type \"help set check\" followed by set check subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "set check \"ch\" abbreviation"
 #test set check
-send "set check\n"
-expect {
-       -re "\"set check\" must be followed by the name of a check subcommand..*
-List of set check subcommands:.*
-set check range -- Set range checking.*
-set check type -- Set type checking.*
-Type \"help set check\" followed by set check subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "set check" }
-       -re ".*$prompt $"       { fail "set check" }
-       timeout         { fail "(timeout) set check" }
-       }
-
-
+gdb_test "set check" "\"set check\" must be followed by the name of a check subcommand..*\[\r\n\]+List of set check subcommands:.*\[\r\n\]+set check range -- Set range checking.*\[\r\n\]+set check type -- Set type checking.*\[\r\n\]+Type \"help set check\" followed by set check subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "set check"
 #test set check range
-send "set check range\n"
-expect {
-       -re "$prompt $"\
-                       { pass "set check range" }
-       timeout         { fail "(timeout) set check range" }
-       }
-
-
+gdb_test "set check range" "" "set check range"
 #test set check type
-send "set check type\n"
-expect {
-       -re "$prompt $"\
-                       { pass "set check type" }
-       timeout         { fail "(timeout) set check type" }
-       }
-
-
+gdb_test "set check type" "" "set check type"
 #test set complaints
-send "set complaints\n"
-expect {
-       -re "Argument required .integer to set it to.*$prompt $"\
-                       { pass "set complaints" }
-       -re ".*$prompt $"       { fail "set complaints" }
-       timeout         { fail "(timeout) set complaints" }
-       }
-
-
+gdb_test "set complaints" "Argument required .integer to set it to.*" "set complaints"
 #test set confirm
-send "set confirm\n"
-expect {
-       -re "$prompt $"\
-                       { pass "set confirm" }
-       timeout         { fail "(timeout) set confirm" }
-       }
-
-
-#test set editing
-send "set editing\n"
-expect {
-       -re "$prompt $"\
-                       { pass "set editing" }
-       timeout         { fail "(timeout) set editing" }
-       }
-
-
+gdb_test "set confirm" "" "set confirm"
+# Don't test set editing. What if we're talking to a gdb that
+# won't do editing correctly while we're talking to it?
+# gdb_test "set editing" "" "set editing"
 
 #test set environment
-send "set environment\n"
-expect {
-       -re "Argument required .environment variable and value.*$prompt $"\
-                       { pass "set environment" }
-       -re ".*$prompt $"       { fail "set environment" }
-       timeout         { fail "(timeout) set environment" }
-       }
-
-
+gdb_test "set environment" "Argument required .environment variable and value.*" "set environment"
 #test set height
-send "set height\n"
-expect {
-       -re "Argument required .integer to set it to.*$prompt $"\
-                       { pass "set height" }
-       -re ".*$prompt $"       { fail "set height" }
-       timeout         { fail "(timeout) set height" }
-       }
-
-
+gdb_test "set height" "Argument required .integer to set it to.*" "set height"
 #test set history expansion
-send "set history expansion\n"
-expect {
-       -re "$prompt $"\
-                       { pass "set history expansion" }
-       timeout         { fail "(timeout) set history expansion" }
-       }
-
-
+gdb_test "set history expansion" "" "set history expansion"
 #test set history filename
-send "set history filename\n"
-expect {
-       -re "Argument required .filename to set it to.*$prompt $" {
-           pass "set history filename"
-       }
-       -re ".*$prompt $" {
-           fail "set history filename"
-       }
-       timeout {
-           fail "(timeout) set history filename"
-       }
-    }
-
-
+gdb_test "set history filename" "Argument required .filename to set it to.*" "set history filename"
 #test set history save
-send "set history save\n"
-expect {
-       -re "$prompt $"\
-                       { pass "set history save" }
-       timeout         { fail "(timeout) set history save" }
-       }
-
-
+gdb_test "set history save" "" "set history save"
 #test set history size
-send "set history size\n"
-expect {
-       -re "Argument required .integer to set it to.*$prompt $"\
-                       { pass "set history size" }
-       -re ".*$prompt $"       { fail "set history size" }
-       timeout         { fail "(timeout) set history size" }
-       }
-
-
+gdb_test "set history size" "Argument required .integer to set it to.*" "set history size"
 #test set history
-send "set history\n"
-expect {
-       -re "\"set history\" must be followed by the name of a history subcommand..*
-List of set history subcommands:.*
-set history filename -- Set the filename in which to record the command history.*
-set history size -- Set the size of the command history.*
-set history save -- Set saving of the history record on exit.*
-set history expansion -- Set history expansion on command input.*
-Type \"help set history\" followed by set history subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "set history" }
-       -re ".*$prompt $"       { fail "set history" }
-       timeout         { fail "(timeout) set history" }
-       }
-
-
+gdb_test "set history" "\"set history\" must be followed by the name of a history subcommand..*\[\r\n\]+List of set history subcommands:.*\[\r\n\]+set history filename -- Set the filename in which to record the command history.*\[\r\n\]+set history size -- Set the size of the command history.*\[\r\n\]+set history save -- Set saving of the history record on exit.*\[\r\n\]+set history expansion -- Set history expansion on command input.*\[\r\n\]+Type \"help set history\" followed by set history subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "set history"
 #test set language
-send "set language\n"
-expect {
-       -re "The currently understood settings are:.*
-local or auto    Automatic setting based on source file.*
-c                Use the C language.*
-c\[+\]+              Use the C\[+\]+ language.*
-modula-2         Use the Modula-2 language.*$prompt $" {
-           pass "set language"
-        }
-       -re ".*$prompt $" {
-           fail "set language"
-       }
-       timeout {
-           fail "(timeout) set language"
-       }
-       }
-
-
+gdb_test "set language" "The currently understood settings are:.*\[\r\n\]+local or auto  *Automatic setting based on source file.*\[\r\n\]+c  *Use the C language.*\[\r\n\]+c\[+\]+  *Use the C\[+\]+ language.*\[\r\n\]+modula-2  *Use the Modula-2 language.*" "set language"
 #test set listsize
-send "set listsize\n"
-expect {
-       -re "Argument required .integer to set it to.*$prompt $" {
-           pass "set listsize"
-       }
-       -re ".*$prompt $"       { fail "set listsize" }
-       timeout         { fail "(timeout) set listsize" }
-       }
-
-
+gdb_test "set listsize" "Argument required .integer to set it to.*" "set listsize"
 #test set print "p" abbreviation
-send "set p\n"
-expect {
-       -re "\"set print\" must be followed by the name of a print subcommand..*
-List of set print subcommands:.*
-Type \"help set print\" followed by set print subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $" {
-            pass "set print \"p\" abbreviation"
-        }
-       -re ".*$prompt $"       { fail "set print \"p\" abbreviation" }
-       timeout         { fail "(timeout) set print \"p\" abbreviation" }
-       }
-
-
+gdb_test "set p" "\"set print\" must be followed by the name of a print subcommand..*\[\r\n\]+List of set print subcommands:.*\[\r\n\]+Type \"help set print\" followed by set print subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "set print \"p\" abbreviation"
 #test set print "pr" abbreviation
-send "set pr\n"
-expect {
-       -re "\"set print\" must be followed by the name of a print subcommand..*
-List of set print subcommands:.*
-Type \"help set print\" followed by set print subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $" {
-            pass "set print \"pr\" abbreviation"
-       }
-       -re ".*$prompt $"       { fail "set print \"pr\" abbreviation" }
-       timeout         { fail "(timeout) set print \"pr\" abbreviation" }
-       }
-
-
+gdb_test "set pr" "\"set print\" must be followed by the name of a print subcommand..*\[\r\n\]+List of set print subcommands:.*\[\r\n\]+Type \"help set print\" followed by set print subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "set print \"pr\" abbreviation"
 #test set print
-send "set print\n"
-expect {
-       -re "\"set print\" must be followed by the name of a print subcommand..*
-List of set print subcommands:.*
-Type \"help set print\" followed by set print subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $" {
-            pass "set print"
-        }
-       -re ".*$prompt $"       { fail "set print" }
-       timeout         { fail "(timeout) set print" }
-       }
-
-
+gdb_test "set print" "\"set print\" must be followed by the name of a print subcommand..*\[\r\n\]+List of set print subcommands:.*\[\r\n\]+Type \"help set print\" followed by set print subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "set print"
 #test set print address
-send "set print address\n"
-expect {
-       -re "$prompt $"\
-                       { pass "set print address" }
-       timeout         { fail "(timeout) set print address" }
-       }
-
-
+gdb_test "set print address" "" "set print address"
 #test set print array
-send "set print array\n"
-expect {
-       -re "$prompt $"\
-                       { pass "set print array" }
-       timeout         { fail "(timeout) set print array" }
-       }
-
-
+gdb_test "set print array" "" "set print array"
 #test set print asm-demangle
-send "set print asm-demangle\n"
-expect {
-       -re "$prompt $"\
-                       { pass "set print asm-demangle" }
-       timeout         { fail "(timeout) set print asm-demangle" }
-       }
-
-
+gdb_test "set print asm-demangle" "" "set print asm-demangle"
 #test set print demangle
-send "set print demangle\n"
-expect {
-       -re "$prompt $"\
-                       { pass "set print demangle" }
-       timeout         { fail "(timeout) set print demangle" }
-       }
-
-
+gdb_test "set print demangle" "" "set print demangle"
 #test set print elements
-send "set print elements\n"
-expect {
-       -re "Argument required .integer to set it to.*$prompt $"\
-                       { pass "set print elements" }
-       -re ".*$prompt $"       { fail "set print elements" }
-       timeout         { fail "(timeout) set print elements" }
-       }
-
-
+gdb_test "set print elements" "Argument required .integer to set it to.*" "set print elements"
 #test set print object
-send "set print object\n"
-expect {
-       -re "$prompt $"\
-                       { pass "set print object" }
-       timeout         { fail "(timeout) set print object" }
-       }
-
-
+gdb_test "set print object" "" "set print object"
 #test set print pretty
-send "set print pretty\n"
-expect {
-       -re "$prompt $"\
-                       { pass "set print pretty" }
-       timeout         { fail "(timeout) set print pretty" }
-       }
-
-
+gdb_test "set print pretty" "" "set print pretty"
 #test set print sevenbit-strings
-send "set print sevenbit-strings\n"
-expect {
-       -re "$prompt $"\
-                       { pass "set print sevenbit-strings" }
-       timeout         { fail "(timeout) set print sevenbit-strings" }
-       }
-
-
+gdb_test "set print sevenbit-strings" "" "set print sevenbit-strings"
 #test set print union
-send "set print union\n"
-expect {
-       -re "$prompt $"\
-                       { pass "set print union" }
-       timeout         { fail "(timeout) set print union" }
-       }
-
-
+gdb_test "set print union" "" "set print union"
 #test set print vtbl
-send "set print vtbl\n"
-expect {
-       -re "$prompt $"\
-                       { pass "set print vtbl" }
-       timeout         { fail "(timeout) set print vtbl" }
-       }
-
-
+gdb_test "set print vtbl" "" "set print vtbl"
 # FIXME -- need a test for "set prompt"
 #test set radix
-send "set radix\n"
-expect {
-       -re "Input and output radices now set to decimal 10, hex a, octal 12.*$prompt $"\
-                       { pass "set radix" }
-       -re "Argument required .integer to set it to.*$prompt $"\
-                       { fail "set radix (obsolete radix support)" }
-       -re ".*$prompt $"       { fail "set radix" }
-       timeout         { fail "(timeout) set radix" }
-       }
-
-
+gdb_test "set radix" "Input and output radices now set to decimal 10, hex a, octal 12.*" "set radix"
 #test set symbol-reloading
-send "set symbol-reloading\n"
-expect {
-       -re "$prompt $"\
-                       { pass "set symbol-reloading" }
-       timeout         { fail "(timeout) set symbol-reloading" }
-       }
-
-
+gdb_test "set symbol-reloading" "" "set symbol-reloading"
 #test set variable
-send "set variable\n"
-expect {
-       -re "Argument required .expression to compute.*$prompt $"\
-                       { pass "set variable" }
-       -re ".*$prompt $"       { fail "set variable" }
-       timeout         { fail "(timeout) set variable" }
-       }
-
-
+gdb_test "set variable" "Argument required .expression to compute.*" "set variable"
 #test set verbose
-send "set verbose\n"
-expect {
-       -re "$prompt $"\
-                       { pass "set verbose" }
-       timeout         { fail "(timeout) set verbose" }
-       }
-
-
+gdb_test "set verbose" "" "set verbose"
 #test set width
-send "set width\n"
-expect {
-       -re "Argument required .integer to set it to.*$prompt $"\
-                       { pass "set width" }
-       -re ".*$prompt $"       { fail "set width" }
-       timeout         { fail "(timeout) set width" }
-       }
-
-
+gdb_test "set width" "Argument required .integer to set it to.*" "set width"
 #test set write
 # This is only supported on targets which use exec.o.
-if ![istarget "rs6000-*-*"] then {
-    send "set write\n"
-    expect {
-       -re "set write\[\r\n\]*$prompt $"\
-                       { pass "set write" }
-       -re "$prompt $" { fail "set write" }
-       timeout         { fail "(timeout) set write" }
-       }
-    gdb_test "set write off" ""
-}
-
+gdb_test "set write" "" "set write"
 #test set
-send "set\n"
-expect {
-       -re "Argument required .expression to compute.*$prompt $"\
-                       { pass "set" }
-       -re ".*$prompt $"       { fail "set" }
-       timeout         { fail "(timeout) set" }
-       }
-
-
+gdb_test "set" "Argument required .expression to compute.*" "set"
 #test shell echo Hi dad!
-send "shell echo Hi dad!\n"
-expect {
-       -re "Hi dad!.*$prompt $"\
-                       { pass "shell echo Hi dad!" }
-       -re ".*$prompt $"       { fail "shell echo Hi dad!" }
-       timeout         { fail "(timeout) shell echo Hi dad!" }
-       }
-
-
+gdb_test "shell echo Hi dad!" "Hi dad!" "shell echo Hi dad!"
+#test show annotate
+gdb_test "show annotate" "Annotation_level is 0."       "show annotate"
 #test show args
-send "show args\n"
-expect {
-       -re "Arguments to give program being debugged when it is started is \"\"..*$prompt $"\
-                       { pass "show args" }
-       -re ".*$prompt $"       { fail "show args" }
-       timeout         { fail "(timeout) show args" }
-       }
-
-
+gdb_test "show args" "Arguments to give program being debugged when it is started is \"\"." "show args"
 #test show check "c" abbreviation
-send "show c\n"
-expect {
-       -re "range:  Range checking is \"auto; currently off\"..*
-type:  Type checking is \"auto; currently off\"..*$prompt $"\
-                       { pass "show check \"c\" abbreviation" }
-       -re ".*$prompt $"       { fail "show check \"c\" abbreviation" }
-       timeout         { fail "(timeout) show check \"c\" abbreviation" }
-       }
-
-
+gdb_test "show c" "range:  *Range checking is \"auto; currently off\"..*\[\r\n\]+type:  *Type checking is \"auto; currently off\".*" "show check \"c\" abbreviation"
 #test show check "ch" abbreviation
-send "show ch\n"
-expect {
-       -re "range:  Range checking is \"auto; currently off\"..*
-type:  Type checking is \"auto; currently off\"..*$prompt $"\
-                       { pass "show check \"ch\" abbreviation" }
-       -re ".*$prompt $"       { fail "show check \"ch\" abbreviation" }
-       timeout         { fail "(timeout) show check \"ch\" abbreviation" }
-       }
-
-
+gdb_test "show ch" "range: *Range checking is \"auto; currently off\"..*\[\r\n\]+type:  *Type checking is \"auto; currently off\"." "show check \"ch\" abbreviation"
 #test show check
-send "show check\n"
-expect {
-       -re "range:  Range checking is \"auto; currently off\"..*
-type:  Type checking is \"auto; currently off\"..*$prompt $"\
-                       { pass "show check" }
-       -re ".*$prompt $"       { fail "show check" }
-       timeout         { fail "(timeout) show check" }
-       }
-
-
+gdb_test "show check" "range:  *Range checking is \"auto; currently off\"..*\[\r\n\]+type:  *Type checking is \"auto; currently off\"." "show check"
 #test show check range
-send "show check range\n"
-expect {
-       -re "Range checking is \"auto; currently off\"..*$prompt $"\
-                       { pass "show check range" }
-       -re ".*$prompt $"       { fail "show check range" }
-       timeout         { fail "(timeout) show check range" }
-       }
-
-
+gdb_test "show check range" "Range checking is \"auto; currently off\"." "show check range"
 #test show check type
-send "show check type\n"
-expect {
-       -re "Type checking is \"auto; currently off\"..*$prompt $"\
-                       { pass "show check type" }
-       -re ".*$prompt $"       { fail "show check type" }
-       timeout         { fail "(timeout) show check type" }
-       }
-
-
+gdb_test "show check type" "Type checking is \"auto; currently off\"." "show check type"
 #test show commands
-send "show commands\n"
-expect {
-       -re "$prompt $"\
-                       { pass "show commands" }
-       timeout         { fail "(timeout) show commands" }
-       }
-
-
+gdb_test "show commands" "" "show commands"
 #test show complaints
-send "show complaints\n"
-expect {
-       -re "Max number of complaints about incorrect symbols is 0..*$prompt $"\
-                       { pass "show complaints" }
-       -re ".*$prompt $"       { fail "show complaints" }
-       timeout         { fail "(timeout) show complaints" }
-       }
-
-
+gdb_test "show complaints" "Max number of complaints about incorrect symbols is 0." "show complaints"
 #test show confirm
-send "show confirm\n"
-expect {
-       -re "Whether to confirm potentially dangerous operations is on..*$prompt $"\
-                       { pass "show confirm" }
-       -re ".*$prompt $"       { fail "show confirm" }
-       timeout         { fail "(timeout) show confirm" }
-       }
-
-
+gdb_test "show confirm" "Whether to confirm potentially dangerous operations is o\[a-z\]*." "show confirm"
 #test show convenience
-send "show convenience\n"
-expect {
-       -re "No debugger convenience variables now defined..*
-Convenience variables have names starting with \".\";.*
-use \"set\" as in \"set .foo = 5\" to define them..*$prompt $"\
-                       { pass "show convenience" }
-       -re ".*$prompt $"       { fail "show convenience" }
-       timeout         { fail "(timeout) show convenience" }
-       }
-
-
+gdb_test "show convenience" "No debugger convenience variables now defined..*\[\r\n\]+Convenience variables have names starting with \".\";.*\[\r\n\]+use \"set\" as in \"set .foo = 5\" to define them." "show convenience"
 #test show directories
-send "show directories\n"
-expect {
-       -re "Source directories searched: .cdir:.cwd.*$prompt $"\
-                       { pass "show directories" }
-       -re ".*$prompt $"       { fail "show directories" }
-       timeout         { fail "(timeout) show directories" }
-       }
-
-
+gdb_test "show directories" "Source directories searched: .cdir:.cwd" "show directories"
 #test show editing
-send "show editing\n"
-expect {
-       -re "Editing of command lines as they are typed is on..*$prompt $"\
-                       { pass "show editing" }
-       -re ".*$prompt $"       { fail "show editing" }
-       timeout         { fail "(timeout) show editing" }
-       }
-
-
+gdb_test "show editing" "Editing of command lines as they are typed is o\[a-z\]*." "show editing"
 #test show height
-send "show height\n"
-expect {
-       -re "Number of lines gdb thinks are in a page is.*$prompt $"\
-                       { pass "show height" }
-       -re ".*$prompt $"       { fail "show height" }
-       timeout         { fail "(timeout) show height" }
-       }
-
-
+gdb_test "show height" "Number of lines gdb thinks are in a page is.*" "show height"
 #test show history expansion
-send "show history expansion\n"
-expect {
-       -re "History expansion on command input is on.*$prompt $"\
-                       { pass "show history expansion" }
-       -re ".*$prompt $"       { fail "show history expansion" }
-       timeout         { fail "(timeout) show history expansion" }
-       }
-
-
+gdb_test "show history expansion" "History expansion on command input is o\[a-z\]*.*" "show history expansion"
 #test show history filename
-send "show history filename\n"
-expect {
-       -re "The filename in which to record the command history is.*.gdb_history.*$prompt $" { pass "show history filename" }
-       -re ".*$prompt $"       { fail "show history filename" }
-       timeout         { fail "(timeout) show history filename" }
-       }
-
-
+gdb_test "show history filename" "The filename in which to record the command history is.*.gdb_history.*" "show history filename"
 #test show history save
-send "show history save\n"
-expect {
-       -re "Saving of the history record on exit is on..*$prompt $" {
-           pass "show history save"
-       }
-       -re ".*$prompt $"       { fail "show history save" }
-       timeout         { fail "(timeout) show history save" }
-       }
-
-
+gdb_test "show history save" "Saving of the history record on exit is on." "show history save"
 #test show history size
-send "show history size\n"
-expect {
-       -re "The size of the command history is.*$prompt $"\
-                       { pass "show history size" }
-       -re ".*$prompt $"       { fail "show history size" }
-       timeout         { fail "(timeout) show history size" }
-       }
-
-
+gdb_test "show history size" "The size of the command history is.*" "show history size"
 #test show history
-send "show history\n"
-expect {
-       -re "filename:  The filename in which to record the command history is.*.gdb_history.*
-size:  The size of the command history is.*
-save:  Saving of the history record on exit is o.*
-expansion:  History expansion on command input is o.*$prompt $"
-                       { pass "show history" }
-       -re ".*$prompt $"       { fail "show history" }
-       timeout         { fail "(timeout) show history" }
-       }
-
-
+gdb_test "show history" "filename:  *The filename in which to record the command history is.*.gdb_history.*\[\r\n\]+size: * The size of the command history is.*\[\r\n\]+save: *Saving of the history record on exit is o.*\[\r\n\]+expansion:  *History expansion on command input is o.*" "show history"
 #test show language
-send "show language\n"
-expect {
-       -re "The current source language is \"auto; currently c\"..*$prompt $"\
-                       { pass "show language" }
-       -re ".*$prompt $"       { fail "show language" }
-       timeout         { fail "(timeout) show language" }
-       }
-
-
+gdb_test "show language" "The current source language is \"auto; currently c\"." "show language"
 #test show listsize
-send "show listsize\n"
-expect {
-       -re "Number of source lines gdb will list by default is 10..*$prompt $"\
-                       { pass "show listsize" }
-       -re ".*$prompt $"       { fail "show listsize" }
-       timeout         { fail "(timeout) show listsize" }
-       }
-
-
+gdb_test "show listsize" "Number of source lines gdb will list by default is 10." "show listsize"
 #test show print "p" abbreviation
-send "show p\n"
-expect {
-       -re ".*$prompt $"\
-                       { pass "show print \"p\" abbreviation" }
-       timeout         { fail "(timeout) show print \"p\" abbreviation" }
-       }
-
-
+gdb_test "show p" ".*" "show p"
 #test show print "pr" abbreviation
-send "show pr\n"
-expect {
-       -re ".*$prompt $"\
-                       { pass "show print \"pr\" abbreviation" }
-       timeout         { fail "(timeout) show print \"pr\" abbreviation" }
-       }
-
-
-
+gdb_test "show pr" ".*" "show pr"
 #test show print
-send "show print\n"
-expect {
-       -re ".*$prompt $"\
-                       { pass "show print" }
-       timeout         { fail "(timeout) show print" }
-       }
-
-
+gdb_test "show print" "" "show print"
 #test show paths
-send "show paths\n"
-expect {
-       -re "Executable and object file path:.*$prompt $"\
-                       { pass "show paths" }
-       -re ".*$prompt $"       { fail "show paths" }
-       timeout         { fail "(timeout) show paths" }
-       }
-
-
+gdb_test "show paths" "Executable and object file path:.*" "show paths"
 #test show print address
-send "show print address\n"
-expect {
-       -re "Printing of addresses is on..*$prompt $"\
-                       { pass "show print address" }
-       -re ".*$prompt $"       { fail "show print address" }
-       timeout         { fail "(timeout) show print address" }
-       }
-
-
+gdb_test "show print address" "Printing of addresses is on." "show print address"
 #test show print array
-send "show print array\n"
-expect {
-       -re "Prettyprinting of arrays is on..*$prompt $"\
-                       { pass "show print array" }
-       -re ".*$prompt $"       { fail "show print array" }
-       timeout         { fail "(timeout) show print array" }
-       }
-
-
+gdb_test "show print array" "Prettyprinting of arrays is on." "show print array"
 #test show print asm-demangle
-send "show print asm-demangle\n"
-expect {
-       -re "Demangling of C\[+\]+ names in disassembly listings is on..*$prompt $"\
-                       { pass "show print asm-demangle" }
-       -re ".*$prompt $"       { fail "show print asm-demangle" }
-       timeout         { fail "(timeout) show print asm-demangle" }
-       }
-
-
+gdb_test "show print asm-demangle" "Demangling of C\[+\]+ names in disassembly listings is on." "show print asm-demangle"
 #test show print demangle
-send "show print demangle\n"
-expect {
-       -re "Demangling of encoded C\[+\]+ names when displaying symbols is on..*$prompt $"\
-                       { pass "show print demangle" }
-       -re ".*$prompt $"       { fail "show print demangle" }
-       timeout         { fail "(timeout) show print demangle" }
-       }
-
-
+gdb_test "show print demangle" "Demangling of encoded C\[+\]+ names when displaying symbols is on." "show print demangle"
 #test show print elements
-send "show print elements\n"
-expect {
-       -re "Limit on string chars or array elements to print is 200..*$prompt $"\
-                       { pass "show print elements" }
-       -re ".*$prompt $"       { fail "show print elements" }
-       timeout         { fail "(timeout) show print elements" }
-       }
-
-
+gdb_test "show print elements" "Limit on string chars or array elements to print is 200." "show print elements"
 #test show print object
-send "show print object\n"
-expect {
-       -re "Printing of object's derived type based on vtable info is on..*$prompt $"\
-                       { pass "show print object" }
-       -re ".*$prompt $"       { fail "show print object" }
-       timeout         { fail "(timeout) show print object" }
-       }
-
-
+gdb_test "show print object" "Printing of object's derived type based on vtable info is on." "show print object"
 #test show print pretty
-send "show print pretty\n"
-expect {
-       -re "Prettyprinting of structures is on..*$prompt $"\
-                       { pass "show print pretty" }
-       -re ".*$prompt $"       { fail "show print pretty" }
-       timeout         { fail "(timeout) show print pretty" }
-       }
-
-
+gdb_test "show print pretty" "Prettyprinting of structures is on." "show print pretty"
 #test show print sevenbit-strings
-send "show print sevenbit-strings\n"
-expect {
-       -re "Printing of 8-bit characters in strings as .nnn is on..*$prompt $"\
-                       { pass "show print sevenbit-strings" }
-       -re ".*$prompt $"       { fail "show print sevenbit-strings" }
-       timeout         { fail "(timeout) show print sevenbit-strings" }
-       }
-
-
+gdb_test "show print sevenbit-strings" "Printing of 8-bit characters in strings as .nnn is on." "show print sevenbit-strings"
 #test show print union
-send "show print union\n"
-expect {
-       -re "Printing of unions interior to structures is on..*$prompt $"\
-                       { pass "show print union" }
-       -re ".*$prompt $"       { fail "show print union" }
-       timeout         { fail "(timeout) show print union" }
-       }
-
-
+gdb_test "show print union" "Printing of unions interior to structures is on." "show print union"
 #test show print vtbl
-send "show print vtbl\n"
-expect {
-       -re "Printing of C\[+\]+ virtual function tables is on..*$prompt $"\
-                       { pass "show print vtbl" }
-       -re ".*$prompt $"       { fail "show print vtbl" }
-       timeout         { fail "(timeout) show print vtbl" }
-       }
-
-
+gdb_test "show print vtbl" "Printing of C\[+\]+ virtual function tables is on." "show print vtbl"
 #test show prompt
 # In the FAIL case, can't just look for $prompt because that will match
-# the output, rather than the prompt.  So look for $prompt at the start
+# the output, rather than the prompt. So look for $prompt at the start
 # of a line.
-send "show prompt\n"
-expect {
-       -re "Gdb's prompt is \"$prompt \".*$prompt $"\
-                       { pass "show prompt" }
-       -re ".*\r\n$prompt $"   { fail "show prompt" }
-       timeout         { fail "(timeout) show prompt" }
-       }
-
-
+gdb_test "show prompt" "Gdb's prompt is \"$prompt \".*" "show prompt"
 #test show radix
-send "show radix\n"
-expect {
-        -re "Input and output radices set to decimal 10, hex a, octal 12..*$prompt $"\
-                       { pass "show radix" }
-       -re "Default input and output number radix is 10..*$prompt $"\
-                       { fail "show radix (obsolete radix support)" }
-       -re ".*$prompt $"       { fail "show radix" }
-       timeout         { fail "(timeout) show radix" }
-       }
-
-
+gdb_test "show radix" "Input and output radices set to decimal 10, hex a, octal 12." "show radix"
 #test show symbol-reloading
-send "show symbol-reloading\n"
-expect {
-       -re "Dynamic symbol table reloading multiple times in one run is on..*$prompt $"\
-                       { pass "show symbol-reloading" }
-       -re ".*$prompt $"       { fail "show symbol-reloading" }
-       timeout         { fail "(timeout) show symbol-reloading" }
-       }
-
-
+gdb_test "show symbol-reloading" "Dynamic symbol table reloading multiple times in one run is on." "show symbol-reloading"
 #test show user
-send "show user\n"
-expect {
-       -re "$prompt $"\
-                       { pass "show user" }
-       timeout         { fail "(timeout) show user" }
-       }
-
-
+gdb_test "show user" "" "show user"
 #test show values
-send "show values\n"
-expect {
-       -re "$prompt $"\
-                       { pass "show values" }
-       timeout         { fail "(timeout) show values" }
-       }
-
-
+gdb_test "show values" "" "show values"
 #test show verbose
-send "show verbose\n"
-expect {
-       -re "Verbose printing of informational messages is on..*$prompt $"\
-                       { pass "show verbose" }
-       -re ".*$prompt $"       { fail "show verbose" }
-       timeout         { fail "(timeout) show verbose" }
-       }
-
-
+gdb_test "show verbose" "Verbose printing of informational messages is o.*|Verbosity is off.*" "show verbose"
 #test show version
-send "show version\n"
-expect {
-       -re "GDB is free software and you are welcome to distribute copies of it.*
- under certain conditions; type \"show copying\" to see the conditions..*
-There is absolutely no warranty for GDB; type \"show warranty\" for details..*
-GDB.*Copyright \[0-9\]* Free Software Foundation, Inc..*$prompt $"\
-                       { pass "show version" }
-       -re ".*$prompt $"       { fail "show version" }
-       timeout         { fail "(timeout) show version" }
-       }
-
 
+gdb_test "show version" "GNU gdb \[0-9\.\]*.*\[\r\n\]+Copyright \[0-9\]* Free Software Foundation, Inc.*\[\r\n\]+GDB is free software, covered by the GNU General Public License, and you are.*\[\r\n\]+welcome to change it and/or distribute copies of it under certain conditions.*\[\r\n\]+Type \"show copying\" to see the conditions.*\[\r\n\]+There is absolutely no warranty for GDB.  Type \"show warranty\" for details.*\[\r\n\]+This GDB was configured as .*|GDB is free software and you are welcome to distribute copies of it.*\[\r\n\]+ under certain conditions; type \"show copying\" to see the conditions..*\[\r\n\]+There is absolutely no warranty for GDB; type \"show warranty\" for details..*\[\r\n\]+GDB.*Copyright \[0-9\]* Free Software Foundation, Inc.*" "show version"
 #test show width
-send "show width\n"
-expect {
-       -re "Number of characters gdb thinks are in a line is.*$prompt $"\
-                       { pass "show width" }
-       -re ".*$prompt $"       { fail "show width" }
-       timeout         { fail "(timeout) show width" }
-       }
-
-
+gdb_test "show width" "Number of characters gdb thinks are in a line is.*" "show width"
 #test show write
 # This is only supported on targets which use exec.o.
-if ![istarget "rs6000-*-*"] then {
-    send "show write\n"
-    expect {
-       -re "Writing into executable and core files is off..*$prompt $"\
-                       { pass "show write" }
-       -re ".*$prompt $"       { fail "show write" }
-       timeout         { fail "(timeout) show write" }
-       }
-}
-
+gdb_test "show write" "Writing into executable and core files is o.*" "show write"
 #test show
-send "show\n"
-expect {
-       -re "confirm:  Whether to confirm potentially dangerous operations is on..*
-history filename:  The filename in which to record the command history is .*
-history size:  The size of the command history is.*
-history save:  Saving of the history record on exit is on..*
-print elements:  Limit on string chars or array elements to print is 200..*
-listsize:  Number of source lines gdb will list by default is 10.*$prompt $"\
-                       { pass "show" }
-       -re "\n$prompt $"       { fail "show" }
-       timeout         { fail "(timeout) show" }
-       }
-
-
+gdb_test "show" "confirm:  *Whether to confirm potentially dangerous operations is on..*\[\r\n\]+history filename:  *The filename in which to record the command history is .*\[\r\n\]+history size:  *The size of the command history is.*\[\r\n\]+history save:  *Saving of the history record on exit is on..*\[\r\n\]+print elements:  *Limit on string chars or array elements to print is 200..*\[\r\n\]+listsize:  *Number of source lines gdb will list by default is 10.*" "show"
 #test stepi "si" abbreviation
 setup_xfail "a29k-*-udi"
-send "si\n"
-expect {
-       -re "The program is not being run..*$prompt $"\
-                       { pass "stepi \"si\" abbreviation" }
-       -re ".*$prompt $"       { fail "stepi \"si\" abbreviation" }
-       timeout         { fail "(timeout) stepi \"si\" abbreviation" }
-       }
-
-
+gdb_test  "si" "The program is not being run." "stepi \"si\" abbreviation"
 #test stepi
 setup_xfail "a29k-*-udi"
-send "stepi\n"
-expect {
-       -re "The program is not being run..*$prompt $"\
-                       { pass "stepi" }
-       -re ".*$prompt $"       { fail "stepi" }
-       timeout         { fail "(timeout) stepi" }
-       }
-
-
+gdb_test "stepi" "The program is not being run." "stepi"
 #test signal
 setup_xfail "a29k-*-udi"
-send "signal\n"
-expect {
-       -re "The program is not being run..*$prompt $"\
-                       { pass "signal" }
-       -re ".*$prompt $"       { fail "signal" }
-       timeout         { fail "(timeout) signal" }
-       }
-
-
+gdb_test "signal" "The program is not being run." "signal"
 #test source
-send "source\n"
-expect {
-       -re "source command requires pathname of file to source..*$prompt"
-                       { pass "source" }
-       -re "No such file or directory.*$prompt $" { pass "source" }
-       -re ".*$prompt $"       { fail "source" }
-       timeout         { fail "(timeout) source" }
-       }
-
+gdb_test "source" "source command requires pathname of file to source..*|No such file or directory.*" "source"
 #test step "s" abbreviation
 setup_xfail "a29k-*-udi"
-send "s\n"
-expect {
-       -re "The program is not being run..*$prompt $"\
-                       { pass "step \"s\" abbreviation" }
-       -re ".*$prompt $"       { fail "step \"s\" abbreviation" }
-       timeout         { fail "(timeout) step \"s\" abbreviation" }
-       }
-
-
+gdb_test "s" "The program is not being run." "step \"s\" abbreviation"
 #test step
 setup_xfail "a29k-*-udi"
-send "step\n"
-expect {
-       -re "The program is not being run..*$prompt $"\
-                       { pass "step" }
-       -re ".*$prompt $"       { fail "step" }
-       timeout         { fail "(timeout) step" }
-       }
-
-
+gdb_test "step" "The program is not being run." "step"
 #test symbol-file
-send "symbol-file\n"
-expect {
-       -re "$prompt $"\
-                       { pass "symbol-file" }
-       timeout         { fail "(timeout) symbol-file" }
-       }
-
+gdb_test "symbol-file" "" "symbol-file"
 
 #test target child
-send "target child\n"
-expect {
-       -re "Use the \"run\" command to start a Unix child process..*$prompt $"\
-           { pass "target child (non-procfs version)" }
-       -re "Undefined target command: \"child\".  Try \"help target\"..*$prompt $"\
-           { pass "target child (procfs version)" }
-       
-       -re ".*$prompt $"       { fail "target child" }
-       timeout         { fail "(timeout) target child" }
-       }
-
+gdb_test "target child" "Use the \"run\" command to start a Unix child process.*|Undefined target command: \"child\".  *Try \"help target\".*" "target child"
 
 #test target procfs
-send "target procfs\n"
-expect {
-       -re "Use the \"run\" command to start a Unix child process..*$prompt $"\
-           { pass "target procfs (procfs version)" }
-       -re "Undefined target command: \"procfs\".  Try \"help target\"..*$prompt $"\
-           { pass "target procfs (non-procfs version)" }
-       
-       -re ".*$prompt $"       { fail "target procfs" }
-       timeout         { fail "(timeout) target procfs" }
-       }
-
+gdb_test "target procfs" "Use the \"run\" command to start a Unix child process.*|Undefined target command: \"procfs\".  *Try \"help target\".*" "target procfs"
 
 #test target core
-send "target core\n"
+send_gdb "target core\n"
 expect {
-       -re "No core file specified..*$prompt $"\
-                       { pass "target core" }
-       -re ".*A program is being debugged already.  Kill it. .y or n.*$" {
-           send "n\n"
-           if $verbose>1 then {
-               send_user "\t\tDidn't kill program being debugged\n"
-           }
-           expect -re "$prompt $" { }
-           pass "target core"
-       }
-       -re "Undefined target command: \"core\".  Try \"help target\"..*$prompt $"\
-                       { pass "target core" }
-       -re ".*$prompt $"       { fail "target core" }
-       timeout         { fail "(timeout) target core" }
+    -re "No core file specified..*$prompt $" { pass "target core" }
+    -re ".*A program is being debugged already.  Kill it. .y or n.*$" {
+       send_gdb "n\n"
+       if $verbose>1 then {
+           send_user "\t\tDidn't kill program being debugged\n"
        }
-
+       expect -re "$prompt $" { }
+       pass "target core"
+    }
+    -re "Undefined target command: \"core\".  Try \"help target\"..*$prompt $" { pass "target core" }
+    -re ".*$prompt $"  { fail "target core" }
+    timeout            { fail "(timeout) target core" }
+}
 
 #test target exec
-send "target exec\n"
+send_gdb "target exec\n"
 expect {
        -re "No exec file now..*$prompt $"\
                        { pass "target exec" }
        -re ".*A program is being debugged already.  Kill it. .y or n.*$" {
-           send "n\n"
+           send_gdb "n\n"
            if $verbose>1 then {
                send_user "\t\tDidn't kill program being debugged\n"
            }
@@ -2236,16 +678,15 @@ expect {
        timeout         { fail "(timeout) target exec" }
        }
 
-
 #test target remote
 if ![istarget "*-*-udi*"] then {
-    send "target remote\n"
+    send_gdb "target remote\n"
     expect {
        -re "To open a remote debug connection, you need to specify what serial.*
 device is attached to the remote system .e.g. /dev/ttya.*$prompt $"\
                        { pass "target remote" }
        -re ".*A program is being debugged already.  Kill it. .y or n.*$" {
-           send "n\n"
+           send_gdb "n\n"
            if $verbose>1 then {
                send_user "\t\tDidn't kill program being debugged\n"
            }
@@ -2258,156 +699,62 @@ device is attached to the remote system .e.g. /dev/ttya.*$prompt $"\
 }
 
 #test target
-send "target\n"
-expect {
-       -re "Argument required .target name.*$prompt $"\
-                       { pass "target" }
-       -re ".*$prompt $"       { fail "target" }
-       timeout         { fail "(timeout) target" }
-       }
-
-
+gdb_test "target" "Argument required .target name.*" "target"
 #test tbreak
-send "tbreak\n"
-expect {
-       -re "No default breakpoint address now..*$prompt $"\
-                       { pass "tbreak" }
-       -re ".*$prompt $"       { fail "tbreak" }
-       timeout         { fail "(timeout) tbreak" }
-       }
-
-
+gdb_test "tbreak" "No default breakpoint address now." "tbreak"
 #test tty
-send "tty\n"
-expect {
-       -re "Argument required .terminal name for running target process.*$prompt $"\
-                       { pass "tty" }
-       -re ".*$prompt $"       { fail "tty" }
-       timeout         { fail "(timeout) tty" }
-       }
-
-
+gdb_test "tty" "Argument required .terminal name for running target process.*" "tty"
 #test until "u" abbreviation
 setup_xfail "a29k-*-udi"
-send "u\n"
-expect {
-       -re "The program is not running..*$prompt $"\
-                       { pass "until \"u\" abbreviation" }
-       -re ".*$prompt $"       { fail "until \"u\" abbreviation" }
-       timeout         { fail "(timeout) until \"u\" abbreviation" }
-       }
-
-
+gdb_test "u" "The program is not running." "until \"u\" abbreviation"
 #test until
 setup_xfail "a29k-*-udi"
-send "until\n"
-expect {
-       -re "The program is not running..*$prompt $"\
-                       { pass "until" }
-       -re ".*$prompt $"       { fail "until" }
-       timeout         { fail "(timeout) until" }
-       }
-
-
+gdb_test "until" "The program is not running." "until"
 #test undisplay
 # FIXME -- need to dump full output to detailed log
-send "undisplay\n"
+send_gdb "undisplay\n"
 expect {
-       -re "Delete all auto-display expressions.*y or n. $"\
-           { send "y\n"
-               expect {
-                   -re "$prompt $"\
-                       { pass "undisplay prompt" }
-                   timeout             { fail "(timeout) (timeout) undisplay prompt" }
-                   }
-               }
-       timeout         { fail "(timeout) (timeout) undisplay prompt" }
+    -re "Delete all auto-display expressions.*y or n. $" {
+       send_gdb "y\n"
+       expect {
+           -re "$prompt $" { pass "undisplay prompt" }
+           timeout { fail "(timeout) (timeout) undisplay prompt"    }
        }
-
+    }
+    timeout            { fail "(timeout) (timeout) undisplay prompt" }
+}
 
 #test unset environment
-send "unset environment\n"
-expect {
-       -re "Delete all environment variables?.*y or n. $"\
-           { send "y\n"
-               expect {
-                   -re "$prompt $"\
-                       { pass "unset environmentprompt" }
-                   timeout             { fail "(timeout) (timeout) unset environment prompt" }
-                   }
-               }
-       timeout         { fail "(timeout) (timeout) unset environment prompt" }
+send_gdb "unset environment\n"
+expect {
+    -re "Delete all environment variables?.*y or n. $" { 
+       send_gdb "y\n"
+       expect {
+           -re "$prompt $" { pass "unset environmentprompt" }
+           timeout {
+               fail "(timeout) (timeout) unset environment prompt"
+           }
        }
-
-
+    }
+    timeout { 
+       fail "(timeout) (timeout) unset environment prompt"
+    }
+}
 
 #test unset
-send "unset\n"
-expect {
-       -re "\"unset\" must be followed by the name of an unset subcommand..*
-List of unset subcommands:.*
-unset environment -- Cancel environment variable VAR for the program.*
-Type \"help unset\" followed by unset subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "unset" }
-       -re ".*$prompt $"       { fail "unset" }
-       timeout         { fail "(timeout) unset" }
-       }
-
-
+gdb_test "unset" "\"unset\" must be followed by the name of an unset subcommand..*\[\r\n\]+List of unset subcommands:.*\[\r\n\]+unset environment -- Cancel environment variable VAR for the program.*\[\r\n\]+Type \"help unset\" followed by unset subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "unset"
 #test up
-gdb_test "up" "No stack\\." "up in default.exp"
-
 #test up-silently
-send "up-silently\n"
-expect {
-       -re "No stack..*$prompt $"\
-                       { pass "up-silently" }
-       -re ".*$prompt $"       { fail "up-silently" }
-       timeout         { fail "(timeout) up-silently" }
-       }
-
-
+gdb_test "up-silently" "No stack." "up-silently"
 #test watch
-send "watch\n"
-expect {
-       -re "Argument required .expression to compute.*$prompt $"\
-                       { pass "watch" }
-       -re ".*$prompt $"       { fail "watch" }
-       timeout         { fail "(timeout) watch" }
-       }
-
-
+gdb_test "watch" "Argument required .expression to compute.*" "watch"
 #test whatis
-send "whatis\n"
-expect {
-       -re "The history is empty..*$prompt $"\
-                       { pass "whatis" }
-       -re ".*$prompt $"       { fail "whatis" }
-       timeout         { fail "(timeout) whatis" }
-       }
-
-
+gdb_test "whatis" "The history is empty." "whatis"
 #test where
 setup_xfail "a29k-*-udi"
-send "where\n"
-expect {
-       -re "No stack..*$prompt $"\
-                       { pass "where" }
-       -re ".*$prompt $"       { fail "where" }
-       timeout         { fail "(timeout) where" }
-       }
-
-
+gdb_test "where" "No stack." "where"
 #test x
 #The case in which it prints a number is for vxgdb.
-send "x\n"
-expect {
-       -re "0x0:.*Cannot access memory at address 0x0..*$prompt $"\
-                       { pass "x" }
-       -re "0x0:.*0x\[0-9\]*.*$prompt $"\
-                       { pass "x" }
-       -re ".*$prompt $"       { fail "x" }
-       timeout         { fail "(timeout) x" }
-       }
+gdb_test "x" "0x0:.*0x\[0-9\]*|0x0:.*Cannot access memory at address 0x0." "x"
 
+gdb_exit
index fcf7c2a04f3f94ea2959f2e9f9713b685986855d..b49e6d6344b1034da41b56c4fd2f0e74d46d1b36 100644 (file)
@@ -4,12 +4,12 @@
 # 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.  */
@@ -19,9 +19,9 @@
 
 # This file was written by Rob Savoye. (rob@cygnus.com)
 
-if $tracelevel then {
-       strace $tracelevel
-       }
+if $tracelevel {
+    strace $tracelevel
+}
 
 #
 # test running programs
@@ -30,17 +30,15 @@ set prms_id 0
 set bug_id 0
 
 set testfile "exprs"
-set srcfile ${srcdir}/$subdir/${testfile}.c
+set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
-if  { [compile "${srcfile} -g -o ${binfile}"] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     perror "Couldn't compile ${srcfile}"
     return -1
 }
 
-execute_anywhere "rm -f ${binfile}.ci"
-if  { [compile "-E ${srcdir}/${subdir}/compiler.c > ${binfile}.ci"] != "" } {
-    perror "Couldn't make ${testfile}.ci file"
-    return -1
+if [get_compiler_info ${binfile}] {
+    return -1;
 }
 
 gdb_exit
@@ -48,8 +46,6 @@ gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
 
-source ${binfile}.ci
-
 #
 # set it up at a breakpoint so we can play with the variable values
 #
@@ -59,2118 +55,164 @@ if ![runto_main] then {
     continue
 }
 
-#
-# test expressions with "char" types
-#
-send "set variable v_char=127\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_char == 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_char == 127\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print char ==" }
-                   -re "$prompt $"                      { fail "print char ==" }
-                   timeout                              { fail "(timeout) print char ==" }
-               }
-           }
-           -re "$prompt $"                      { fail "print char ==" }
-           timeout                              { fail "(timeout) print char ==" }
-       }
+proc test_expr { args } {
+    if { [llength $args] % 2 } {
+       warning "an even # of arguments should be passed to test_expr"
     }
-    -re "$prompt $"                              { fail "print char ==" }
-    timeout                                      { fail "(timeout) print char ==" }
-}
-
-
-send "set variable v_char=127\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_char != 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_char != 127\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print char !=" }
-                   -re "$prompt $"                      { fail "print char !=" }
-                   timeout                              { fail "(timeout) print char !=" }
-               }
-           }
-           -re "$prompt $"                      { fail "print char !=" }
-           timeout                              { fail "(timeout) print char !=" }
-       }
+    set last_ent [expr [llength $args] - 1];
+    set testname [lindex $args $last_ent];
+    if [gdb_test [lindex $args 0] "" "$testname (setup)"] {
+       return 1;
     }
-    -re "$prompt $"                              { fail "print char !=" }
-    timeout                                      { fail "(timeout) print char !=" }
-}
-
-
-send "set variable v_char=127\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_char < 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_char < 127\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print char <" }
-                   -re "$prompt $"                      { fail "print char <" }
-                   timeout                              { fail "(timeout) print char <" }
-               }
-           }
-           -re "$prompt $"                      { fail "print char <" }
-           timeout                              { fail "(timeout) print char <" }
-       }
-    }
-    -re "$prompt $"                              { fail "print char <" }
-    timeout                                      { fail "(timeout) print char <" }
-}
-
-
-send "set variable v_char=127\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_char > 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_char > 127\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print char >" }
-                   -re "$prompt $"                      { fail "print char >" }
-                   timeout                              { fail "(timeout) print char >" }
-               }
-           }
-           -re "$prompt $"                      { fail "print char >" }
-           timeout                              { fail "(timeout) print char >" }
+    for {set x 1} {$x < $last_ent} {set x [expr $x + 2]} {
+       if [gdb_test [lindex $args $x] [lindex $args [expr $x + 1]] $testname] {
+           return 1;
        }
     }
-    -re "$prompt $"                              { fail "print char >" }
-    timeout                                      { fail "(timeout) print char >" }
 }
-
-
+#
+# test expressions with "char" types
+#
+test_expr "set variable v_char=127" "print v_char == 0" "\\$\[0-9\]* = 0"  "print v_char == 127" "\\$\[0-9\]* = 1"  "print char =="
+test_expr "set variable v_char=127" "print v_char != 0" "\\$\[0-9\]* = 1"  "print v_char != 127" "\\$\[0-9\]* = 0"  "print char !="
+test_expr "set variable v_char=127" "print v_char < 0" "\\$\[0-9\]* = 0"  "print v_char < 127" "\\$\[0-9\]* = 0"  "print char <"
+test_expr "set variable v_char=127" "print v_char > 0" "\\$\[0-9\]* = 1"  "print v_char > 127" "\\$\[0-9\]* = 0"  "print char >"
 #
 # test expressions with "signed char" types
 #
-send "set variable v_signed_char=127\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_char == 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_signed_char == 127\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed char ==" }
-                   -re "$prompt $"                      { fail "print signed char ==" }
-                   timeout                              { fail "(timeout) print signed char ==" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed char ==" }
-           timeout                              { fail "(timeout) print signed char ==" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed char ==" }
-    timeout                                      { fail "(timeout) print signed char ==" }
-}
-
-
-send "set variable v_signed_char=127\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_char != 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_signed_char != 127\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed char !=" }
-                   -re "$prompt $"                      { fail "print signed char !=" }
-                   timeout                              { fail "(timeout) print signed char !=" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed char !=" }
-           timeout                              { fail "(timeout) print signed char !=" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed char !=" }
-    timeout                                      { fail "(timeout) print signed char !=" }
-}
-
-
-send "set variable v_signed_char=127\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_char < 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_signed_char < 127\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed char <" }
-                   -re "$prompt $"                      { fail "print signed char <" }
-                   timeout                              { fail "(timeout) print signed char <" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed char <" }
-           timeout                              { fail "(timeout) print signed char <" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed char <" }
-    timeout                                      { fail "(timeout) print signed char <" }
-}
-
-
-send "set variable v_signed_char=127\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_char > 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_signed_char > 127\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed char >" }
-                   -re "$prompt $"                      { fail "print signed char >" }
-                   timeout                              { fail "(timeout) print signed char >" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed char >" }
-           timeout                              { fail "(timeout) print signed char >" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed char >" }
-    timeout                                      { fail "(timeout) print signed char >" }
-}
-
-
+test_expr "set variable v_signed_char=127" "print v_signed_char == 0" "\\$\[0-9\]* = 0"  "print v_signed_char == 127" "\\$\[0-9\]* = 1"  "print signed char =="
+test_expr "set variable v_signed_char=127" "print v_signed_char != 0" "\\$\[0-9\]* = 1"  "print v_signed_char != 127" "\\$\[0-9\]* = 0"  "print signed char !="
+test_expr "set variable v_signed_char=127" "print v_signed_char < 0" "\\$\[0-9\]* = 0"  "print v_signed_char < 127" "\\$\[0-9\]* = 0"  "print signed char <"
+test_expr "set variable v_signed_char=127" "print v_signed_char > 0" "\\$\[0-9\]* = 1"  "print v_signed_char > 127" "\\$\[0-9\]* = 0"  "print signed char >"
 # make char a minus
-if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix4*" }
-send "set variable v_signed_char=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_char == 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_signed_char == -1\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed char == (minus)" }
-                   -re "$prompt $"                      { fail "print signed char == (minus)" }
-                   timeout                              { fail "(timeout) print signed char == (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed char == (minus)" }
-           timeout                              { fail "(timeout) print signed char == (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed char == (minus)" }
-    timeout                                      { fail "(timeout) print signed char == (minus)" }
-}
-
-
-if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix4*" }
-send "set variable v_signed_char=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_char != 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_signed_char != -1\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed char != (minus)" }
-                   -re "$prompt $"                      { fail "print signed char != (minus)" }
-                   timeout                              { fail "(timeout) print signed char != (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed char != (minus)" }
-           timeout                              { fail "(timeout) print signed char != (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed char != (minus)" }
-    timeout                                      { fail "(timeout) print signed char != (minus)" }
-}
-
-
-if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix4*" }
-send "set variable v_signed_char=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_char < 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_signed_char < 127\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed char < (minus)" }
-                   -re "$prompt $"                      { fail "print signed char < (minus)" }
-                   timeout                              { fail "(timeout) print signed char < (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed char < (minus)" }
-           timeout                              { fail "(timeout) print signed char < (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed char < (minus)" }
-    timeout                                      { fail "(timeout) print signed char < (minus)" }
-}
-
-if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix4*" }
-send "set variable v_signed_char=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_char > 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_signed_char > 127\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed char > (minus)" }
-                   -re "$prompt $"                      { fail "print signed char > (minus)" }
-                   timeout                              { fail "(timeout) print signed char > (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed char > (minus)" }
-           timeout                              { fail "(timeout) print signed char > (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed char > (minus)" }
-    timeout                                      { fail "(timeout) print signed char > (minus)" }
-}
-
-
+test_expr "set variable v_signed_char=-1" "print v_signed_char == 0" "\\$\[0-9\]* = 0"  "print v_signed_char == -1" "\\$\[0-9\]* = 1"  "print signed char == (minus)"
+test_expr "set variable v_signed_char=-1" "print v_signed_char != 0" "\\$\[0-9\]* = 1"  "print v_signed_char != -1" "\\$\[0-9\]* = 0"  "print signed char != (minus)"
+test_expr "set variable v_signed_char=-1" "print v_signed_char < 0" "\\$\[0-9\]* = 1"  "print v_signed_char < 127" "\\$\[0-9\]* = 1"  "print signed char < (minus)"
+test_expr "set variable v_signed_char=-1" "print v_signed_char > 0" "\\$\[0-9\]* = 0"  "print v_signed_char > 127" "\\$\[0-9\]* = 0"  "print signed char > (minus)"
 #
 # test expressions with "unsigned char" types
 #
-send "set variable v_unsigned_char=127\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_char == 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_unsigned_char == 127\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print unsigned char ==" }
-                   -re "$prompt $"                      { fail "print unsigned char ==" }
-                   timeout                              { fail "(timeout) print unsigned char ==" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned char ==" }
-           timeout                              { fail "(timeout) print unsigned char ==" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned char ==" }
-    timeout                                      { fail "(timeout) print unsigned char ==" }
-}
-
-
-send "set variable v_unsigned_char=127\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_char != 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_unsigned_char != 127\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned char !=" }
-                   -re "$prompt $"                      { fail "print unsigned char !=" }
-                   timeout                              { fail "(timeout) print unsigned char !=" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned char !=" }
-           timeout                              { fail "(timeout) print unsigned char !=" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned char !=" }
-    timeout                                      { fail "(timeout) print unsigned char !=" }
-}
-
-
-send "set variable v_unsigned_char=127\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_char < 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_unsigned_char < 127\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned char <" }
-                   -re "$prompt $"                      { fail "print unsigned char <" }
-                   timeout                              { fail "(timeout) print unsigned char <" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned char <" }
-           timeout                              { fail "(timeout) print unsigned char <" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned char <" }
-    timeout                                      { fail "(timeout) print unsigned char <" }
-}
-
-
-send "set variable v_unsigned_char=127\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_char > 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_unsigned_char > 127\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned char >" }
-                   -re "$prompt $"                      { fail "print unsigned char >" }
-                   timeout                              { fail "(timeout) print unsigned char >" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned char >" }
-           timeout                              { fail "(timeout) print unsigned char >" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned char >" }
-    timeout                                      { fail "(timeout) print unsigned char >" }
-}
-
-
+test_expr "set variable v_unsigned_char=127" "print v_unsigned_char == 0" "\\$\[0-9\]* = 0"  "print v_unsigned_char == 127" "\\$\[0-9\]* = 1"  "print unsigned char =="
+test_expr "set variable v_unsigned_char=127" "print v_unsigned_char != 0" "\\$\[0-9\]* = 1"  "print v_unsigned_char != 127" "\\$\[0-9\]* = 0"  "print unsigned char !="
+test_expr "set variable v_unsigned_char=127" "print v_unsigned_char < 0" "\\$\[0-9\]* = 0"  "print v_unsigned_char < 127" "\\$\[0-9\]* = 0"  "print unsigned char <"
+test_expr "set variable v_unsigned_char=127" "print v_unsigned_char > 0" "\\$\[0-9\]* = 1"  "print v_unsigned_char > 127" "\\$\[0-9\]* = 0"  "print unsigned char >"
 # make char a minus
 # FIXME:  gdb mishandles the cast (unsigned char) on the i960, so I've
 # set up an expected failure for this case.
-send "set variable v_unsigned_char=~0\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_char == 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_unsigned_char == ~0\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" {
-                       setup_xfail "i960-*-*" 1821
-                       send "print v_unsigned_char == (unsigned char)~0\n"
-                       expect {
-                           -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print unsigned char == (~0)" }
-                           -re "$prompt $"                      { fail "print unsigned char == (~0)" }
-                           timeout                              { fail "(timeout) print unsigned char == (~0)" }
-                       }
-                   }
-                   -re "$prompt $"                      { fail "print unsigned char == (~0)" }
-                   timeout                              { fail "(timeout) print unsigned char == (~0)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned char == (~0)" }
-           timeout                              { fail "(timeout) print unsigned char == (~0)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned char == (~0)" }
-    timeout                                      { fail "(timeout) print unsigned char == (~0)" }
-}
-
-
+setup_xfail "i960-*-*" 1821
+test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char == 0" "\\$\[0-9\]* = 0"  "print v_unsigned_char == ~0" "\\$\[0-9\]* = 0"  "print v_unsigned_char == (unsigned char)~0" "\\$\[0-9\]* = 1"  "print unsigned char == (~0)"
 # FIXME:  gdb mishandles the cast (unsigned char) on the i960, so I've
 # set up an expected failure for this case.
-send "set variable v_unsigned_char=~0\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_char != 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               setup_xfail "i960-*-*" 1821
-               send "print v_unsigned_char != (unsigned char)~0\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned char != (~0)" }
-                   -re "$prompt $"                      { fail "print unsigned char != (~0)" }
-                   timeout                              { fail "(timeout) print unsigned char != (~0)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned char != (~0)" }
-           timeout                              { fail "(timeout) print unsigned char != (~0)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned char != (~0)" }
-    timeout                                      { fail "(timeout) print unsigned char != (~0)" }
-}
-
-
-send "set variable v_unsigned_char=~0\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_char < 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_unsigned_char < 127\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned char < (~0)" }
-                   -re "$prompt $"                      { fail "print unsigned char < (~0)" }
-                   timeout                              { fail "(timeout) print unsigned char < (~0)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned char < (~0)" }
-           timeout                              { fail "(timeout) print unsigned char < (~0)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned char < (~0)" }
-    timeout                                      { fail "(timeout) print unsigned char < (~0)" }
-}
-
-
-send "set variable v_unsigned_char=~0\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_char > 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_unsigned_char > 127\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print unsigned char > (~0)" }
-                   -re "$prompt $"                      { fail "print unsigned char > (~0)" }
-                   timeout                              { fail "(timeout) print unsigned char > (~0)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned char > (~0)" }
-           timeout                              { fail "(timeout) print unsigned char > (~0)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned char > (~0)" }
-    timeout                                      { fail "(timeout) print unsigned char > (~0)" }
-}
-
-
+setup_xfail "i960-*-*" 1821
+test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char != 0" "\\$\[0-9\]* = 1"  "print v_unsigned_char != (unsigned char)~0" "\\$\[0-9\]* = 0"  "print unsigned char != (~0)"
+test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char < 0" "\\$\[0-9\]* = 0"  "print v_unsigned_char < 127" "\\$\[0-9\]* = 0"  "print unsigned char < (~0)"
+test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char > 0" "\\$\[0-9\]* = 1"  "print v_unsigned_char > 127" "\\$\[0-9\]* = 1"  "print unsigned char > (~0)"
 #
 # test expressions with "short" types
 #
-send "set variable v_short=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_short == 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_short == 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed short ==" }
-                   -re "$prompt $"                      { fail "print signed short ==" }
-                   timeout                              { fail "(timeout) print signed short ==" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed short ==" }
-           timeout                              { fail "(timeout) print signed short ==" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed short ==" }
-    timeout                                      { fail "(timeout) print signed short ==" }
-}
-
-
-send "set variable v_short=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_short != 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_short != 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed short !=" }
-                   -re "$prompt $"                      { fail "print signed short !=" }
-                   timeout                              { fail "(timeout) print signed short !=" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed short !=" }
-           timeout                              { fail "(timeout) print signed short !=" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed short !=" }
-    timeout                                      { fail "(timeout) print signed short !=" }
-}
-
-
-send "set variable v_short=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_short < 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_short < 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed short <" }
-                   -re "$prompt $"                      { fail "print signed short <" }
-                   timeout                              { fail "(timeout) print signed short <" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed short <" }
-           timeout                              { fail "(timeout) print signed short <" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed short <" }
-    timeout                                      { fail "(timeout) print signed short <" }
-}
-
-
-send "set variable v_short=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_short > 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_short > 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed short >" }
-                   -re "$prompt $"                      { fail "print signed short >" }
-                   timeout                              { fail "(timeout) print signed short >" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed short >" }
-           timeout                              { fail "(timeout) print signed short >" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed short >" }
-    timeout                                      { fail "(timeout) print signed short >" }
-}
-
-
+test_expr "set variable v_short=0x7FFF" "print v_short == 0" "\\$\[0-9\]* = 0"  "print v_short == 0x7FFF" "\\$\[0-9\]* = 1"  "print signed short =="
+test_expr "set variable v_short=0x7FFF" "print v_short != 0" "\\$\[0-9\]* = 1"  "print v_short != 0x7FFF" "\\$\[0-9\]* = 0"  "print signed short !="
+test_expr "set variable v_short=0x7FFF" "print v_short < 0" "\\$\[0-9\]* = 0"  "print v_short < 0x7FFF" "\\$\[0-9\]* = 0"  "print signed short <"
+test_expr "set variable v_short=0x7FFF" "print v_short > 0" "\\$\[0-9\]* = 1"  "print v_short > 0x7FFF" "\\$\[0-9\]* = 0"  "print signed short >"
 # make short a minus
-send "set variable v_short=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_short == 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_short == -1\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed short == (minus)" }
-                   -re "$prompt $"                      { fail "print signed short == (minus)" }
-                   timeout                              { fail "(timeout) print signed short == (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed short == (minus)" }
-           timeout                              { fail "(timeout) print signed short == (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed short == (minus)" }
-    timeout                                      { fail "(timeout) print signed short == (minus)" }
-}
-
-
-send "set variable v_short=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_short != 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_short != -1\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed short != (minus)" }
-                   -re "$prompt $"                      { fail "print signed short != (minus)" }
-                   timeout                              { fail "(timeout) print signed short != (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed short != (minus)" }
-           timeout                              { fail "(timeout) print signed short != (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed short != (minus)" }
-    timeout                                      { fail "(timeout) print signed short != (minus)" }
-}
-
-
-send "set variable v_short=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_short < 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_short < 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed short < (minus)" }
-                   -re "$prompt $"                      { fail "print signed short < (minus)" }
-                   timeout                              { fail "(timeout) print signed short < (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed short < (minus)" }
-           timeout                              { fail "(timeout) print signed short < (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed short < (minus)" }
-    timeout                                      { fail "(timeout) print signed short < (minus)" }
-}
-
-
-send "set variable v_short=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_short > 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_short > 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed short > (minus)" }
-                   -re "$prompt $"                      { fail "print signed short > (minus)" }
-                   timeout                              { fail "(timeout) print signed short > (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed short > (minus)" }
-           timeout                              { fail "(timeout) print signed short > (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed short > (minus)" }
-    timeout                                      { fail "(timeout) print signed short > (minus)" }
-}
-
-
+test_expr "set variable v_short=-1" "print v_short == 0" "\\$\[0-9\]* = 0"  "print v_short == -1" "\\$\[0-9\]* = 1"  "print signed short == (minus)"
+test_expr "set variable v_short=-1" "print v_short != 0" "\\$\[0-9\]* = 1"  "print v_short != -1" "\\$\[0-9\]* = 0"  "print signed short != (minus)"
+test_expr "set variable v_short=-1" "print v_short < 0" "\\$\[0-9\]* = 1"  "print v_short < 0x7FFF" "\\$\[0-9\]* = 1"  "print signed short < (minus)"
+test_expr "set variable v_short=-1" "print v_short > 0" "\\$\[0-9\]* = 0"  "print v_short > 0x7FFF" "\\$\[0-9\]* = 0"  "print signed short > (minus)"
 #
 # test expressions with "signed short" types
 #
-send "set variable v_signed_short=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_short == 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_signed_short == 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed signed short ==" }
-                   -re "$prompt $"                      { fail "print signed signed short ==" }
-                   timeout                              { fail "(timeout) print signed signed short ==" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed signed short ==" }
-           timeout                              { fail "(timeout) print signed signed short ==" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed signed short ==" }
-    timeout                                      { fail "(timeout) print signed signed short ==" }
-}
-
-
-send "set variable v_signed_short=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_short != 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_signed_short != 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed short !=" }
-                   -re "$prompt $"                      { fail "print signed signed short !=" }
-                   timeout                              { fail "(timeout) print signed signed short !=" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed signed short !=" }
-           timeout                              { fail "(timeout) print signed signed short !=" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed signed short !=" }
-    timeout                                      { fail "(timeout) print signed signed short !=" }
-}
-
-
-send "set variable v_signed_short=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_short < 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_signed_short < 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed short <" }
-                   -re "$prompt $"                      { fail "print signed signed short <" }
-                   timeout                              { fail "(timeout) print signed signed short <" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed signed short <" }
-           timeout                              { fail "(timeout) print signed signed short <" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed signed short <" }
-    timeout                                      { fail "(timeout) print signed signed short <" }
-}
-
-
-send "set variable v_signed_short=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_short > 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_signed_short > 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed short >" }
-                   -re "$prompt $"                      { fail "print signed signed short >" }
-                   timeout                              { fail "(timeout) print signed signed short >" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed signed short >" }
-           timeout                              { fail "(timeout) print signed signed short >" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed signed short >" }
-    timeout                                      { fail "(timeout) print signed signed short >" }
-}
-
-
+test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short == 0" "\\$\[0-9\]* = 0"  "print v_signed_short == 0x7FFF" "\\$\[0-9\]* = 1"  "print signed signed short =="
+test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short != 0" "\\$\[0-9\]* = 1"  "print v_signed_short != 0x7FFF" "\\$\[0-9\]* = 0"  "print signed signed short !="
+test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short < 0" "\\$\[0-9\]* = 0"  "print v_signed_short < 0x7FFF" "\\$\[0-9\]* = 0"  "print signed signed short <"
+test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short > 0" "\\$\[0-9\]* = 1"  "print v_signed_short > 0x7FFF" "\\$\[0-9\]* = 0"  "print signed signed short >"
 # make short a minus
-send "set variable v_signed_short=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_short == 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_signed_short == -1\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed signed short == (minus)" }
-                   -re "$prompt $"                      { fail "print signed signed short == (minus)" }
-                   timeout                              { fail "(timeout) print signed signed short == (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed signed short == (minus)" }
-           timeout                              { fail "(timeout) print signed signed short == (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed signed short == (minus)" }
-    timeout                                      { fail "(timeout) print signed signed short == (minus)" }
-}
-
-
-send "set variable v_signed_short=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_short != 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_signed_short != -1\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed short != (minus)" }
-                   -re "$prompt $"                      { fail "print signed signed short != (minus)" }
-                   timeout                              { fail "(timeout) print signed signed short != (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed signed short != (minus)" }
-           timeout                              { fail "(timeout) print signed signed short != (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed signed short != (minus)" }
-    timeout                                      { fail "(timeout) print signed signed short != (minus)" }
-}
-
-
-send "set variable v_signed_short=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_short < 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_signed_short < 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed signed short < (minus)" }
-                   -re "$prompt $"                      { fail "print signed signed short < (minus)" }
-                   timeout                              { fail "(timeout) print signed signed short < (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed signed short < (minus)" }
-           timeout                              { fail "(timeout) print signed signed short < (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed signed short < (minus)" }
-    timeout                                      { fail "(timeout) print signed signed short < (minus)" }
-}
-
-
-send "set variable v_signed_short=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_short > 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_signed_short > 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed short > (minus)" }
-                   -re "$prompt $"                      { fail "print signed signed short > (minus)" }
-                   timeout                              { fail "(timeout) print signed signed short > (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed signed short > (minus)" }
-           timeout                              { fail "(timeout) print signed signed short > (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed signed short > (minus)" }
-    timeout                                      { fail "(timeout) print signed signed short > (minus)" }
-}
-
-
+test_expr "set variable v_signed_short=-1" "print v_signed_short == 0" "\\$\[0-9\]* = 0"  "print v_signed_short == -1" "\\$\[0-9\]* = 1"  "print signed signed short == (minus)"
+test_expr "set variable v_signed_short=-1" "print v_signed_short != 0" "\\$\[0-9\]* = 1"  "print v_signed_short != -1" "\\$\[0-9\]* = 0"  "print signed signed short != (minus)"
+test_expr "set variable v_signed_short=-1" "print v_signed_short < 0" "\\$\[0-9\]* = 1"  "print v_signed_short < 0x7FFF" "\\$\[0-9\]* = 1"  "print signed signed short < (minus)"
+test_expr "set variable v_signed_short=-1" "print v_signed_short > 0" "\\$\[0-9\]* = 0"  "print v_signed_short > 0x7FFF" "\\$\[0-9\]* = 0"  "print signed signed short > (minus)"
 #
 # test expressions with "unsigned short" types
 #
-send "set variable v_unsigned_short=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_short == 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_unsigned_short == 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print unsigned short ==" }
-                   -re "$prompt $"                      { fail "print unsigned short ==" }
-                   timeout                              { fail "(timeout) print unsigned short ==" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned short ==" }
-           timeout                              { fail "(timeout) print unsigned short ==" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned short ==" }
-    timeout                                      { fail "(timeout) print unsigned short ==" }
-}
-
-
-send "set variable v_unsigned_short=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_short != 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_unsigned_short != 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned short !=" }
-                   -re "$prompt $"                      { fail "print unsigned short !=" }
-                   timeout                              { fail "(timeout) print unsigned short !=" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned short !=" }
-           timeout                              { fail "(timeout) print unsigned short !=" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned short !=" }
-    timeout                                      { fail "(timeout) print unsigned short !=" }
-}
-
-
-send "set variable v_unsigned_short=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_short < 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_unsigned_short < 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned short <" }
-                   -re "$prompt $"                      { fail "print unsigned short <" }
-                   timeout                              { fail "(timeout) print unsigned short <" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned short <" }
-           timeout                              { fail "(timeout) print unsigned short <" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned short <" }
-    timeout                                      { fail "(timeout) print unsigned short <" }
-}
-
-
-send "set variable v_unsigned_short=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_short > 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_unsigned_short > 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned short >" }
-                   -re "$prompt $"                      { fail "print unsigned short >" }
-                   timeout                              { fail "(timeout) print unsigned short >" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned short >" }
-           timeout                              { fail "(timeout) print unsigned short >" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned short >" }
-    timeout                                      { fail "(timeout) print unsigned short >" }
-}
-
-
+test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short == 0" "\\$\[0-9\]* = 0"  "print v_unsigned_short == 0x7FFF" "\\$\[0-9\]* = 1"  "print unsigned short =="
+test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short != 0" "\\$\[0-9\]* = 1"  "print v_unsigned_short != 0x7FFF" "\\$\[0-9\]* = 0"  "print unsigned short !="
+test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short < 0" "\\$\[0-9\]* = 0"  "print v_unsigned_short < 0x7FFF" "\\$\[0-9\]* = 0"  "print unsigned short <"
+test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short > 0" "\\$\[0-9\]* = 1"  "print v_unsigned_short > 0x7FFF" "\\$\[0-9\]* = 0"  "print unsigned short >"
 # make short a minus
-send "set variable v_unsigned_short=~0\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_short == 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_unsigned_short == ~0\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" {
-                       send "print v_unsigned_short == (unsigned short)~0\n"
-                       expect {
-                           -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print unsigned short == (~0)" }
-                           -re "$prompt $"                      { fail "print unsigned short == (~0)" }
-                           timeout                              { fail "(timeout) print unsigned short == (~0)" }
-                       }
-                   }
-                   -re "$prompt $"                      { fail "print unsigned short == (~0)" }
-                   timeout                              { fail "(timeout) print unsigned short == (~0)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned short == (~0)" }
-           timeout                              { fail "(timeout) print unsigned short == (~0)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned short == (~0)" }
-    timeout                                      { fail "(timeout) print unsigned short == (~0)" }
-}
-
-
-send "set variable v_unsigned_short=~0\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_short != 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_unsigned_short != (unsigned short)~0\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned short != (~0)" }
-                   -re "$prompt $"                      { fail "print unsigned short != (~0)" }
-                   timeout                              { fail "(timeout) print unsigned short != (~0)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned short != (~0)" }
-           timeout                              { fail "(timeout) print unsigned short != (~0)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned short != (~0)" }
-    timeout                                      { fail "(timeout) print unsigned short != (~0)" }
-}
-
-
-send "set variable v_unsigned_short=~0\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_short < 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_unsigned_short < 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned short < (~0)" }
-                   -re "$prompt $"                      { fail "print unsigned short < (~0)" }
-                   timeout                              { fail "(timeout) print unsigned short < (~0)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned short < (~0)" }
-           timeout                              { fail "(timeout) print unsigned short < (~0)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned short < (~0)" }
-    timeout                                      { fail "(timeout) print unsigned short < (~0)" }
-}
-
-
-send "set variable v_unsigned_short=~0\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_short > 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_unsigned_short > 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print unsigned short > (~0)" }
-                   -re "$prompt $"                      { fail "print unsigned short > (~0)" }
-                   timeout                              { fail "(timeout) print unsigned short > (~0)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned short > (~0)" }
-           timeout                              { fail "(timeout) print unsigned short > (~0)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned short > (~0)" }
-    timeout                                      { fail "(timeout) print unsigned short > (~0)" }
-}
-
-
+test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short == 0" "\\$\[0-9\]* = 0"  "print v_unsigned_short == ~0" "\\$\[0-9\]* = 0"  "print v_unsigned_short == (unsigned short)~0" "\\$\[0-9\]* = 1"  "print unsigned short == (~0)"
+test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short != 0" "\\$\[0-9\]* = 1"  "print v_unsigned_short != (unsigned short)~0" "\\$\[0-9\]* = 0"  "print unsigned short != (~0)"
+test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short < 0" "\\$\[0-9\]* = 0"  "print v_unsigned_short < 0x7FFF" "\\$\[0-9\]* = 0"  "print unsigned short < (~0)"
+test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short > 0" "\\$\[0-9\]* = 1"  "print v_unsigned_short > 0x7FFF" "\\$\[0-9\]* = 1"  "print unsigned short > (~0)"
 #
 # test expressions with "int" types
 #
-send "set variable v_int=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_int == 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_int == 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed int ==" }
-                   -re "$prompt $"                      { fail "print signed int ==" }
-                   timeout                              { fail "(timeout) print signed int ==" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed int ==" }
-           timeout                              { fail "(timeout) print signed int ==" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed int ==" }
-    timeout                                      { fail "(timeout) print signed int ==" }
-}
-
-
-send "set variable v_int=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_int != 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_int != 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed int !=" }
-                   -re "$prompt $"                      { fail "print signed int !=" }
-                   timeout                              { fail "(timeout) print signed int !=" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed int !=" }
-           timeout                              { fail "(timeout) print signed int !=" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed int !=" }
-    timeout                                      { fail "(timeout) print signed int !=" }
-}
-
-
-send "set variable v_int=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_int < 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_int < 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed int <" }
-                   -re "$prompt $"                      { fail "print signed int <" }
-                   timeout                              { fail "(timeout) print signed int <" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed int <" }
-           timeout                              { fail "(timeout) print signed int <" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed int <" }
-    timeout                                      { fail "(timeout) print signed int <" }
-}
-
-
-send "set variable v_int=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_int > 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_int > 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed int >" }
-                   -re "$prompt $"                      { fail "print signed int >" }
-                   timeout                              { fail "(timeout) print signed int >" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed int >" }
-           timeout                              { fail "(timeout) print signed int >" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed int >" }
-    timeout                                      { fail "(timeout) print signed int >" }
-}
-
-
+test_expr "set variable v_int=0x7FFF" "print v_int == 0" "\\$\[0-9\]* = 0"  "print v_int == 0x7FFF" "\\$\[0-9\]* = 1"  "print signed int =="
+test_expr "set variable v_int=0x7FFF" "print v_int != 0" "\\$\[0-9\]* = 1"  "print v_int != 0x7FFF" "\\$\[0-9\]* = 0"  "print signed int !="
+test_expr "set variable v_int=0x7FFF" "print v_int < 0" "\\$\[0-9\]* = 0"  "print v_int < 0x7FFF" "\\$\[0-9\]* = 0"  "print signed int <"
+test_expr "set variable v_int=0x7FFF" "print v_int > 0" "\\$\[0-9\]* = 1"  "print v_int > 0x7FFF" "\\$\[0-9\]* = 0"  "print signed int >"
 # make int a minus
-send "set variable v_int=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_int == 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_int == -1\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed int == (minus)" }
-                   -re "$prompt $"                      { fail "print signed int == (minus)" }
-                   timeout                              { fail "(timeout) print signed int == (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed int == (minus)" }
-           timeout                              { fail "(timeout) print signed int == (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed int == (minus)" }
-    timeout                                      { fail "(timeout) print signed int == (minus)" }
-}
-
-
-send "set variable v_int=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_int != 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_int != -1\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed int != (minus)" }
-                   -re "$prompt $"                      { fail "print signed int != (minus)" }
-                   timeout                              { fail "(timeout) print signed int != (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed int != (minus)" }
-           timeout                              { fail "(timeout) print signed int != (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed int != (minus)" }
-    timeout                                      { fail "(timeout) print signed int != (minus)" }
-}
-
-
-send "set variable v_int=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_int < 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_int < 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed int < (minus)" }
-                   -re "$prompt $"                      { fail "print signed int < (minus)" }
-                   timeout                              { fail "(timeout) print signed int < (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed int < (minus)" }
-           timeout                              { fail "(timeout) print signed int < (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed int < (minus)" }
-    timeout                                      { fail "(timeout) print signed int < (minus)" }
-}
-
-
-send "set variable v_int=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_int > 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_int > 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed int > (minus)" }
-                   -re "$prompt $"                      { fail "print signed int > (minus)" }
-                   timeout                              { fail "(timeout) print signed int > (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed int > (minus)" }
-           timeout                              { fail "(timeout) print signed int > (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed int > (minus)" }
-    timeout                                      { fail "(timeout) print signed int > (minus)" }
-}
-
-
+test_expr "set variable v_int=-1" "print v_int == 0" "\\$\[0-9\]* = 0"  "print v_int == -1" "\\$\[0-9\]* = 1"  "print signed int == (minus)"
+test_expr "set variable v_int=-1" "print v_int != 0" "\\$\[0-9\]* = 1"  "print v_int != -1" "\\$\[0-9\]* = 0"  "print signed int != (minus)"
+test_expr "set variable v_int=-1" "print v_int < 0" "\\$\[0-9\]* = 1"  "print v_int < 0x7FFF" "\\$\[0-9\]* = 1"  "print signed int < (minus)"
+test_expr "set variable v_int=-1" "print v_int > 0" "\\$\[0-9\]* = 0"  "print v_int > 0x7FFF" "\\$\[0-9\]* = 0"  "print signed int > (minus)"
 #
 # test expressions with "signed int" types
 #
-send "set variable v_signed_int=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_int == 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_signed_int == 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed signed int ==" }
-                   -re "$prompt $"                      { fail "print signed signed int ==" }
-                   timeout                              { fail "(timeout) print signed signed int ==" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed signed int ==" }
-           timeout                              { fail "(timeout) print signed signed int ==" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed signed int ==" }
-    timeout                                      { fail "(timeout) print signed signed int ==" }
-}
-
-
-send "set variable v_signed_int=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_int != 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_signed_int != 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed int !=" }
-                   -re "$prompt $"                      { fail "print signed signed int !=" }
-                   timeout                              { fail "(timeout) print signed signed int !=" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed signed int !=" }
-           timeout                              { fail "(timeout) print signed signed int !=" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed signed int !=" }
-    timeout                                      { fail "(timeout) print signed signed int !=" }
-}
-
-
-send "set variable v_signed_int=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_int < 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_signed_int < 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed int <" }
-                   -re "$prompt $"                      { fail "print signed signed int <" }
-                   timeout                              { fail "(timeout) print signed signed int <" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed signed int <" }
-           timeout                              { fail "(timeout) print signed signed int <" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed signed int <" }
-    timeout                                      { fail "(timeout) print signed signed int <" }
-}
-
-
-send "set variable v_signed_int=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_int > 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_signed_int > 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed int >" }
-                   -re "$prompt $"                      { fail "print signed signed int >" }
-                   timeout                              { fail "(timeout) print signed signed int >" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed signed int >" }
-           timeout                              { fail "(timeout) print signed signed int >" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed signed int >" }
-    timeout                                      { fail "(timeout) print signed signed int >" }
-}
-
-
+test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int == 0" "\\$\[0-9\]* = 0"  "print v_signed_int == 0x7FFF" "\\$\[0-9\]* = 1"  "print signed signed int =="
+test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int != 0" "\\$\[0-9\]* = 1"  "print v_signed_int != 0x7FFF" "\\$\[0-9\]* = 0"  "print signed signed int !="
+test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int < 0" "\\$\[0-9\]* = 0"  "print v_signed_int < 0x7FFF" "\\$\[0-9\]* = 0"  "print signed signed int <"
+test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int > 0" "\\$\[0-9\]* = 1"  "print v_signed_int > 0x7FFF" "\\$\[0-9\]* = 0"  "print signed signed int >"
 # make int a minus
-send "set variable v_signed_int=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_int == 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_signed_int == -1\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed signed int == (minus)" }
-                   -re "$prompt $"                      { fail "print signed signed int == (minus)" }
-                   timeout                              { fail "(timeout) print signed signed int == (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed signed int == (minus)" }
-           timeout                              { fail "(timeout) print signed signed int == (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed signed int == (minus)" }
-    timeout                                      { fail "(timeout) print signed signed int == (minus)" }
-}
-
-
-send "set variable v_signed_int=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_int != 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_signed_int != -1\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed int != (minus)" }
-                   -re "$prompt $"                      { fail "print signed signed int != (minus)" }
-                   timeout                              { fail "(timeout) print signed signed int != (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed signed int != (minus)" }
-           timeout                              { fail "(timeout) print signed signed int != (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed signed int != (minus)" }
-    timeout                                      { fail "(timeout) print signed signed int != (minus)" }
-}
-
-
-send "set variable v_signed_int=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_int < 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_signed_int < 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed signed int < (minus)" }
-                   -re "$prompt $"                      { fail "print signed signed int < (minus)" }
-                   timeout                              { fail "(timeout) print signed signed int < (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed signed int < (minus)" }
-           timeout                              { fail "(timeout) print signed signed int < (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed signed int < (minus)" }
-    timeout                                      { fail "(timeout) print signed signed int < (minus)" }
-}
-
-
-send "set variable v_signed_int=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_int > 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_signed_int > 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed int > (minus)" }
-                   -re "$prompt $"                      { fail "print signed signed int > (minus)" }
-                   timeout                              { fail "(timeout) print signed signed int > (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed signed int > (minus)" }
-           timeout                              { fail "(timeout) print signed signed int > (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed signed int > (minus)" }
-    timeout                                      { fail "(timeout) print signed signed int > (minus)" }
-}
-
-
+test_expr "set variable v_signed_int=-1" "print v_signed_int == 0" "\\$\[0-9\]* = 0"  "print v_signed_int == -1" "\\$\[0-9\]* = 1"  "print signed signed int == (minus)"
+test_expr "set variable v_signed_int=-1" "print v_signed_int != 0" "\\$\[0-9\]* = 1"  "print v_signed_int != -1" "\\$\[0-9\]* = 0"  "print signed signed int != (minus)"
+test_expr "set variable v_signed_int=-1" "print v_signed_int < 0" "\\$\[0-9\]* = 1"  "print v_signed_int < 0x7FFF" "\\$\[0-9\]* = 1"  "print signed signed int < (minus)"
+test_expr "set variable v_signed_int=-1" "print v_signed_int > 0" "\\$\[0-9\]* = 0"  "print v_signed_int > 0x7FFF" "\\$\[0-9\]* = 0"  "print signed signed int > (minus)"
 #
 # test expressions with "unsigned int" types
 #
-send "set variable v_unsigned_int=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_int == 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_unsigned_int == 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print unsigned int ==" }
-                   -re "$prompt $"                      { fail "print unsigned int ==" }
-                   timeout                              { fail "(timeout) print unsigned int ==" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned int ==" }
-           timeout                              { fail "(timeout) print unsigned int ==" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned int ==" }
-    timeout                                      { fail "(timeout) print unsigned int ==" }
-}
-
-
-send "set variable v_unsigned_int=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_int != 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_unsigned_int != 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned int !=" }
-                   -re "$prompt $"                      { fail "print unsigned int !=" }
-                   timeout                              { fail "(timeout) print unsigned int !=" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned int !=" }
-           timeout                              { fail "(timeout) print unsigned int !=" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned int !=" }
-    timeout                                      { fail "(timeout) print unsigned int !=" }
-}
-
-
-send "set variable v_unsigned_int=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_int < 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_unsigned_int < 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned int <" }
-                   -re "$prompt $"                      { fail "print unsigned int <" }
-                   timeout                              { fail "(timeout) print unsigned int <" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned int <" }
-           timeout                              { fail "(timeout) print unsigned int <" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned int <" }
-    timeout                                      { fail "(timeout) print unsigned int <" }
-}
-
-
-send "set variable v_unsigned_int=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_int > 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_unsigned_int > 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned int >" }
-                   -re "$prompt $"                      { fail "print unsigned int >" }
-                   timeout                              { fail "(timeout) print unsigned int >" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned int >" }
-           timeout                              { fail "(timeout) print unsigned int >" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned int >" }
-    timeout                                      { fail "(timeout) print unsigned int >" }
-}
-
-
+test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int == 0" "\\$\[0-9\]* = 0"  "print v_unsigned_int == 0x7FFF" "\\$\[0-9\]* = 1"  "print unsigned int =="
+test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int != 0" "\\$\[0-9\]* = 1"  "print v_unsigned_int != 0x7FFF" "\\$\[0-9\]* = 0"  "print unsigned int !="
+test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int < 0" "\\$\[0-9\]* = 0"  "print v_unsigned_int < 0x7FFF" "\\$\[0-9\]* = 0"  "print unsigned int <"
+test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int > 0" "\\$\[0-9\]* = 1"  "print v_unsigned_int > 0x7FFF" "\\$\[0-9\]* = 0"  "print unsigned int >"
 # make int a minus
-send "set variable v_unsigned_int=~0\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_int == 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_unsigned_int == ~0\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" {
-                       send "print v_unsigned_int == (unsigned int)~0\n"
-                       expect {
-                           -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print unsigned int == (~0)" }
-                           -re "$prompt $"                      { fail "print unsigned int == (~0)" }
-                           timeout                              { fail "(timeout) print unsigned int == (~0)" }
-                       }
-                   }
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" {
-                       fail "print unsigned int == (~0)"
-                       send "print v_unsigned_int == (unsigned int)~0\n"
-                       expect {
-                           -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print unsigned int == (~0)" }
-                           -re "$prompt $"                      { fail "print unsigned int == (~0)" }
-                           timeout                              { fail "(timeout) print unsigned int == (~0)" }
-                       }
-                   }
-                   -re "$prompt $"                      { fail "print unsigned int == (~0)" }
-                   timeout                              { fail "(timeout) print unsigned int == (~0)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned int == (~0)" }
-           timeout                              { fail "(timeout) print unsigned int == (~0)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned int == (~0)" }
-    timeout                                      { fail "(timeout) print unsigned int == (~0)" }
-}
-
-
-send "set variable v_unsigned_int=~0\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_int != 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_unsigned_int != (unsigned int)~0\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned int != (~0)" }
-                   -re "$prompt $"                      { fail "print unsigned int != (~0)" }
-                   timeout                              { fail "(timeout) print unsigned int != (~0)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned int != (~0)" }
-           timeout                              { fail "(timeout) print unsigned int != (~0)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned int != (~0)" }
-    timeout                                      { fail "(timeout) print unsigned int != (~0)" }
-}
-
-
-send "set variable v_unsigned_int=~0\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_int < 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_unsigned_int < 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned int < (~0)" }
-                   -re "$prompt $"                      { fail "print unsigned int < (~0)" }
-                   timeout                              { fail "(timeout) print unsigned int < (~0)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned int < (~0)" }
-           timeout                              { fail "(timeout) print unsigned int < (~0)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned int < (~0)" }
-    timeout                                      { fail "(timeout) print unsigned int < (~0)" }
-}
-
-
-send "set variable v_unsigned_int=~0\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_int > 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_unsigned_int > 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print unsigned int > (~0)" }
-                   -re "$prompt $"                      { fail "print unsigned int > (~0)" }
-                   timeout                              { fail "(timeout) print unsigned int > (~0)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned int > (~0)" }
-           timeout                              { fail "(timeout) print unsigned int > (~0)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned int > (~0)" }
-    timeout                                      { fail "(timeout) print unsigned int > (~0)" }
-}
-
-
+test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int == 0" "\\$\[0-9\]* = 0"  "print v_unsigned_int == ~0" "\\$\[0-9\]* = 1"  "print v_unsigned_int == (unsigned int)~0" "\\$\[0-9\]* = 1"  "print unsigned int == (~0)"
+test_expr "\\$\[0-9\]* = 0"  "print v_unsigned_int == (unsigned int)~0" "\\$\[0-9\]* = 1"  "print unsigned int == (~0)"
+test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int != 0" "\\$\[0-9\]* = 1"  "print v_unsigned_int != (unsigned int)~0" "\\$\[0-9\]* = 0"  "print unsigned int != (~0)"
+test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int < 0" "\\$\[0-9\]* = 0"  "print v_unsigned_int < 0x7FFF" "\\$\[0-9\]* = 0"  "print unsigned int < (~0)"
+test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int > 0" "\\$\[0-9\]* = 1"  "print v_unsigned_int > 0x7FFF" "\\$\[0-9\]* = 1"  "print unsigned int > (~0)"
 #
 # test expressions with "long" types
 #
-send "set variable v_long=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_long == 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_long == 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed long ==" }
-                   -re "$prompt $"                      { fail "print signed long ==" }
-                   timeout                              { fail "(timeout) print signed long ==" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed long ==" }
-           timeout                              { fail "(timeout) print signed long ==" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed long ==" }
-    timeout                                      { fail "(timeout) print signed long ==" }
-}
-
-
-send "set variable v_long=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_long != 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_long != 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed long !=" }
-                   -re "$prompt $"                      { fail "print signed long !=" }
-                   timeout                              { fail "(timeout) print signed long !=" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed long !=" }
-           timeout                              { fail "(timeout) print signed long !=" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed long !=" }
-    timeout                                      { fail "(timeout) print signed long !=" }
-}
-
-
-send "set variable v_long=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_long < 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_long < 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed long <" }
-                   -re "$prompt $"                      { fail "print signed long <" }
-                   timeout                              { fail "(timeout) print signed long <" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed long <" }
-           timeout                              { fail "(timeout) print signed long <" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed long <" }
-    timeout                                      { fail "(timeout) print signed long <" }
-}
-
-
-send "set variable v_long=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_long > 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_long > 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed long >" }
-                   -re "$prompt $"                      { fail "print signed long >" }
-                   timeout                              { fail "(timeout) print signed long >" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed long >" }
-           timeout                              { fail "(timeout) print signed long >" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed long >" }
-    timeout                                      { fail "(timeout) print signed long >" }
-}
-
-
+test_expr "set variable v_long=0x7FFF" "print v_long == 0" "\\$\[0-9\]* = 0"  "print v_long == 0x7FFF" "\\$\[0-9\]* = 1"  "print signed long =="
+test_expr "set variable v_long=0x7FFF" "print v_long != 0" "\\$\[0-9\]* = 1"  "print v_long != 0x7FFF" "\\$\[0-9\]* = 0"  "print signed long !="
+test_expr "set variable v_long=0x7FFF" "print v_long < 0" "\\$\[0-9\]* = 0"  "print v_long < 0x7FFF" "\\$\[0-9\]* = 0"  "print signed long <"
+test_expr "set variable v_long=0x7FFF" "print v_long > 0" "\\$\[0-9\]* = 1"  "print v_long > 0x7FFF" "\\$\[0-9\]* = 0"  "print signed long >"
 # make long a minus
-send "set variable v_long=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_long == 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_long == -1\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed long == (minus)" }
-                   -re "$prompt $"                      { fail "print signed long == (minus)" }
-                   timeout                              { fail "(timeout) print signed long == (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed long == (minus)" }
-           timeout                              { fail "(timeout) print signed long == (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed long == (minus)" }
-    timeout                                      { fail "(timeout) print signed long == (minus)" }
-}
-
-
-send "set variable v_long=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_long != 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_long != -1\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed long != (minus)" }
-                   -re "$prompt $"                      { fail "print signed long != (minus)" }
-                   timeout                              { fail "(timeout) print signed long != (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed long != (minus)" }
-           timeout                              { fail "(timeout) print signed long != (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed long != (minus)" }
-    timeout                                      { fail "(timeout) print signed long != (minus)" }
-}
-
-
-send "set variable v_long=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_long < 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_long < 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed long < (minus)" }
-                   -re "$prompt $"                      { fail "print signed long < (minus)" }
-                   timeout                              { fail "(timeout) print signed long < (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed long < (minus)" }
-           timeout                              { fail "(timeout) print signed long < (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed long < (minus)" }
-    timeout                                      { fail "(timeout) print signed long < (minus)" }
-}
-
-
-send "set variable v_long=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_long > 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_long > 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed long > (minus)" }
-                   -re "$prompt $"                      { fail "print signed long > (minus)" }
-                   timeout                              { fail "(timeout) print signed long > (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed long > (minus)" }
-           timeout                              { fail "(timeout) print signed long > (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed long > (minus)" }
-    timeout                                      { fail "(timeout) print signed long > (minus)" }
-}
-
-
+test_expr "set variable v_long=-1" "print v_long == 0" "\\$\[0-9\]* = 0"  "print v_long == -1" "\\$\[0-9\]* = 1"  "print signed long == (minus)"
+test_expr "set variable v_long=-1" "print v_long != 0" "\\$\[0-9\]* = 1"  "print v_long != -1" "\\$\[0-9\]* = 0"  "print signed long != (minus)"
+test_expr "set variable v_long=-1" "print v_long < 0" "\\$\[0-9\]* = 1"  "print v_long < 0x7FFF" "\\$\[0-9\]* = 1"  "print signed long < (minus)"
+test_expr "set variable v_long=-1" "print v_long > 0" "\\$\[0-9\]* = 0"  "print v_long > 0x7FFF" "\\$\[0-9\]* = 0"  "print signed long > (minus)"
 #
 # test expressions with "signed long" types
 #
-send "set variable v_signed_long=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_long == 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_signed_long == 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed signed long ==" }
-                   -re "$prompt $"                      { fail "print signed signed long ==" }
-                   timeout                              { fail "(timeout) print signed signed long ==" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed signed long ==" }
-           timeout                              { fail "(timeout) print signed signed long ==" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed signed long ==" }
-    timeout                                      { fail "(timeout) print signed signed long ==" }
-}
-
-
-send "set variable v_signed_long=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_long != 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_signed_long != 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed long !=" }
-                   -re "$prompt $"                      { fail "print signed signed long !=" }
-                   timeout                              { fail "(timeout) print signed signed long !=" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed signed long !=" }
-           timeout                              { fail "(timeout) print signed signed long !=" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed signed long !=" }
-    timeout                                      { fail "(timeout) print signed signed long !=" }
-}
-
-
-send "set variable v_signed_long=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_long < 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_signed_long < 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed long <" }
-                   -re "$prompt $"                      { fail "print signed signed long <" }
-                   timeout                              { fail "(timeout) print signed signed long <" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed signed long <" }
-           timeout                              { fail "(timeout) print signed signed long <" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed signed long <" }
-    timeout                                      { fail "(timeout) print signed signed long <" }
-}
-
-
-send "set variable v_signed_long=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_long > 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_signed_long > 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed long >" }
-                   -re "$prompt $"                      { fail "print signed signed long >" }
-                   timeout                              { fail "(timeout) print signed signed long >" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed signed long >" }
-           timeout                              { fail "(timeout) print signed signed long >" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed signed long >" }
-    timeout                                      { fail "(timeout) print signed signed long >" }
-}
-
-
+test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long == 0" "\\$\[0-9\]* = 0"  "print v_signed_long == 0x7FFF" "\\$\[0-9\]* = 1"  "print signed signed long =="
+test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long != 0" "\\$\[0-9\]* = 1"  "print v_signed_long != 0x7FFF" "\\$\[0-9\]* = 0"  "print signed signed long !="
+test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long < 0" "\\$\[0-9\]* = 0"  "print v_signed_long < 0x7FFF" "\\$\[0-9\]* = 0"  "print signed signed long <"
+test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long > 0" "\\$\[0-9\]* = 1"  "print v_signed_long > 0x7FFF" "\\$\[0-9\]* = 0"  "print signed signed long >"
 # make long a minus
-send "set variable v_signed_long=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_long == 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_signed_long == -1\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed signed long == (minus)" }
-                   -re "$prompt $"                      { fail "print signed signed long == (minus)" }
-                   timeout                              { fail "(timeout) print signed signed long == (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed signed long == (minus)" }
-           timeout                              { fail "(timeout) print signed signed long == (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed signed long == (minus)" }
-    timeout                                      { fail "(timeout) print signed signed long == (minus)" }
-}
-
-
-send "set variable v_signed_long=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_long != 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_signed_long != -1\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed long != (minus)" }
-                   -re "$prompt $"                      { fail "print signed signed long != (minus)" }
-                   timeout                              { fail "(timeout) print signed signed long != (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed signed long != (minus)" }
-           timeout                              { fail "(timeout) print signed signed long != (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed signed long != (minus)" }
-    timeout                                      { fail "(timeout) print signed signed long != (minus)" }
-}
-
-
-send "set variable v_signed_long=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_long < 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_signed_long < 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print signed signed long < (minus)" }
-                   -re "$prompt $"                      { fail "print signed signed long < (minus)" }
-                   timeout                              { fail "(timeout) print signed signed long < (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed signed long < (minus)" }
-           timeout                              { fail "(timeout) print signed signed long < (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed signed long < (minus)" }
-    timeout                                      { fail "(timeout) print signed signed long < (minus)" }
-}
-
-
-send "set variable v_signed_long=-1\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_long > 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_signed_long > 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print signed signed long > (minus)" }
-                   -re "$prompt $"                      { fail "print signed signed long > (minus)" }
-                   timeout                              { fail "(timeout) print signed signed long > (minus)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print signed signed long > (minus)" }
-           timeout                              { fail "(timeout) print signed signed long > (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print signed signed long > (minus)" }
-    timeout                                      { fail "(timeout) print signed signed long > (minus)" }
-}
-
-
+test_expr "set variable v_signed_long=-1" "print v_signed_long == 0" "\\$\[0-9\]* = 0"  "print v_signed_long == -1" "\\$\[0-9\]* = 1"  "print signed signed long == (minus)"
+test_expr "set variable v_signed_long=-1" "print v_signed_long != 0" "\\$\[0-9\]* = 1"  "print v_signed_long != -1" "\\$\[0-9\]* = 0"  "print signed signed long != (minus)"
+test_expr "set variable v_signed_long=-1" "print v_signed_long < 0" "\\$\[0-9\]* = 1"  "print v_signed_long < 0x7FFF" "\\$\[0-9\]* = 1"  "print signed signed long < (minus)"
+test_expr "set variable v_signed_long=-1" "print v_signed_long > 0" "\\$\[0-9\]* = 0"  "print v_signed_long > 0x7FFF" "\\$\[0-9\]* = 0"  "print signed signed long > (minus)"
 #
 # test expressions with "unsigned long" types
 #
-send "set variable v_unsigned_long=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_long == 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_unsigned_long == 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print unsigned long ==" }
-                   -re "$prompt $"                      { fail "print unsigned long ==" }
-                   timeout                              { fail "(timeout) print unsigned long ==" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned long ==" }
-           timeout                              { fail "(timeout) print unsigned long ==" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned long ==" }
-    timeout                                      { fail "(timeout) print unsigned long ==" }
-}
-
-
-send "set variable v_unsigned_long=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_long != 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_unsigned_long != 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned long !=" }
-                   -re "$prompt $"                      { fail "print unsigned long !=" }
-                   timeout                              { fail "(timeout) print unsigned long !=" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned long !=" }
-           timeout                              { fail "(timeout) print unsigned long !=" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned long !=" }
-    timeout                                      { fail "(timeout) print unsigned long !=" }
-}
-
-
-send "set variable v_unsigned_long=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_long < 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_unsigned_long < 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned long <" }
-                   -re "$prompt $"                      { fail "print unsigned long <" }
-                   timeout                              { fail "(timeout) print unsigned long <" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned long <" }
-           timeout                              { fail "(timeout) print unsigned long <" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned long <" }
-    timeout                                      { fail "(timeout) print unsigned long <" }
-}
-
-
-send "set variable v_unsigned_long=0x7FFF\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_long > 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_unsigned_long > 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned long >" }
-                   -re "$prompt $"                      { fail "print unsigned long >" }
-                   timeout                              { fail "(timeout) print unsigned long >" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned long >" }
-           timeout                              { fail "(timeout) print unsigned long >" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned long >" }
-    timeout                                      { fail "(timeout) print unsigned long >" }
-}
-
-
+test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long == 0" "\\$\[0-9\]* = 0"  "print v_unsigned_long == 0x7FFF" "\\$\[0-9\]* = 1"  "print unsigned long =="
+test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long != 0" "\\$\[0-9\]* = 1"  "print v_unsigned_long != 0x7FFF" "\\$\[0-9\]* = 0"  "print unsigned long !="
+test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long < 0" "\\$\[0-9\]* = 0"  "print v_unsigned_long < 0x7FFF" "\\$\[0-9\]* = 0"  "print unsigned long <"
+test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long > 0" "\\$\[0-9\]* = 1"  "print v_unsigned_long > 0x7FFF" "\\$\[0-9\]* = 0"  "print unsigned long >"
 # make long a minus
-send "set variable v_unsigned_long=~0\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_long == 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_unsigned_long == ~0\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" {
-                       send "print v_unsigned_long == (unsigned long)~0\n"
-                       expect {
-                           -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print unsigned long == (~0)" }
-                           -re "$prompt $"                      { fail "print unsigned long == (~0)" }
-                           timeout                              { fail "(timeout) print unsigned long == (~0)" }
-                       }
-                   }
-                   -re "$prompt $"                      { fail "print unsigned long == (~0)" }
-                   timeout                              { fail "(timeout) print unsigned long == (~0)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned long == (~0)" }
-           timeout                              { fail "(timeout) print unsigned long == (~0)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned long == (~0)" }
-    timeout                                      { fail "(timeout) print unsigned long == (~0)" }
-}
-
-
-send "set variable v_unsigned_long=~0\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_long != 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_unsigned_long != (unsigned long)~0\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned long != (~0)" }
-                   -re "$prompt $"                      { fail "print unsigned long != (~0)" }
-                   timeout                              { fail "(timeout) print unsigned long != (~0)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned long != (~0)" }
-           timeout                              { fail "(timeout) print unsigned long != (~0)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned long != (~0)" }
-    timeout                                      { fail "(timeout) print unsigned long != (~0)" }
-}
-
-
-send "set variable v_unsigned_long=~0\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_long < 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 0.*$prompt $" {
-               send "print v_unsigned_long < 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 0.*$prompt $" { pass "print unsigned long < (~0)" }
-                   -re "$prompt $"                      { fail "print unsigned long < (~0)" }
-                   timeout                              { fail "(timeout) print unsigned long < (~0)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned long < (~0)" }
-           timeout                              { fail "(timeout) print unsigned long < (~0)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned long < (~0)" }
-    timeout                                      { fail "(timeout) print unsigned long < (~0)" }
-}
-
-
-send "set variable v_unsigned_long=~0\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_long > 0\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $" {
-               send "print v_unsigned_long > 0x7FFF\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 1.*$prompt $" { pass "print unsigned long > (~0)" }
-                   -re "$prompt $"                      { fail "print unsigned long > (~0)" }
-                   timeout                              { fail "(timeout) print unsigned long > (~0)" }
-               }
-           }
-           -re "$prompt $"                      { fail "print unsigned long > (~0)" }
-           timeout                              { fail "(timeout) print unsigned long > (~0)" }
-       }
-    }
-    -re "$prompt $"                              { fail "print unsigned long > (~0)" }
-    timeout                                      { fail "(timeout) print unsigned long > (~0)" }
-}
+test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long == 0" "\\$\[0-9\]* = 0"  "print v_unsigned_long == ~0" "\\$\[0-9\]* = 1"  "print v_unsigned_long == (unsigned long)~0" "\\$\[0-9\]* = 1"  "print unsigned long == (~0)"
+test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long != 0" "\\$\[0-9\]* = 1"  "print v_unsigned_long != (unsigned long)~0" "\\$\[0-9\]* = 0"  "print unsigned long != (~0)"
+test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long < 0" "\\$\[0-9\]* = 0"  "print v_unsigned_long < 0x7FFF" "\\$\[0-9\]* = 0"  "print unsigned long < (~0)"
+test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long > 0" "\\$\[0-9\]* = 1"  "print v_unsigned_long > 0x7FFF" "\\$\[0-9\]* = 1"  "print unsigned long > (~0)"
index 711f322a7536eef6ea7e7e1bf6f9a05d4493656c..b9acdc6eaf0563c684aacc1033bb42b06c450b57 100644 (file)
 
 # This file was written by Fred Fish. (fnf@cygnus.com)
 
-if $tracelevel then {
-       strace $tracelevel
+if $tracelevel {
+    strace $tracelevel
 }
 
 set prms_id 0
 set bug_id 0
 
 set testfile "funcargs"
-set srcfile ${srcdir}/$subdir/${testfile}.c
+set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
-if  { [compile "${srcfile} -g -o ${binfile}"] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     perror "Couldn't compile ${srcfile}"
     return -1
 }
 
-execute_anywhere "rm -f ${binfile}.ci"
-if  { [compile "-E ${srcdir}/${subdir}/compiler.c > ${binfile}.ci"] != "" } {
-    perror "Couldn't make ${testfile}.ci file"
-    return -1
+# Create and source the file that provides information about the compiler
+# used to compile the test case.
+if [get_compiler_info ${binfile}] {
+    return -1;
 }
 
 #
@@ -48,14 +48,15 @@ proc integral_args {} {
     global prompt
     global det_file
     global gcc_compiled
+    global gdb_spawn_id
 
     delete_breakpoints
 
-    send "break call0a\n" ; expect -re ".*$prompt $"
-    send "break call0b\n" ; expect -re ".*$prompt $"
-    send "break call0c\n" ; expect -re ".*$prompt $"
-    send "break call0d\n" ; expect -re ".*$prompt $"
-    send "break call0e\n" ; expect -re ".*$prompt $"
+    gdb_breakpoint call0a
+    gdb_breakpoint call0b
+    gdb_breakpoint call0c
+    gdb_breakpoint call0d
+    gdb_breakpoint call0e
 
     # Run; should stop at call0a and print actual arguments.
     # The a29k fails all of these tests, perhaps because the prologue
@@ -64,11 +65,11 @@ proc integral_args {} {
     if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
     gdb_run_cmd
     expect {
-       -re ".* call0a \\(c=97 'a', s=1, i=2, l=3\\) .*$prompt $" {
+       -i $gdb_spawn_id -re ".* call0a \\(c=97 'a', s=1, i=2, l=3\\) .*$prompt $" {
            pass "run to call0a"
        }
-       -re "$prompt $"  { fail "run to call0a" ; return }
-       timeout { fail "(timeout) run to call0a" ; return }
+       -i $gdb_spawn_id -re "$prompt $"  { fail "run to call0a" ; return }
+       -i $gdb_spawn_id timeout { fail "(timeout) run to call0a" ; return }
     }
 
     # Print each arg as a double check to see if we can print
@@ -107,14 +108,15 @@ proc unsigned_integral_args {} {
     global prompt
     global det_file
     global gcc_compiled
+    global gdb_spawn_id
 
     delete_breakpoints
 
-    send "break call1a\n" ; expect -re ".*$prompt $"
-    send "break call1b\n" ; expect -re ".*$prompt $"
-    send "break call1c\n" ; expect -re ".*$prompt $"
-    send "break call1d\n" ; expect -re ".*$prompt $"
-    send "break call1e\n" ; expect -re ".*$prompt $"
+    gdb_breakpoint call1a;
+    gdb_breakpoint call1b;
+    gdb_breakpoint call1c;
+    gdb_breakpoint call1d;
+    gdb_breakpoint call1e;
 
     # Run; should stop at call1a and print actual arguments.
     # The a29k fails all of these tests, perhaps because the prologue
@@ -123,11 +125,11 @@ proc unsigned_integral_args {} {
     if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
     gdb_run_cmd
     expect {
-       -re ".* call1a \\(uc=98 'b', us=6, ui=7, ul=8\\) .*$prompt $" {
+       -i $gdb_spawn_id -re ".* call1a \\(uc=98 'b', us=6, ui=7, ul=8\\) .*$prompt $" {
            pass "run to call1a"
        }
-       -re "$prompt $" { fail "run to call1a" ; return }
-       timeout { fail "(timeout) run to call1a" ; return }
+       -i $gdb_spawn_id -re "$prompt $" { fail "run to call1a" ; return }
+       -i $gdb_spawn_id timeout { fail "(timeout) run to call1a" ; return }
     }
 
     # Print each arg as a double check to see if we can print
@@ -166,17 +168,18 @@ proc float_and_integral_args {} {
     global prompt
     global det_file
     global gcc_compiled
+    global gdb_spawn_id
 
     delete_breakpoints
 
-    send "break call2a\n" ; expect -re ".*$prompt $"
-    send "break call2b\n" ; expect -re ".*$prompt $"
-    send "break call2c\n" ; expect -re ".*$prompt $"
-    send "break call2d\n" ; expect -re ".*$prompt $"
-    send "break call2e\n" ; expect -re ".*$prompt $"
-    send "break call2f\n" ; expect -re ".*$prompt $"
-    send "break call2g\n" ; expect -re ".*$prompt $"
-    send "break call2h\n" ; expect -re ".*$prompt $"
+    gdb_breakpoint call2a
+    gdb_breakpoint call2b
+    gdb_breakpoint call2c
+    gdb_breakpoint call2d
+    gdb_breakpoint call2e
+    gdb_breakpoint call2f
+    gdb_breakpoint call2g
+    gdb_breakpoint call2h
 
     # Run; should stop at call2a and print actual arguments.
 
@@ -187,9 +190,9 @@ proc float_and_integral_args {} {
     if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
     gdb_run_cmd
     expect {
-       -re ".* call2a \\(c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$prompt $" { pass "run to call2a" }
-       -re "$prompt $" { fail "run to call2a" ; return }
-       timeout { fail "(timeout) run to call2a" ; return }
+       -i $gdb_spawn_id -re ".* call2a \\(c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$prompt $" { pass "run to call2a" }
+       -i $gdb_spawn_id -re "$prompt $" { fail "run to call2a" ; return }
+       -i $gdb_spawn_id timeout { fail "(timeout) run to call2a" ; return }
     }
 
     # Print each arg as a double check to see if we can print
@@ -229,7 +232,6 @@ proc float_and_integral_args {} {
        return
     }
 
-    if {$gcc_compiled} then { setup_xfail "mips-sgi-irix4*" }
     # Continue; should stop at call2g and print actual arguments.
     if [gdb_test "cont" ".* call2g \\(l=3, d2=5, c=97 'a', f1=4, s=1, d1=5, i=2, f2=4\\) .*" "continue to call2g"] {
        return
@@ -243,7 +245,7 @@ proc float_and_integral_args {} {
     # monitor only allows 8 breakpoints; w89k board allows 10, so
     # break them up into two groups.
     delete_breakpoints
-    send "break call2i\n" ; expect -re ".*$prompt $"
+    gdb_breakpoint call2i
 
     # Continue; should stop at call2i and print actual arguments.
     if [gdb_test "cont" ".* call2i \\(c1=97 'a', f1=4, c2=97 'a', c3=97 'a', d1=5, c4=97 'a', c5=97 'a', c6=97 'a', f2=4, s=1, c7=97 'a', d2=5\\) .*" "continue to call2i"] {
@@ -259,12 +261,13 @@ proc pointer_args {} {
     global prompt
     global hex
     global det_file
+    global gdb_spawn_id
 
     delete_breakpoints
 
-    send "break call3a\n" ; expect -re ".*$prompt $"
-    send "break call3b\n" ; expect -re ".*$prompt $"
-    send "break call3c\n" ; expect -re ".*$prompt $"
+    gdb_breakpoint call3a
+    gdb_breakpoint call3b
+    gdb_breakpoint call3c
 
     # Run; should stop at call3a and print actual arguments.
     # Try dereferencing the arguments.
@@ -274,9 +277,9 @@ proc pointer_args {} {
     setup_xfail "a29k-*-udi"
     gdb_run_cmd
     expect {
-       -re ".* call3a \\(cp=$hex \"a\", sp=$hex, ip=$hex, lp=$hex\\) .*$prompt $" { pass "run to call3a" }
-       -re "$prompt $" { fail "run to call3a" ; return }
-       timeout { fail "(timeout) run to call3a" ; return }
+       -i $gdb_spawn_id -re ".* call3a \\(cp=$hex \"a\", sp=$hex, ip=$hex, lp=$hex\\) .*$prompt $" { pass "run to call3a" }
+       -i $gdb_spawn_id -re "$prompt $" { fail "run to call3a" ; return }
+       -i $gdb_spawn_id timeout { fail "(timeout) run to call3a" ; return }
     }
 
     gdb_test "print *cp" ".* = 97 'a'"
@@ -315,11 +318,12 @@ proc structs_by_reference {} {
     global prompt
     global hex
     global det_file
+    global gdb_spawn_id
 
     delete_breakpoints
 
-    send "break call4a\n" ; expect -re ".*$prompt $"
-    send "break call4b\n" ; expect -re ".*$prompt $"
+    gdb_breakpoint call4a
+    gdb_breakpoint call4b
 
     # Run; should stop at call4a and print actual arguments.
     # Try dereferencing the arguments.
@@ -329,11 +333,11 @@ proc structs_by_reference {} {
     setup_xfail "a29k-*-udi"
     gdb_run_cmd
     expect {
-       -re ".* call4a \\(stp=$hex\\) .*$prompt $" {
+       -i $gdb_spawn_id -re ".* call4a \\(stp=$hex\\) .*$prompt $" {
            pass "run to call4a"
        }
-       -re "$prompt $" { fail "run to call4a" ; return }
-       timeout { fail "(timeout) run to call4a" ; return }
+       -i $gdb_spawn_id -re "$prompt $" { fail "run to call4a" ; return }
+       -i $gdb_spawn_id timeout { fail "(timeout) run to call4a" ; return }
     }
 
     gdb_test "print *stp" ".* = \{s1 = 101, s2 = 102\}"
@@ -343,6 +347,8 @@ proc structs_by_reference {} {
 
     gdb_test "cont" ".* call4b \\(unp=$hex\\) .*" "continue to call4b"
 
+    # sizeof int != sizeof long on h8300
+    setup_xfail "h8300*-*-*"
     gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}"
 
     pass "locate actual args, structs/unions passed by reference"
@@ -356,11 +362,12 @@ proc structs_by_value {} {
     global prompt
     global hex
     global det_file
+    global gdb_spawn_id
 
     delete_breakpoints
 
-    send "break call5a\n" ; expect -re ".*$prompt $"
-    send "break call5b\n" ; expect -re ".*$prompt $"
+    gdb_breakpoint call5a
+    gdb_breakpoint call5b
 
     # Run; should stop at call5a and print actual arguments.
     # Try dereferencing the arguments.
@@ -370,20 +377,24 @@ proc structs_by_value {} {
     setup_xfail "a29k-*-udi"
     gdb_run_cmd
     expect {
-       -re ".* call5a \\(st=\{s1 = 101, s2 = 102\}\\) .*$prompt $" {
+       -i $gdb_spawn_id -re ".* call5a \\(st=\{s1 = 101, s2 = 102\}\\) .*$prompt $" {
            pass "run to call5a"
        }
-       -re "$prompt $" { fail "run to call5a" ; return }
-       timeout { fail "(timeout) run to call5a" ; return }
+       -i $gdb_spawn_id -re "$prompt $" { fail "run to call5a" ; return }
+       -i $gdb_spawn_id timeout { fail "(timeout) run to call5a" ; return }
     }
 
     gdb_test "print st" ".* = \{s1 = 101, s2 = 102\}"
 
     # Continue; should stop at call5b and print actual arguments.
     # Try dereferencing the arguments.
+    # sizeof int != sizeof long on h8300
+    setup_xfail "h8300*-*-*"
     gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 2\}\\) .*" \
        "continue to call5b"
 
+    # sizeof int != sizeof long on h8300
+    setup_xfail "h8300*-*-*"
     gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}"
 }
 
@@ -397,17 +408,18 @@ proc discard_and_shuffle {} {
     global decimal
     global det_file
     global gcc_compiled
+    global gdb_spawn_id
 
     delete_breakpoints
 
-    send "break call6a\n" ; expect -re ".*$prompt $"
-    send "break call6b\n" ; expect -re ".*$prompt $"
-    send "break call6c\n" ; expect -re ".*$prompt $"
-    send "break call6d\n" ; expect -re ".*$prompt $"
-    send "break call6e\n" ; expect -re ".*$prompt $"
-    send "break call6f\n" ; expect -re ".*$prompt $"
-    send "break call6g\n" ; expect -re ".*$prompt $"
-    send "break call6h\n" ; expect -re ".*$prompt $"
+    gdb_breakpoint call6a
+    gdb_breakpoint call6b
+    gdb_breakpoint call6c
+    gdb_breakpoint call6d
+    gdb_breakpoint call6e
+    gdb_breakpoint call6f
+    gdb_breakpoint call6g
+    gdb_breakpoint call6h
 
     # Run; should stop at call6a and print actual arguments.
     # Print backtrace.
@@ -417,253 +429,106 @@ proc discard_and_shuffle {} {
     setup_xfail "a29k-*-udi"
     gdb_run_cmd
     expect {
-       -re ".*Breakpoint $decimal, call6a .*$prompt $" { pass "run to call6a" }
-       -re "$prompt $" { fail "run to call6a" ; return }
-       timeout { fail "(timeout) run to call6a" ; return }
+       -i $gdb_spawn_id -re ".*Breakpoint $decimal, call6a .*$prompt $" { pass "run to call6a" }
+       -i $gdb_spawn_id -re "$prompt $" { fail "run to call6a" ; return }
+       -i $gdb_spawn_id timeout { fail "(timeout) run to call6a" ; return }
     }
 
     setup_xfail "rs6000-*-*"
-    if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" }
-    send "backtrace 100\n"
-    expect {
-       -re "backtrace 100\[\r\n\]+
-.* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* main \\(.*\\) .*\r
-$prompt $" { pass "backtrace from call6a" }
-       -re "$prompt $" { fail "backtrace from call6a" ; return }
-       timeout { fail "(timeout) backtrace from call6a" ; return }
+
+    if {!$gcc_compiled} {
+       setup_xfail "mips-sgi-irix5*"
+    }
+
+    if [gdb_test "backtrace 100" ".* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\]" "backtrace from call6a"] {
+       return;
     }
 
     # Continue; should stop at call6b and print actual arguments.
     # Print backtrace.
 
-    send "continue\n"
-    expect {
-       -re ".*Breakpoint $decimal, call6b .*$prompt $" { pass "continue to call6b" }
-       -re "$prompt $" { fail "continue to call6b" ; return }
-       timeout { fail "(timeout) continue to call6b" ; return }
-    }
+    gdb_continue call6b
 
-    send "backtrace 100\n"
-    expect {
-       -re "backtrace 100\[\r\n]+
-.* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* main \\(.*\\) .*\r
-$prompt $" { pass "backtrace from call6b" }
-       -re "$prompt $" { fail "backtrace from call6b" ; return }
-       timeout { fail "(timeout) backtrace from call6b" ; return }
+    if [gdb_test "backtrace 100" ".* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\]*.* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\]" "backtrace from call6b"] {
+       return;
     }
 
     # Continue; should stop at call6c and print actual arguments.
     # Print backtrace.
 
-    send "continue\n"
-    expect {
-       -re ".*Breakpoint $decimal, call6c .*$prompt $" { pass "continue to call6c" }
-       -re "$prompt $" { fail "continue to call6c" ; return }
-       timeout { fail "(timeout) continue to call6c" ; return }
-    }
+    gdb_continue call6c
 
-    send "backtrace 100\n"
-    expect {
-       -re "backtrace 100\[\r\n\]+
-.* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* main \\(.*\\) .*\r
-$prompt $" { pass "backtrace from call6c" }
-       -re "$prompt $" { fail "backtrace from call6c" ; return }
-       timeout { fail "(timeout) backtrace from call6c" ; return }
+    if [gdb_test "backtrace 100" ".* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6c"] {
+       return;
     }
-
     # Continue; should stop at call6d and print actual arguments.
     # Print backtrace.
 
-    send "continue\n"
-    expect {
-       -re ".*Breakpoint $decimal, call6d .*$prompt $" { pass "continue to call6d" }
-       -re "$prompt $" { fail "continue to call6d" ; return }
-       timeout { fail "(timeout) continue to call6d" ; return }
-    }
+    gdb_continue call6d
 
-    send "backtrace 100\n"
-    expect {
-       -re "backtrace 100\[\r\n\]+
-.* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* main \\(.*\\) .*\r
-$prompt $" { pass "backtrace from call6d" }
-       -re "$prompt $" { fail "backtrace from call6d" ; return }
-       timeout { fail "(timeout) backtrace from call6d" ; return }
+    if [gdb_test "backtrace 100" ".* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6d"] {
+       return;
     }
 
     # Continue; should stop at call6e and print actual arguments.
     # Print backtrace.
 
-    send "continue\n"
-    expect {
-       -re ".*Breakpoint $decimal, call6e .*$prompt $" { pass "continue to call6e" }
-       -re "$prompt $" { fail "continue to call6e" ; return }
-       timeout { fail "(timeout) continue to call6e" ; return }
-    }
+    gdb_continue call6e
 
-    send "backtrace 100\n"
-    expect {
-       -re "backtrace 100\[\r\n\]+
-.* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* main \\(.*\\) .*\r
-$prompt $" { pass "backtrace from call6e" }
-       -re "$prompt $" { fail "backtrace from call6e" ; return }
-       timeout { fail "(timeout) backtrace from call6e" ; return }
+    if [gdb_test "backtrace 100" ".* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6e"] {
+       return;
     }
 
     # Continue; should stop at call6f and print actual arguments.
     # Print backtrace.
 
-    send "continue\n"
-    expect {
-       -re ".*Breakpoint $decimal, call6f .*$prompt $" { pass "continue to call6f" }
-       -re "$prompt $" { fail "continue to call6f" ; return }
-       timeout { fail "(timeout) continue to call6f" ; return }
-    }
+    gdb_continue call6f
 
-    send "backtrace 100\n"
-    expect {
-       -re "backtrace 100\[\r\n\]+
-.* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* main \\(.*\\) .*\r
-$prompt $" { pass "backtrace from call6f" }
-       -re "$prompt $" { fail "backtrace from call6f" ; return }
-       timeout { fail "(timeout) backtrace from call6f" ; return }
+    if [gdb_test "backtrace 100" ".* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6f"] {
+       return;
     }
 
     # Continue; should stop at call6g and print actual arguments.
     # Print backtrace.
 
-    send "continue\n"
-    expect {
-       -re ".*Breakpoint $decimal, call6g .*$prompt $" { pass "continue to call6g" }
-       -re "$prompt $" { fail "continue to call6g" ; return }
-       timeout { fail "(timeout) continue to call6g" ; return }
-    }
+    gdb_continue call6g
 
-    send "backtrace 100\n"
-    expect {
-       -re "backtrace 100\[\r\n\]+
-.* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* main \\(.*\\) .*\r
-$prompt $" { pass "backtrace from call6g" }
-       -re "$prompt $" { fail "backtrace from call6g" ; return }
-       timeout { fail "(timeout) backtrace from call6g" ; return }
+    if [gdb_test "backtrace 100" ".* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6g"] {
+       return;
     }
 
     # Continue; should stop at call6h and print actual arguments.
     # Print backtrace.
 
-    send "continue\n"
-    expect {
-       -re ".*Breakpoint $decimal, call6h .*$prompt $" { pass "continue to call6h" }
-       -re "$prompt $" { fail "continue to call6h" ; return }
-       timeout { fail "(timeout) continue to call6h" ; return }
-    }
+    gdb_continue call6h
 
-    send "backtrace 100\n"
-    expect {
-       -re "backtrace 100\[\r\n\]+
-.* call6h \\(us=6, ui=7, ul=8\\) .*\r
-.* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* main \\(.*\\) .*\r
-$prompt $" { pass "backtrace from call6h" }
-       -re "$prompt $" { fail "backtrace from call6h" ; return }
-       timeout { fail "(timeout) backtrace from call6h" ; return }
+    if [gdb_test "backtrace 100" ".* call6h \\(us=6, ui=7, ul=8\\) .*\[\r\n\].* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6h"] {
+       return;
     }
 
     # monitor only allows 8 breakpoints; w89k board allows 10, so
     # break them up into two groups.
     delete_breakpoints
-    send "break call6i\n" ; expect -re ".*$prompt $"
-    send "break call6j\n" ; expect -re ".*$prompt $"
-    send "break call6k\n" ; expect -re ".*$prompt $"
+    gdb_breakpoint call6i
+    gdb_breakpoint call6j
+    gdb_breakpoint call6k
 
     # Continue; should stop at call6i and print actual arguments.
     # Print backtrace.
 
-    send "continue\n"
-    expect {
-       -re ".*Breakpoint $decimal, call6i .*$prompt $" { pass "continue to call6i" }
-       -re "$prompt $" { fail "continue to call6i" ; return }
-       timeout { fail "(timeout) continue to call6i" ; return }
-    }
+    gdb_continue call6i
 
-    send "backtrace 100\n"
-    expect {
-       -re "backtrace 100\[\r\n\]+
-.* call6i \\(ui=7, ul=8\\) .*\r
-.* call6h \\(us=6, ui=7, ul=8\\) .*\r
-.* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* main \\(.*\\) .*\r
-$prompt $" { pass "backtrace from call6i" }
-       -re "$prompt $" { fail "backtrace from call6i" ; return }
-       timeout { fail "(timeout) backtrace from call6i" ; return }
+    if [gdb_test "backtrace 100" ".* call6i \\(ui=7, ul=8\\) .*\[\r\n\].* call6h \\(us=6, ui=7, ul=8\\) .*\[\r\n\].* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6i"] {
+       return;
     }
 
     # Continue; should stop at call6j and print actual arguments.
     # Print backtrace.
 
-    send "continue\n"
-    expect {
-       -re ".*Breakpoint $decimal, call6j .*$prompt $" { pass "continue to call6j" }
-       -re "$prompt $" { fail "continue to call6j" ; return }
-       timeout { fail "(timeout) continue to call6j" ; return }
-    }
+    gdb_continue call6j
 
-    send "backtrace 100\n"
-    expect {
-       -re "backtrace 100\[\r\n\]+
-.* call6j \\(ul=8\\) .*\r
-.* call6i \\(ui=7, ul=8\\) .*\r
-.* call6h \\(us=6, ui=7, ul=8\\) .*\r
-.* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* main \\(.*\\) .*\r
-$prompt $" { pass "backtrace from call6j" }
-       -re "$prompt $" { fail "backtrace from call6j" ; return }
-       timeout { fail "(timeout) backtrace from call6j" ; return }
+    if [gdb_test "backtrace 100" ".* call6j \\(ul=8\\) .*\[\r\n\].* call6i \\(ui=7, ul=8\\) .*\[\r\n\].* call6h \\(us=6, ui=7, ul=8\\) .*\[\r\n\].* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6j"] {
+       return;
     }
 
     # Continue; should stop at call6k and print actual arguments.
@@ -671,33 +536,10 @@ $prompt $" { pass "backtrace from call6j" }
     # This fails on i960-*-vxworks because gdb gets confused by
     # breakpoints on adjacent instructions.
     setup_xfail "i960-*-vxworks" 1786
-    send "continue\n"
-    expect {
-       -re ".*Breakpoint $decimal, call6k .*$prompt $" {
-           pass "continue to call6k"
-       }
-       -re "$prompt $" { fail "continue to call6k"; return }
-       timeout { fail "(timeout) continue to call6k"; return }
-    }
+    gdb_continue call6k
 
-    send "backtrace 100\n"
-    expect {
-       -re "backtrace 100\[\r\n\]+
-.* call6k \\(\\) .*\r
-.* call6j \\(ul=8\\) .*\r
-.* call6i \\(ui=7, ul=8\\) .*\r
-.* call6h \\(us=6, ui=7, ul=8\\) .*\r
-.* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
-.* main \\(.*\\) .*\r
-$prompt $" { pass "backtrace from call6k" }
-       -re "$prompt $" { fail "backtrace from call6k" ; return }
-       timeout { fail "(timeout) backtrace from call6k" ; return }
+    if [gdb_test "backtrace 100" ".* call6k \\(\\) .*\[\r\n\].* call6j \\(ul=8\\) .*\[\r\n\].* call6i \\(ui=7, ul=8\\) .*\[\r\n\].* call6h \\(us=6, ui=7, ul=8\\) .*\[\r\n\].* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6k"] {
+       return;
     }
 }
 
@@ -711,17 +553,18 @@ proc shuffle_round_robin {} {
     global decimal
     global det_file
     global gcc_compiled
+    global gdb_spawn_id
 
     delete_breakpoints
 
-    send "break call7a\n" ; expect -re ".*$prompt $"
-    send "break call7b\n" ; expect -re ".*$prompt $"
-    send "break call7c\n" ; expect -re ".*$prompt $"
-    send "break call7d\n" ; expect -re ".*$prompt $"
-    send "break call7e\n" ; expect -re ".*$prompt $"
-    send "break call7f\n" ; expect -re ".*$prompt $"
-    send "break call7g\n" ; expect -re ".*$prompt $"
-    send "break call7h\n" ; expect -re ".*$prompt $"
+    gdb_breakpoint call7a
+    gdb_breakpoint call7b
+    gdb_breakpoint call7c
+    gdb_breakpoint call7d
+    gdb_breakpoint call7e
+    gdb_breakpoint call7f
+    gdb_breakpoint call7g
+    gdb_breakpoint call7h
 
     # Run; should stop at call7a and print actual arguments.
     # Print backtrace.
@@ -731,288 +574,90 @@ proc shuffle_round_robin {} {
     setup_xfail "a29k-*-udi"
     gdb_run_cmd
     expect {
-       -re ".*Breakpoint $decimal, call7a .*$prompt $" {
+       -i $gdb_spawn_id -re ".*Breakpoint $decimal, call7a .*$prompt $" {
            pass "run to call7a"
        }
-       -re "$prompt $" { fail "run to call7a" ; return }
-       timeout { fail "(timeout) run to call7a" ; return }
+       -i $gdb_spawn_id -re "$prompt $" { fail "run to call7a" ; return }
+       -i $gdb_spawn_id timeout { fail "(timeout) run to call7a" ; return }
     }
 
     setup_xfail "i960-*-*" 1813
     if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
-    send "backtrace 100\n"
-    expect {
-       -re "backtrace 100\[\r\n\]+
-.* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
-.* main \\(.*\\) .*\r
-$prompt $" { pass "backtrace from call7a" }
-       -re "$prompt $" { fail "backtrace from call7a" ; return }
-       timeout { fail "(timeout) backtrace from call7a" ; return }
-    }
+    gdb_test "backtrace 100" ".* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7a"
 
     # Continue; should stop at call7b and print actual arguments.
     # Print backtrace.
 
-    send "continue\n"
-    expect {
-       -re ".*Breakpoint $decimal, call7b .*$prompt $" { pass "continue to call7b" }
-       -re "$prompt $" { fail "continue to call7b" ; return }
-       timeout { fail "(timeout) continue to call7b" ; return }
-    }
+    gdb_continue call7b
 
     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    send "backtrace 100\n"
-    expect {
-       -re "backtrace 100\[\r\n\]+
-.* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
-.* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
-.* main \\(.*\\) .*\r
-$prompt $" { pass "backtrace from call7b" }
-       -re "$prompt $" { fail "backtrace from call7b" ; return }
-       timeout { fail "(timeout) backtrace from call7b" ; return }
-    }
+
+    gdb_test "backtrace 100" ".* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7b"
 
     # Continue; should stop at call7c and print actual arguments.
     # Print backtrace.
 
-    send "continue\n"
-    expect {
-       -re ".*Breakpoint $decimal, call7c .*$prompt $" { pass "continue to call7c" }
-       -re "$prompt $" { fail "continue to call7c" ; return }
-       timeout { fail "(timeout) continue to call7c" ; return }
-    }
+    gdb_continue call7c
 
-    send "backtrace 100\n"
-    expect {
-       -re "backtrace 100\[\r\n\]+
-.* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
-.* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
-.* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
-.* main \\(.*\\) .*\r
-$prompt $" { pass "backtrace from call7c" }
-       -re "$prompt $" { fail "backtrace from call7c" ; return }
-       timeout { fail "(timeout) backtrace from call7c" ; return }
-    }
+    gdb_test "backtrace 100" ".* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7c"
 
     # Continue; should stop at call7d and print actual arguments.
     # Print backtrace.
 
-    send "continue\n"
-    expect {
-       -re ".*Breakpoint $decimal, call7d .*$prompt $" { pass "continue to call7d" }
-       -re "$prompt $" { fail "continue to call7d" ; return }
-       timeout { fail "(timeout) continue to call7d" ; return }
-    }
+    gdb_continue call7d
 
-    send "backtrace 100\n"
-    expect {
-       -re "backtrace 100\[\r\n\]+
-.* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
-.* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
-.* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
-.* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
-.* main \\(.*\\) .*\r
-$prompt $" { pass "backtrace from call7d" }
-       -re "$prompt $" { fail "backtrace from call7d" ; return }
-       timeout { fail "(timeout) backtrace from call7d" ; return }
-    }
+    gdb_test "backtrace 100" ".* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\[\r\n\].* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7d"
 
-    # Continue; should stop at call7e and print actual arguments.
-    # Print backtrace.
-
-    send "continue\n"
-    expect {
-       -re "Breakpoint $decimal, call7e .*$prompt $" { pass "continue to call7e" }
-       -re "$prompt $" { fail "continue to call7e" ; return }
-       timeout { fail "(timeout) continue to call7e" ; return }
-    }
+    gdb_continue call7e
 
-    send "backtrace 100\n"
-    expect {
-       -re "backtrace 100\[\r\n\]+
-.* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
-.* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
-.* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
-.* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
-.* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
-.* main \\(.*\\) .*\r
-$prompt $" { pass "backtrace from call7e" }
-       -re "$prompt $" { fail "backtrace from call7e" ; return }
-       timeout { fail "(timeout) backtrace from call7e" ; return }
-    }
+    gdb_test "backtrace 100" ".* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\[\r\n\].* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\[\r\n\].* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7e"
 
     # Continue; should stop at call7f and print actual arguments.
     # Print backtrace.
 
-    send "continue\n"
-    expect {
-       -re ".*Breakpoint $decimal, call7f .*$prompt $" { pass "continue to call7f" }
-       -re "$prompt $" { fail "continue to call7f" ; return }
-       timeout { fail "(timeout) continue to call7f" ; return }
-    }
+    gdb_continue call7f
 
-    send "backtrace 100\n"
-    expect {
-       -re "backtrace 100\[\r\n\]+
-.* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
-.* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
-.* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
-.* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
-.* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
-.* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
-.* main \\(.*\\) .*\r
-$prompt $" { pass "backtrace from call7f" }
-       -re "$prompt $" { fail "backtrace from call7f" ; return }
-       timeout { fail "(timeout) backtrace from call7f" ; return }
-    }
+    gdb_test "backtrace 100" ".* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\[\r\n\].* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\[\r\n\].* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\[\r\n\].* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7f"
 
     # Continue; should stop at call7g and print actual arguments.
     # Print backtrace.
 
-    send "continue\n"
-    expect {
-       -re ".*Breakpoint $decimal, call7g .*$prompt $" { pass "continue to call7g" }
-       -re "$prompt $" { fail "continue to call7g" ; return }
-       timeout { fail "(timeout) continue to call7g" ; return }
-    }
-
-    send "backtrace 100\n"
-    expect {
-       -re "backtrace 100\[\r\n\]+
-.* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
-.* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
-.* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
-.* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
-.* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
-.* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
-.* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
-.* main \\(.*\\) .*\r
-$prompt $" { pass "backtrace from call7g" }
-       -re "$prompt $" { fail "backtrace from call7g" ; return }
-       timeout { fail "(timeout) backtrace from call7g" ; return }
-    }
+    gdb_continue call7g
 
-    # Continue; should stop at call7h and print actual arguments.
-    # Print backtrace.
+    gdb_test "backtrace 100" ".* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\[\r\n\].* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\[\r\n\].* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\[\r\n\].* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\[\r\n\].* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7g"
 
-    send "continue\n"
-    expect {
-       -re ".*Breakpoint $decimal, call7h .*$prompt $" { pass "continue to call7h" }
-       -re "$prompt $" { fail "continue to call7h" ; return }
-       timeout { fail "(timeout) continue to call7h" ; return }
-    }
+    gdb_continue call7h
 
-    send "backtrace 100\n"
-    expect {
-       -re "backtrace 100\[\r\n\]+
-.* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\r
-.* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
-.* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
-.* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
-.* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
-.* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
-.* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
-.* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
-.* main \\(.*\\) .*\r
-$prompt $" { pass "backtrace from call7h" }
-       -re "$prompt $" { fail "backtrace from call7h" ; return }
-       timeout { fail "(timeout) backtrace from call7h" ; return }
-    }
+    gdb_test "backtrace 100" ".* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\[\r\n\].* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\[\r\n\].* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\[\r\n\].* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\[\r\n\].* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\[\r\n\].* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7h"
 
     # monitor only allows 8 breakpoints; w89k board allows 10, so
     # break them up into two groups.
     delete_breakpoints
-    send "break call7i\n" ; expect -re ".*$prompt $"
-    send "break call7j\n" ; expect -re ".*$prompt $"
-    send "break call7k\n" ; expect -re ".*$prompt $"
+    gdb_breakpoint call7i
+    gdb_breakpoint call7j
+    gdb_breakpoint call7k
 
     # Continue; should stop at call7i and print actual arguments.
     # Print backtrace.
 
-    send "continue\n"
-    expect {
-       -re ".*Breakpoint $decimal, call7i .*$prompt $" { pass "continue to call7i" }
-       -re "$prompt $" { fail "continue to call7i" ; return }
-       timeout { fail "(timeout) continue to call7i" ; return }
-    }
+    gdb_continue call7i
 
-    send "backtrace 100\n"
-    expect {
-       -re "backtrace 100\[\r\n\]+
-.* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\r
-.* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\r
-.* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
-.* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
-.* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
-.* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
-.* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
-.* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
-.* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
-.* main \\(.*\\) .*\r
-$prompt $" { pass "backtrace from call7i" }
-       -re "$prompt $" { fail "backtrace from call7i" ; return }
-       timeout { fail "(timeout) backtrace from call7i" ; return }
-    }
+    gdb_test "backtrace 100" ".* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\[\r\n\].* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\[\r\n\].* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\[\r\n\].* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\[\r\n\].* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\[\r\n\].* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\[\r\n\].* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7i"
 
     # Continue; should stop at call7j and print actual arguments.
     # Print backtrace.
 
-    send "continue\n"
-    expect {
-       -re ".*Breakpoint $decimal, call7j .*$prompt $" { pass "continue to call7j" }
-       -re "$prompt $" { fail "continue to call7j" ; return }
-       timeout { fail "(timeout) continue to call7j" ; return }
-    }
+    gdb_continue call7j
 
-    send "backtrace 100\n"
-    expect {
-       -re "backtrace 100\[\r\n\]+
-.* call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\) .*\r
-.* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\r
-.* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\r
-.* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
-.* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
-.* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
-.* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
-.* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
-.* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
-.* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
-.* main \\(.*\\) .*\r
-$prompt $" { pass "backtrace from call7j" }
-       -re "$prompt $" { fail "backtrace from call7j" ; return }
-       timeout { fail "(timeout) backtrace from call7j" ; return }
-    }
+    gdb_test "backtrace 100" ".* call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\) .*\[\r\n\].* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\[\r\n\].* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\[\r\n\].* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\[\r\n\].* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\[\r\n\].* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\[\r\n\].* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\[\r\n\].* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7j"
 
     # Continue; should stop at call7k and print actual arguments.
     # Print backtrace.
 
-    send "continue\n"
-    expect {
-       -re ".*Breakpoint $decimal, call7k .*$prompt $" { pass "continue to call7k" }
-       -re "$prompt $" { fail "continue to call7k" ; return }
-       timeout { fail "(timeout) continue to call7k" ; return }
-    }
+    gdb_continue call7k
 
     if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" }
-    send "backtrace 100\n"
-    expect {
-       -re "backtrace 100\[\r\n\]+
-.* call7k \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
-.* call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\) .*\r
-.* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\r
-.* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\r
-.* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
-.* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
-.* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
-.* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
-.* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
-.* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
-.* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
-.* main \\(.*\\) .*\r
-$prompt $" { pass "backtrace from call7k" }
-       -re "$prompt $" { fail "backtrace from call7k" ; return }
-       timeout { fail "(timeout) backtrace from call7k" ; return }
-    }
+    gdb_test "backtrace 100" ".* call7k \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\) .*\[\r\n\].* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\[\r\n\].* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\[\r\n\].* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\[\r\n\].* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\[\r\n\].* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\[\r\n\].* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\[\r\n\].* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7k"
 }
 
 #
@@ -1024,37 +669,28 @@ proc recursive_structs_by_value {} {
     global hex
     global decimal
     global det_file
+    global gdb_spawn_id
 
     delete_breakpoints
 
-    send "break hitbottom\n" ; expect -re ".*$prompt $"
+    gdb_breakpoint hitbottom
 
     # Run; should stop at hitbottom and print actual arguments.
     # Print backtrace.
     gdb_run_cmd
     expect {
-       -re ".*Breakpoint $decimal, hitbottom .*$prompt $" { pass "run to hitbottom" }
-       -re "$prompt $" { fail "run to hitbottom" ; return }
-       timeout { fail "(timeout) run to hitbottom" ; return }
+       -i $gdb_spawn_id -re ".*Breakpoint $decimal, hitbottom .*$prompt $" { pass "run to hitbottom" }
+       -i $gdb_spawn_id -re "$prompt $" { fail "run to hitbottom" ; return }
+       -i $gdb_spawn_id timeout { fail "(timeout) run to hitbottom" ; return }
     }
 
+    if ![istarget sparclet-*-*] {
     # The a29k fails all of these tests, perhaps because the prologue
     # code is broken.
-    setup_xfail "a29k-*-udi"
-    send "backtrace 100\n"
-    expect {
-       -re "backtrace 100\[\r\n\]+
-.* hitbottom \\(\\) .*\r
-.* recurse \\(a=\{s = 0, i = 0, l = 0\}, depth=0\\) .*\r
-.* recurse \\(a=\{s = 1, i = 1, l = 1\}, depth=1\\) .*\r
-.* recurse \\(a=\{s = 2, i = 2, l = 2\}, depth=2\\) .*\r
-.* recurse \\(a=\{s = 3, i = 3, l = 3\}, depth=3\\) .*\r
-.* recurse \\(a=\{s = 4, i = 4, l = 4\}, depth=4\\) .*\r
-.* test_struct_args \\(\\) .*\r
-.* main \\(.*\\) .*\r
-$prompt $" { pass "recursive passing of structs by value" }
-       -re "$prompt $" { fail "recursive passing of structs by value" ; return }
-       timeout { fail "(timeout) recursive passing of structs by value" ; return }
+       setup_xfail "a29k-*-udi"
+       gdb_test "backtrace 100" ".* hitbottom \\(\\) .*\[\r\n\].* recurse \\(a=\{s = 0, i = 0, l = 0\}, depth=0\\) .*\[\r\n\].* recurse \\(a=\{s = 1, i = 1, l = 1\}, depth=1\\) .*\[\r\n\].* recurse \\(a=\{s = 2, i = 2, l = 2\}, depth=2\\) .*\[\r\n\].* recurse \\(a=\{s = 3, i = 3, l = 3\}, depth=3\\) .*\[\r\n\].* recurse \\(a=\{s = 4, i = 4, l = 4\}, depth=4\\) .*\[\r\n\].* test_struct_args \\(\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\]" "recursive passing of structs by value"
+    } else {
+       fail "recursive passing of structs by value (sparclet)"
     }
 }
 
@@ -1064,7 +700,7 @@ proc funcargs_reload { } {
     global binfile
     global srcdir
 
-    if [istarget "mips-idt-*"] then {
+    if [istarget "mips-idt-*"] {
        # Restart because IDT/SIM runs out of file descriptors.
        gdb_exit
        gdb_start
@@ -1094,11 +730,8 @@ proc localvars_after_alloca { } {
     gdb_test "print i" " = 2" "print i after runto localvars_after_alloca"
     gdb_test "print l" " = 3" "print l after runto localvars_after_alloca"
 
-    send "next\n"
-    expect {
-       -re ".*$prompt $" { pass "next in localvars_after_alloca()" }
-       timeout { fail "next in localvars_after_alloca()" ; return }
-    }
+    # Lame regexp.
+    gdb_test "next" ".*" "next in localvars_after_alloca()"
 
     # Print each arg as a double check to see if we can print
     # them here as well as with backtrace.
@@ -1143,6 +776,7 @@ proc localvars_in_indirect_call { } {
     global hex
     global decimal
     global gcc_compiled
+    global gdb_spawn_id
 
     # Can not use "runto call0a" as call0a is called several times
     # during single run.  Instead stop in a marker function and
@@ -1151,9 +785,8 @@ proc localvars_in_indirect_call { } {
 
     # break on the next call to call0a, then delete all the breakpoints
     # and start testing.
-    gdb_test "break call0a" "Breakpoint .*" \
-       "break call0a in localvars_in_indirect_call"
-    gdb_test "continue" "call0a .*" "continue in localvars_in_indirect_call"
+    gdb_breakpoint call0a
+    gdb_continue call0a
     delete_breakpoints
     
     # Print each arg as a double check to see if we can print
@@ -1180,20 +813,20 @@ proc localvars_in_indirect_call { } {
     # second indirect call.
     #
 
-    send "finish\n"
+    send_gdb "finish\n"
     expect {
-       -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*First.*$prompt $" {
-           send "step\n"
+       -i $gdb_spawn_id -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*First.*$prompt $" {
+           send_gdb "step\n"
            exp_continue
        }
-       -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$prompt $" {
+       -i $gdb_spawn_id -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$prompt $" {
            pass "finish from indirectly called function"
        }
-       -re ".*$prompt $" {
+       -i $gdb_spawn_id -re ".*$prompt $" {
            fail "finish from indirectly called function"
            return
        }
-       default { fail "finish from indirectly called function" ; return }
+       -i $gdb_spawn_id default { fail "finish from indirectly called function" ; return }
     }
 
     if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
@@ -1211,24 +844,25 @@ proc test_stepping_over_trampolines { } {
     global prompt
     global hex
     global decimal
+    global gdb_spawn_id
 
     # Stop in a marker function and take control from there.
     if { ! [ runto marker_call_with_trampolines ] } then { return 0 }
 
     # Cater for gdb stopping in midline, see comment for finish above.
-    send "finish\n"
+    send_gdb "finish\n"
     expect {
-       -re "marker_call_with_trampolines ..;.*$prompt $" {
-           send "step\n"
+       -i $gdb_spawn_id -re "marker_call_with_trampolines ..;.*$prompt $" {
+           send_gdb "step\n"
            exp_continue
        }
-       -re "pointer_to_call_with_trampolines.*$prompt $" {
+       -i $gdb_spawn_id -re "pointer_to_call_with_trampolines.*$prompt $" {
            pass "finish from marker_call_with_trampolines"
        }
-       -re ".*$prompt $" {
+       -i $gdb_spawn_id -re ".*$prompt $" {
            fail "finish from marker_call_with_trampolines"
        }
-       default { fail "finish from marker_call_with_trampolines" ; return 0 }
+       -i $gdb_spawn_id default { fail "finish from marker_call_with_trampolines" ; return 0 }
     }
 
     # Try to step into the target function.
@@ -1243,20 +877,20 @@ proc test_stepping_over_trampolines { } {
     # Stepping back to main might stop again after the return statement
     # or immediately transfer control back to main if optimizations
     # are performed.
-    send "step\n"
+    send_gdb "step\n"
     expect {
-       -re "main .* at.*$prompt $" {
+       -i $gdb_spawn_id -re "main .* at.*$prompt $" {
            pass "stepping back to main from function called with trampolines" ;
            return 1
        }
-       -re "\}.*End of call_with_trampolines.*$prompt $" {
-           send "step\n"
+       -i $gdb_spawn_id -re "\}.*End of call_with_trampolines.*$prompt $" {
+           send_gdb "step\n"
            exp_continue
        }
-       -re ".*$prompt $" {
+       -i $gdb_spawn_id -re ".*$prompt $" {
            fail "stepping back to main from function called with trampolines"
        }
-       default { fail "stepping back to main from function called with trampolines" ; return 0 }
+       -i $gdb_spawn_id default { fail "stepping back to main from function called with trampolines" ; return 0 }
     }
 }
 
@@ -1267,7 +901,7 @@ gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
 
-source ${binfile}.ci
+set timeout 60
 
 integral_args
 funcargs_reload
index d7c8253481519b62149d966f5d38ada3bc725a4e..d7f87d0bb5d0760c34ead9e575c80bc719980a07 100644 (file)
@@ -12,7 +12,7 @@
 # 
 # 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.  */
+# 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
@@ -29,19 +29,19 @@ set bug_id 0
 proc test_convenience_variables {} {
     global prompt
 
-    gdb_test "set \$foo = 101" " = 101\[\r\n\]+" \
+    gdb_test "set \$foo = 101" "" \
        "Set a new convenience variable"
 
     gdb_test "print \$foo"             " = 101" \
        "Print contents of new convenience variable"
 
-    gdb_test "set \$foo = 301" " = 301\[\r\n\]+" \
+    gdb_test "set \$foo = 301" "" \
        "Set convenience variable to a new value"
 
     gdb_test "print \$foo"             " = 301" \
        "Print new contents of convenience variable"
 
-    gdb_test "set \$_ = 11"            " = 11\[\r\n\]+" \
+    gdb_test "set \$_ = 11"            "" \
        "Set convenience variable \$_"
 
     gdb_test "print \$_"               " = 11" \
@@ -111,7 +111,7 @@ gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 
-send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
+send_gdb "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
 
 test_value_history
 test_convenience_variables
index 0fd2f77cba34d9e541a8c80ca04d88ce8e8ee988..2049058a483243efbf9b95b44dbe01e40f5177e6 100644 (file)
@@ -12,7 +12,7 @@
 # 
 # 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.  */
+# 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
 set prms_id 0
 set bug_id 0
 
+gdb_start
+
 # force the height of the debugger to be pretty large so no pagers getused
-send "set height 400\n"
-expect -re "$prompt $"
+gdb_test "set height 400" "" "test set height"
 
 # use a larger expect input buffer for long help outputs.
 match_max 6000
-
 # test help add-symbol-file
-send "help add-symbol-file\n"
-expect         {
-       -re "Usage: add-symbol-file FILE ADDR.*
-Load the symbols from FILE, assuming FILE has been dynamically loaded..*
-ADDR is the starting address of the file\'s text..*$prompt $" \
-                       { pass "help add-symbol-file" }
-       -re ".*$prompt $"       { fail "help add-symbol-file" }
-       timeout         { fail "(timeout) help add-symbol-file" }
-       }
-
-
+gdb_test "help add-symbol-file" "Usage: add-symbol-file FILE ADDR.*\[\r\n\]+Load the symbols from FILE, assuming FILE has been dynamically loaded..*\[\r\n\]+ADDR is the starting address of the file\'s text."  "help add-symbol-file"
 # test help aliases
-send "help aliases\n"
-expect {
-       -re "Aliases of other commands..*
-List of commands\:.*
-Type \"help\" followed by command name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help aliases" }
-       -re "$prompt $" { fail "help aliases" }
-       timeout         { fail "(timeout) help aliases" }
-       }
-
-
-send "help attach\n"
-expect {
-       -re "Attach to a process or file outside of GDB..*
-This command attaches to another target, of the same type as your last.*
-`target' command .`info files' will show your target stack.*
-The command may take as argument a process id or a device file..*
-For a process id, you must have permission to send the process a signal,.*
-and it must have the same effective uid as the debugger..*
-When using \"attach\", you should use the \"file\" command to specify.*
-the program running in the process, and to load its symbol table..*$prompt $"\
-                       { pass "help attach" }
-       -re "$prompt $" { fail "help attach" }
-       timeout         { fail "(timeout) help attach" }
-       } 
-
-#      -re "$prompt $" { fail "help attach" }
-
+gdb_test "help aliases" "Aliases of other commands..*\[\r\n\]+List of commands\:.*\[\r\n\]+Type \"help\" followed by command name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help aliases"
+gdb_test "help attach" "Attach to a process or file outside of GDB..*\[\r\n\]+This command attaches to another target, of the same type as your last.*\[\r\n\]+`target' command .`info files' will show your target stack.*\[\r\n\]+The command may take as argument a process id or a device file..*\[\r\n\]+For a process id, you must have permission to send the process a signal,.*\[\r\n\]+and it must have the same effective uid as the debugger..*\[\r\n\]+When using \"attach\", you should use the \"file\" command to specify.*\[\r\n\]+the program running in the process, and to load its symbol table." "help attach"
 # test help breakpoint "b" abbreviation
-send "help b\n"
-expect {
-       -re "Set breakpoint at specified line or function..*
-Argument may be line number, function name, or \"\[*\]\" and an address..*
-If line number is specified, break at start of code for that line..*
-If function is specified, break at start of code for that function..*
-If an address is specified, break at that exact address..*
-With no arg, uses current execution address of selected stack frame..*
-This is useful for breaking on return to a stack frame..*
-Multiple breakpoints at one place are permitted, and useful if conditional..*
-Do \"help breakpoints\" for info on other commands dealing with breakpoints..*$prompt $"\
-                       { pass "help breakpoint \"b\" abbreviation" }
-       -re "$prompt $" { fail "help breakpoint \"b\" abbreviation" }
-       timeout         { fail "(timeout) help breakpoint \"b\" abbreviation" }
-       }
-
-
+gdb_test "help b" "Set breakpoint at specified line or function..*\[\r\n\]+Argument may be line number, function name, or \"\[*\]\" and an address..*\[\r\n\]+If line number is specified, break at start of code for that line..*\[\r\n\]+If function is specified, break at start of code for that function..*\[\r\n\]+If an address is specified, break at that exact address..*\[\r\n\]+With no arg, uses current execution address of selected stack frame..*\[\r\n\]+This is useful for breaking on return to a stack frame..*\[\r\n\]+Multiple breakpoints at one place are permitted, and useful if conditional..*\[\r\n\]+Do \"help breakpoints\" for info on other commands dealing with breakpoints." "help breakpoint \"b\" abbreviation"
 # test help breakpoint "br" abbreviation
-send "help br\n"
-expect {
-       -re "Set breakpoint at specified line or function..*
-Argument may be line number, function name, or \"\[*\]\" and an address..*
-If line number is specified, break at start of code for that line..*
-If function is specified, break at start of code for that function..*
-If an address is specified, break at that exact address..*
-With no arg, uses current execution address of selected stack frame..*
-This is useful for breaking on return to a stack frame..*
-Multiple breakpoints at one place are permitted, and useful if conditional..*
-Do \"help breakpoints\" for info on other commands dealing with breakpoints..*$prompt $"\
-                       { pass "help breakpoint \"br\" abbreviation" }
-       -re "$prompt $" { fail "help breakpoint \"br\" abbreviation" }
-       timeout         { fail "(timeout) help breakpoint \"br\" abbreviation" }
-       }
-
-
+gdb_test "help br" "Set breakpoint at specified line or function..*\[\r\n\]+Argument may be line number, function name, or \"\[*\]\" and an address..*\[\r\n\]+If line number is specified, break at start of code for that line..*\[\r\n\]+If function is specified, break at start of code for that function..*\[\r\n\]+If an address is specified, break at that exact address..*\[\r\n\]+With no arg, uses current execution address of selected stack frame..*\[\r\n\]+This is useful for breaking on return to a stack frame..*\[\r\n\]+Multiple breakpoints at one place are permitted, and useful if conditional..*\[\r\n\]+Do \"help breakpoints\" for info on other commands dealing with breakpoints." "help breakpoint \"br\" abbreviation"
 # test help breakpoint "bre" abbreviation
-send "help bre\n"
-expect {
-       -re "Set breakpoint at specified line or function..*
-Argument may be line number, function name, or \"\[*\]\" and an address..*
-If line number is specified, break at start of code for that line..*
-If function is specified, break at start of code for that function..*
-If an address is specified, break at that exact address..*
-With no arg, uses current execution address of selected stack frame..*
-This is useful for breaking on return to a stack frame..*
-Multiple breakpoints at one place are permitted, and useful if conditional..*
-Do \"help breakpoints\" for info on other commands dealing with breakpoints..*$prompt $"\
-                       { pass "help breakpoint \"bre\" abbreviation" }
-       -re "$prompt $" { fail "help breakpoint \"bre\" abbreviation" }
-       timeout         { fail "(timeout) help breakpoint \"bre\" abbreviation" }
-       }
-
-
+gdb_test "help bre" "Set breakpoint at specified line or function..*\[\r\n\]+Argument may be line number, function name, or \"\[*\]\" and an address..*\[\r\n\]+If line number is specified, break at start of code for that line..*\[\r\n\]+If function is specified, break at start of code for that function..*\[\r\n\]+If an address is specified, break at that exact address..*\[\r\n\]+With no arg, uses current execution address of selected stack frame..*\[\r\n\]+This is useful for breaking on return to a stack frame..*\[\r\n\]+Multiple breakpoints at one place are permitted, and useful if conditional..*\[\r\n\]+Do \"help breakpoints\" for info on other commands dealing with breakpoints." "help breakpoint \"bre\" abbreviation"
 # test help breakpoint "brea" abbreviation
-send "help brea\n"
-expect {
-       -re "Set breakpoint at specified line or function..*
-Argument may be line number, function name, or \"\[*\]\" and an address..*
-If line number is specified, break at start of code for that line..*
-If function is specified, break at start of code for that function..*
-If an address is specified, break at that exact address..*
-With no arg, uses current execution address of selected stack frame..*
-This is useful for breaking on return to a stack frame..*
-Multiple breakpoints at one place are permitted, and useful if conditional..*
-Do \"help breakpoints\" for info on other commands dealing with breakpoints..*$prompt $"\
-                       { pass "help breakpoint \"brea\" abbreviation" }
-       -re "$prompt $" { fail "help breakpoint \"brea\" abbreviation" }
-       timeout         { fail "(timeout) help breakpoint \"brea\" abbreviation" }
-       }
-
-
+gdb_test "help brea" "Set breakpoint at specified line or function..*\[\r\n\]+Argument may be line number, function name, or \"\[*\]\" and an address..*\[\r\n\]+If line number is specified, break at start of code for that line..*\[\r\n\]+If function is specified, break at start of code for that function..*\[\r\n\]+If an address is specified, break at that exact address..*\[\r\n\]+With no arg, uses current execution address of selected stack frame..*\[\r\n\]+This is useful for breaking on return to a stack frame..*\[\r\n\]+Multiple breakpoints at one place are permitted, and useful if conditional..*\[\r\n\]+Do \"help breakpoints\" for info on other commands dealing with breakpoints." "help breakpoint \"brea\" abbreviation"
 # test help breakpoint "break" abbreviation
-send "help break\n"
-expect {
-       -re "Set breakpoint at specified line or function..*
-Argument may be line number, function name, or \"\[*\]\" and an address..*
-If line number is specified, break at start of code for that line..*
-If function is specified, break at start of code for that function..*
-If an address is specified, break at that exact address..*
-With no arg, uses current execution address of selected stack frame..*
-This is useful for breaking on return to a stack frame..*
-Multiple breakpoints at one place are permitted, and useful if conditional..*
-Do \"help breakpoints\" for info on other commands dealing with breakpoints..*$prompt $"\
-                       { pass "help breakpoint \"break\" abbreviation" }
-       -re "$prompt $" { fail "help breakpoint \"break\" abbreviation" }
-       timeout         { fail "(timeout) help breakpoint \"break\" abbreviation" }
-       }
-
-
+gdb_test "help break" "Set breakpoint at specified line or function..*\[\r\n\]+Argument may be line number, function name, or \"\[*\]\" and an address..*\[\r\n\]+If line number is specified, break at start of code for that line..*\[\r\n\]+If function is specified, break at start of code for that function..*\[\r\n\]+If an address is specified, break at that exact address..*\[\r\n\]+With no arg, uses current execution address of selected stack frame..*\[\r\n\]+This is useful for breaking on return to a stack frame..*\[\r\n\]+Multiple breakpoints at one place are permitted, and useful if conditional..*\[\r\n\]+Do \"help breakpoints\" for info on other commands dealing with breakpoints." "help breakpoint \"break\" abbreviation"
 # test help breakpoints
-send "help breakpoints\n"
-expect {
-       -re "Making program stop at certain points..*
-List of commands\:.*
-watch -- Set a watchpoint for an expression.*
-catch -- Set breakpoints to catch exceptions that are raised.*
-break -- Set breakpoint at specified line or function.*
-clear -- Clear breakpoint at specified line or function.*
-delete -- Delete some breakpoints or auto-display expressions.*
-disable -- Disable some breakpoints.*
-enable -- Enable some breakpoints.*
-tbreak -- Set a temporary breakpoint.*
-condition -- Specify breakpoint number N to break only if COND is true.*
-commands -- Set commands to be executed when a breakpoint is hit.*
-ignore -- Set ignore-count of breakpoint number N to COUNT.*
-Type \"help\" followed by command name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help breakpoints" }
-       -re "$prompt $" { fail "help breakpoints" }
-       timeout         { fail "(timeout) help breakpoints" }
-       }
-
-
+gdb_test "help breakpoints" "Making program stop at certain points..*\[\r\n\]+List of commands\:.*\[\r\n\]+watch -- Set a watchpoint for an expression.*\[\r\n\]+catch -- Set breakpoints to catch exceptions that are raised.*\[\r\n\]+break -- Set breakpoint at specified line or function.*\[\r\n\]+clear -- Clear breakpoint at specified line or function.*\[\r\n\]+delete -- Delete some breakpoints or auto-display expressions.*\[\r\n\]+disable -- Disable some breakpoints.*\[\r\n\]+enable -- Enable some breakpoints.*\[\r\n\]+tbreak -- Set a temporary breakpoint.*\[\r\n\]+condition -- Specify breakpoint number N to break only if COND is true.*\[\r\n\]+commands -- Set commands to be executed when a breakpoint is hit.*\[\r\n\]+ignore -- Set ignore-count of breakpoint number N to COUNT.*\[\r\n\]+Type \"help\" followed by command name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help breakpoints"
 # test help backtrace "bt" abbreviation
-send "help bt\n"
-expect {
-       -re "Print backtrace of all stack frames, or innermost COUNT frames..*
-With a negative argument, print outermost -COUNT frames..*$prompt $"\
-                       { pass "help backtrace \"bt\" abbreviation" }
-       -re "$prompt $" { fail "help backtrace \"bt\" abbreviation" }
-       timeout         { fail "(timeout) help backtrace \"bt\" abbreviation" }
-       }
-
-
+gdb_test "help bt" "Print backtrace of all stack frames, or innermost COUNT frames..*\[\r\n\]+With a negative argument, print outermost -COUNT frames." "help backtrace \"bt\" abbreviation"
 # test help backtrace
-send "help backtrace\n"
-expect {
-       -re "Print backtrace of all stack frames, or innermost COUNT frames..*
-With a negative argument, print outermost -COUNT frames..*$prompt $"\
-                       { pass "help backtrace" }
-       -re "$prompt $" { fail "help backtrace" }
-       timeout         { fail "(timeout) help backtrace" }
-       }
-
-
+gdb_test "help backtrace" "Print backtrace of all stack frames, or innermost COUNT frames..*\[\r\n\]+With a negative argument, print outermost -COUNT frames." "help backtrace"
 # test help continue "c" abbreviation
-send "help c\n"
-expect {
-       -re "Continue program being debugged.*$prompt $"\
-                       { pass "help continue \"c\" abbreviation" }
-       -re "$prompt $" { fail "help continue \"c\" abbreviation" }
-       timeout         { fail "(timeout) help continue \"c\" abbreviation" }
-       }
-
-
+gdb_test "help c" "Continue program being debugged.*"  "help continue \"c\" abbreviation"
 # test help continue
-send "help continue\n"
-expect {
-       -re "Continue program being debugged.*$prompt $"\
-                       { pass "help continue" }
-       -re "$prompt $" { fail "help continue" }
-       timeout         { fail "(timeout) help continue" }
-       }
-
-
+gdb_test "help continue" "Continue program being debugged.*"  "help continue"
 # test help call
-send "help call\n"
-expect {
-       -re "Call a function.*$prompt $"\
-                       { pass "help call" }
-       -re "$prompt $" { fail "help call" }
-       timeout         { fail "(timeout) help call" }
-       }
-
-
+gdb_test "help call" "Call a function.*"  "help call"
 # test help catch
-send "help catch\n"
-expect {
-       -re "Set breakpoints to catch exceptions that are raised..*
-Argument may be a single exception to catch, multiple exceptions.*
-to catch, or the default exception \"default\".  If no arguments.*
-are given, breakpoints are set at all exception handlers catch clauses.*
-within the current scope..*
-A condition specified for the catch applies to all breakpoints set.*
-with this command.*
-Do \"help breakpoints\" for info on other commands dealing with breakpoints..*$prompt $"\
-                       { pass "help catch" }
-       -re "$prompt $" { fail "help catch" }
-       timeout         { fail "(timeout) help catch" }
-       }
-
-
+gdb_test "help catch" "Set breakpoints to catch exceptions that are raised..*\[\r\n\]+Argument may be a single exception to catch, multiple exceptions.*\[\r\n\]+to catch, or the default exception \"default\".  If no arguments.*\[\r\n\]+are given, breakpoints are set at all exception handlers catch clauses.*\[\r\n\]+within the current scope..*\[\r\n\]+A condition specified for the catch applies to all breakpoints set.*\[\r\n\]+with this command.*\[\r\n\]+Do \"help breakpoints\" for info on other commands dealing with breakpoints." "help catch"
 # test help cd
-send "help cd\n"
-expect {
-       -re "Set working directory to DIR for debugger and program being debugged..*
-The change does not take effect for the program being debugged.*
-until the next time it is started..*$prompt $"\
-                       { pass "help cd" }
-       -re "$prompt $" { fail "help cd" }
-       timeout         { fail "(timeout) help cd" }
-       }
-
-
+gdb_test "help cd" "Set working directory to DIR for debugger and program being debugged..*\[\r\n\]+The change does not take effect for the program being debugged.*\[\r\n\]+until the next time it is started." "help cd"
 # test help clear
-send "help clear\n"
-expect {
-       -re "Clear breakpoint at specified line or function.*
-Argument may be line number, function name, or .* and an address.*
-If line number is specified, all breakpoints in that line are cleared.*
-If function is specified, breakpoints at beginning of function are cleared.*
-If an address is specified, breakpoints at that address are cleared.*
-With no argument, clears all breakpoints in the line that the selected frame.*
-is executing in..*
-See also the \"delete\" command which clears breakpoints by number..*$prompt $"\
-                       { pass "help clear" }
-       -re "$prompt $" { fail "help clear" }
-       timeout         { fail "(timeout) help clear" }
-       }
-
-
+gdb_test "help clear" "Clear breakpoint at specified line or function.*\[\r\n\]+Argument may be line number, function name, or .* and an address.*\[\r\n\]+If line number is specified, all breakpoints in that line are cleared.*\[\r\n\]+If function is specified, breakpoints at beginning of function are cleared.*\[\r\n\]+If an address is specified, breakpoints at that address are cleared.*\[\r\n\]+With no argument, clears all breakpoints in the line that the selected frame.*\[\r\n\]+is executing in..*\[\r\n\]+See also the \"delete\" command which clears breakpoints by number." "help clear"
 # test help commands
-send "help commands\n"
-expect {
-       -re "Set commands to be executed when a breakpoint is hit..*
-Give breakpoint number as argument after \"commands\"..*
-With no argument, the targeted breakpoint is the last one set..*
-The commands themselves follow starting on the next line..*
-Type a line containing \"end\" to indicate the end of them..*
-Give \"silent\" as the first line to make the breakpoint silent;.*
-then no output is printed when it is hit, except what the commands print..*$prompt $"\
-                       { pass "help commands" }
-       -re "$prompt $" { fail "help commands" }
-       timeout         { fail "(timeout) help commands" }
-       }
-
-
+gdb_test "help commands" "Set commands to be executed when a breakpoint is hit..*\[\r\n\]+Give breakpoint number as argument after \"commands\"..*\[\r\n\]+With no argument, the targeted breakpoint is the last one set..*\[\r\n\]+The commands themselves follow starting on the next line..*\[\r\n\]+Type a line containing \"end\" to indicate the end of them..*\[\r\n\]+Give \"silent\" as the first line to make the breakpoint silent;.*\[\r\n\]+then no output is printed when it is hit, except what the commands print." "help commands"
 # test help condition
-send "help condition\n"
-expect {
-       -re "Specify breakpoint number N to break only if COND is true..*
-Usage is `condition N COND', where N is an integer and COND is an.*
-expression to be evaluated whenever breakpoint N is reached.  .*$prompt $"\
-                       { pass "help condition" }
-       -re "$prompt $" { fail "help condition" }
-       timeout         { fail "(timeout) help condition" }
-       }
-
-
+gdb_test "help condition" "Specify breakpoint number N to break only if COND is true..*\[\r\n\]+Usage is `condition N COND', where N is an integer and COND is an.*\[\r\n\]+expression to be evaluated whenever breakpoint N is reached.  " "help condition"
 # test help core-file
-send "help core-file\n"
-expect {
-       -re "Use FILE as core dump for examining memory and registers..*
-No arg means have no core file.  This command has been superseded by the.*
-`target core' and `detach' commands..*$prompt $"\
-                       { pass "help core-file" }
-       -re "$prompt $" { fail "help core-file" }
-       timeout         { fail "(timeout) help core-file" }
-       }
-
-
+gdb_test "help core-file" "Use FILE as core dump for examining memory and registers..*\[\r\n\]+No arg means have no core file.  This command has been superseded by the.*\[\r\n\]+`target core' and `detach' commands." "help core-file"
 # test help delete "d" abbreviation
-send "help d\n"
-expect {
-       -re "Delete some breakpoints or auto-display expressions..*
-Arguments are breakpoint numbers with spaces in between..*
-To delete all breakpoints, give no argument..*
-Also a prefix command for deletion of other GDB objects..*
-The \"unset\" command is also an alias for \"delete\"..*
-List of delete subcommands:.*
-delete display -- Cancel some expressions to be displayed when program stops.*
-delete breakpoints -- Delete some breakpoints or auto-display expressions.*
-Type \"help delete\" followed by delete subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help delete \"d\" abbreviation" }
-       -re "$prompt $" { fail "help delete \"d\" abbreviation" }
-       timeout         { fail "(timeout) help delete \"d\" abbreviation" }
-       }
-
-
+gdb_test "help d" "Delete some breakpoints or auto-display expressions..*\[\r\n\]+Arguments are breakpoint numbers with spaces in between..*\[\r\n\]+To delete all breakpoints, give no argument..*\[\r\n\]+Also a prefix command for deletion of other GDB objects..*\[\r\n\]+The \"unset\" command is also an alias for \"delete\"..*\[\r\n\]+List of delete subcommands:.*\[\r\n\]+delete display -- Cancel some expressions to be displayed when program stops.*\[\r\n\]+delete breakpoints -- Delete some breakpoints or auto-display expressions.*\[\r\n\]+Type \"help delete\" followed by delete subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help delete \"d\" abbreviation"
 # test help delete
-send "help delete\n"
-expect {
-       -re "Delete some breakpoints or auto-display expressions..*
-Arguments are breakpoint numbers with spaces in between..*
-To delete all breakpoints, give no argument..*
-Also a prefix command for deletion of other GDB objects..*
-The \"unset\" command is also an alias for \"delete\"..*
-List of delete subcommands:.*
-delete display -- Cancel some expressions to be displayed when program stops.*
-delete breakpoints -- Delete some breakpoints or auto-display expressions.*
-Type \"help delete\" followed by delete subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help delete" }
-       -re "$prompt $" { fail "help delete" }
-       timeout         { fail "(timeout) help delete" }
-       }
-
-
+gdb_test "help delete" "Delete some breakpoints or auto-display expressions..*\[\r\n\]+Arguments are breakpoint numbers with spaces in between..*\[\r\n\]+To delete all breakpoints, give no argument..*\[\r\n\]+Also a prefix command for deletion of other GDB objects..*\[\r\n\]+The \"unset\" command is also an alias for \"delete\"..*\[\r\n\]+List of delete subcommands:.*\[\r\n\]+delete display -- Cancel some expressions to be displayed when program stops.*\[\r\n\]+delete breakpoints -- Delete some breakpoints or auto-display expressions.*\[\r\n\]+Type \"help delete\" followed by delete subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help delete"
 # test help data
-send "help data\n"
-expect {
-       -re ".*
-Examining data..*
-List of commands:.*
-Type \"help\" followed by command name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help data" }
-       -re "$prompt $" { fail "help data" }
-       timeout         { fail "(timeout) help data" }
-       }
-
-
+gdb_test "help data" ".*\[\r\n\]+Examining data..*\[\r\n\]+List of commands:.*\[\r\n\]+Type \"help\" followed by command name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help data"
 # test help define
-send "help define\n"
-expect {
-       -re "Define a new command.*$prompt $"\
-                       { pass "help define" }
-       -re "$prompt $" { fail "help define" }
-       timeout         { fail "(timeout) help define" }
-       }
-
-
+gdb_test "help define" "Define a new command.*"  "help define"
 # test help delete breakpoints
-send "help delete breakpoints\n"
-expect {
-       -re "Delete some breakpoints or auto-display expressions..*
-Arguments are breakpoint numbers with spaces in between..*
-To delete all breakpoints, give no argument..*
-This command may be abbreviated \"delete\"..*$prompt $"\
-                       { pass "help delete breakpoints" }
-       -re "$prompt $" { fail "help delete breakpoints" }
-       timeout         { fail "(timeout) help delete breakpoints" }
-       }
-
-
+gdb_test "help delete breakpoints" "Delete some breakpoints or auto-display expressions..*\[\r\n\]+Arguments are breakpoint numbers with spaces in between..*\[\r\n\]+To delete all breakpoints, give no argument..*\[\r\n\]+This command may be abbreviated \"delete\"." "help delete breakpoints"
 # test help delete display
-send "help delete display\n"
-expect {
-       -re "Cancel some expressions to be displayed when program stops..*
-Arguments are the code numbers of the expressions to stop displaying..*
-No argument means cancel all automatic-display expressions..*
-Do \"info display\" to see current list of code numbers..*$prompt $"\
-                       { pass "help delete display" }
-       -re "$prompt $" { fail "help delete display" }
-       timeout         { fail "(timeout) help delete display" }
-       }
-
-
+gdb_test "help delete display" "Cancel some expressions to be displayed when program stops..*\[\r\n\]+Arguments are the code numbers of the expressions to stop displaying..*\[\r\n\]+No argument means cancel all automatic-display expressions..*\[\r\n\]+Do \"info display\" to see current list of code numbers." "help delete display"
 # test help detach
-send "help detach\n"
-expect {
-       -re "Detach a process or file previously attached..*
-If a process, it is no longer traced, and it continues its execution.  If you.*
-were debugging a file, the file is closed and gdb no longer accesses it..*$prompt $"\
-                       { pass "help detach" }
-       -re "$prompt $" { fail "help detach" }
-       timeout         { fail "(timeout) help detach" }
-       }
-
-
+gdb_test "help detach" "Detach a process or file previously attached..*\[\r\n\]+If a process, it is no longer traced, and it continues its execution.  If you.*\[\r\n\]+were debugging a file, the file is closed and gdb no longer accesses it." "help detach"
 # test help directory
-send "help directory\n"
-expect {
-       -re "Add directory DIR to beginning of search path for source files..*
-Forget cached info on source file locations and line positions..*
-DIR can also be .cwd for the current working directory, or .cdir for the.*
-directory in which the source file was compiled into object code..*
-With no argument, reset the search path to .cdir:.cwd, the default..*$prompt $"\
-                       { pass "help directory" }
-       -re "$prompt $" { fail "help directory" }
-       timeout         { fail "(timeout) help directory" }
-       }
-
-
+gdb_test "help directory" "Add directory DIR to beginning of search path for source files..*\[\r\n\]+Forget cached info on source file locations and line positions..*\[\r\n\]+DIR can also be .cwd for the current working directory, or .cdir for the.*\[\r\n\]+directory in which the source file was compiled into object code..*\[\r\n\]+With no argument, reset the search path to .cdir:.cwd, the default." "help directory"
 # test help disable "dis" abbreviation
-send "help dis\n"
-expect {
-       -re "Disable some breakpoints..*
-Arguments are breakpoint numbers with spaces in between..*
-To disable all breakpoints, give no argument..*
-A disabled breakpoint is not forgotten, but has no effect until reenabled..*
-List of disable subcommands:.*
-disable display -- Disable some expressions to be displayed when program stops.*
-disable breakpoints -- Disable some breakpoints.*
-Type \"help disable\" followed by disable subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help disable \"dis\" abbreviation" }
-       -re "$prompt $" { fail "help disable \"dis\" abbreviation" }
-       timeout         { fail "(timeout) help disable \"dis\" abbreviation" }
-       }
-
-
+gdb_test "help dis" "Disable some breakpoints..*\[\r\n\]+Arguments are breakpoint numbers with spaces in between..*\[\r\n\]+To disable all breakpoints, give no argument..*\[\r\n\]+A disabled breakpoint is not forgotten, but has no effect until reenabled..*\[\r\n\]+List of disable subcommands:.*\[\r\n\]+disable display -- Disable some expressions to be displayed when program stops.*\[\r\n\]+disable breakpoints -- Disable some breakpoints.*\[\r\n\]+Type \"help disable\" followed by disable subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help disable \"dis\" abbreviation"
 # test help disable "disa" abbreviation
-send "help disa\n"
-expect {
-       -re "Disable some breakpoints..*
-Arguments are breakpoint numbers with spaces in between..*
-To disable all breakpoints, give no argument..*
-A disabled breakpoint is not forgotten, but has no effect until reenabled..*
-List of disable subcommands:.*
-disable display -- Disable some expressions to be displayed when program stops.*
-disable breakpoints -- Disable some breakpoints.*
-Type \"help disable\" followed by disable subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help disable \"disa\" abbreviation" }
-       -re "$prompt $" { fail "help disable \"disa\" abbreviation" }
-       timeout         { fail "(timeout) help disable \"disa\" abbreviation" }
-       }
-
-
+gdb_test "help disa" "Disable some breakpoints..*\[\r\n\]+Arguments are breakpoint numbers with spaces in between..*\[\r\n\]+To disable all breakpoints, give no argument..*\[\r\n\]+A disabled breakpoint is not forgotten, but has no effect until reenabled..*\[\r\n\]+List of disable subcommands:.*\[\r\n\]+disable display -- Disable some expressions to be displayed when program stops.*\[\r\n\]+disable breakpoints -- Disable some breakpoints.*\[\r\n\]+Type \"help disable\" followed by disable subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help disable \"disa\" abbreviation"
 # test help disable
-send "help disable\n"
-expect {
-       -re "Disable some breakpoints..*
-Arguments are breakpoint numbers with spaces in between..*
-To disable all breakpoints, give no argument..*
-A disabled breakpoint is not forgotten, but has no effect until reenabled..*
-List of disable subcommands:.*
-disable display -- Disable some expressions to be displayed when program stops.*
-disable breakpoints -- Disable some breakpoints.*
-Type \"help disable\" followed by disable subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help disable" }
-       -re "$prompt $" { fail "help disable" }
-       timeout         { fail "(timeout) help disable" }
-       }
-
-
+gdb_test "help disable" "Disable some breakpoints..*\[\r\n\]+Arguments are breakpoint numbers with spaces in between..*\[\r\n\]+To disable all breakpoints, give no argument..*\[\r\n\]+A disabled breakpoint is not forgotten, but has no effect until reenabled..*\[\r\n\]+List of disable subcommands:.*\[\r\n\]+disable display -- Disable some expressions to be displayed when program stops.*\[\r\n\]+disable breakpoints -- Disable some breakpoints.*\[\r\n\]+Type \"help disable\" followed by disable subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help disable"
 # test help disable breakpoints
-send "help disable breakpoints\n"
-expect {
-       -re "Disable some breakpoints..*
-Arguments are breakpoint numbers with spaces in between..*
-To disable all breakpoints, give no argument..*
-A disabled breakpoint is not forgotten, but has no effect until reenabled..*
-This command may be abbreviated \"disable\"..*$prompt $"\
-                       { pass "help disable breakpoints" }
-       -re "$prompt $" { fail "help disable breakpoints" }
-       timeout         { fail "(timeout) help disable breakpoints" }
-       }
-
-
+gdb_test "help disable breakpoints" "Disable some breakpoints..*\[\r\n\]+Arguments are breakpoint numbers with spaces in between..*\[\r\n\]+To disable all breakpoints, give no argument..*\[\r\n\]+A disabled breakpoint is not forgotten, but has no effect until reenabled..*\[\r\n\]+This command may be abbreviated \"disable\"." "help disable breakpoints"
 # test help disable display
-send "help disable display\n"
-expect {
-       -re "Disable some expressions to be displayed when program stops..*
-Arguments are the code numbers of the expressions to stop displaying..*
-No argument means disable all automatic-display expressions..*
-Do \"info display\" to see current list of code numbers..*$prompt $"\
-                       { pass "help disable display" }
-       -re "$prompt $" { fail "help disable display" }
-       timeout         { fail "(timeout) help disable display" }
-       }
-
-
+gdb_test "help disable display" "Disable some expressions to be displayed when program stops..*\[\r\n\]+Arguments are the code numbers of the expressions to stop displaying..*\[\r\n\]+No argument means disable all automatic-display expressions..*\[\r\n\]+Do \"info display\" to see current list of code numbers." "help disable display"
 # test help disassemble
-send "help disassemble\n"
-expect {
-       -re "Disassemble a specified section of memory..*
-Default is the function surrounding the pc of the selected frame..*
-With a single argument, the function surrounding that address is dumped..*
-Two arguments are taken as a range of memory to dump..*$prompt $"\
-                       { pass "help disassemble" }
-       -re "$prompt $" { fail "help disassemble" }
-       timeout         { fail "(timeout) help disassemble" }
-       }
-
-
+gdb_test "help disassemble" "Disassemble a specified section of memory..*\[\r\n\]+Default is the function surrounding the pc of the selected frame..*\[\r\n\]+With a single argument, the function surrounding that address is dumped..*\[\r\n\]+Two arguments are taken as a range of memory to dump." "help disassemble"
 # test help display
-send "help display\n"
-expect {
-       -re "Print value of expression EXP each time the program stops..*
-/FMT may be used before EXP as in the \"print\" command..*
-/FMT \"i\" or \"s\" or including a size-letter is allowed,.*
-as in the \"x\" command, and then EXP is used to get the address to examine.*
-and examining is done as in the \"x\" command..*
-With no argument, display all currently requested auto-display expressions..*
-Use \"undisplay\" to cancel display requests previously made..*$prompt $"\
-                       { pass "help display" }
-       -re "$prompt $" { fail "help display" }
-       timeout         { fail "(timeout) help display" }
-       }
-
-
+gdb_test "help display" "Print value of expression EXP each time the program stops..*\[\r\n\]+/FMT may be used before EXP as in the \"print\" command..*\[\r\n\]+/FMT \"i\" or \"s\" or including a size-letter is allowed,.*\[\r\n\]+as in the \"x\" command, and then EXP is used to get the address to examine.*\[\r\n\]+and examining is done as in the \"x\" command..*\[\r\n\]+With no argument, display all currently requested auto-display expressions..*\[\r\n\]+Use \"undisplay\" to cancel display requests previously made." "help display"
 # test help do
-send "help do\n"
-expect {
-       -re "Select and print stack frame called by this one..*
-An argument says how many frames down to go..*$prompt $"\
-                       { pass "help do" }
-       -re "$prompt $" { fail "help do" }
-       timeout         { fail "(timeout) help do" }
-       }
-
-
+gdb_test "help do" "Select and print stack frame called by this one..*\[\r\n\]+An argument says how many frames down to go." "help do"
 # test help document
-send "help document\n"
-expect {
-       -re "Document a user-defined command..*
-Give command name as argument.  Give documentation on following lines..*
-End with a line of just \"end\"..*$prompt $"\
-                       { pass "help document" }
-       -re "$prompt $" { fail "help document" }
-       timeout         { fail "(timeout) help document" }
-       }
-
-
-
+gdb_test "help document" "Document a user-defined command..*\[\r\n\]+Give command name as argument.  Give documentation on following lines..*\[\r\n\]+End with a line of just \"end\"." "help document"
 # test help down
-send "help down\n"
-expect {
-       -re "Select and print stack frame called by this one..*
-An argument says how many frames down to go..*$prompt $"\
-                       { pass "help down" }
-       -re "$prompt $" { fail "help down" }
-       timeout         { fail "(timeout) help down" }
-       }
-
-
+gdb_test "help down" "Select and print stack frame called by this one..*\[\r\n\]+An argument says how many frames down to go." "help down"
 # test help down-silently
-send "help down-silently\n"
-expect {
-       -re "Same as the `down' command, but does not print anything..*
-This is useful in command scripts..*$prompt $"\
-                       { pass "help down-silently" }
-       -re "$prompt $" { fail "help down-silently" }
-       timeout         { fail "(timeout) help down-silently" }
-       }
-
-
+gdb_test "help down-silently" "Same as the `down' command, but does not print anything..*\[\r\n\]+This is useful in command scripts." "help down-silently"
 # this command was removed from GDB 4.5.8
 # test help dump-me
-#send "help dump-me\n"
-#expect {
-#      -re "Get fatal error; make debugger dump its core..*$prompt $"\
-#                      { pass "help dump-me" }
-#      -re "$prompt $" { fail "help dump-me" }
-#      timeout         { fail "(timeout) help dump-me" }
-#      }
-
+#send_gdb "help dump-me"
+# -re "Get fatal error; make debugger dump its core."
+# 
+# }
 # test help echo
-send "help echo\n"
-expect {
-       -re "Print a constant string.  Give string as argument..*
-C escape sequences may be used in the argument..*
-No newline is added at the end of the argument;.*
-use \".n\" if you want a newline to be printed..*
-Since leading and trailing whitespace are ignored in command arguments,.*
-if you want to print some you must use \".\" before leading whitespace.*
-to be printed or after trailing whitespace..*$prompt $"\
-                       { pass "help echo" }
-       -re "$prompt $" { fail "help echo" }
-       timeout         { fail "(timeout) help echo" }
-       }
-
-
+gdb_test "help echo" "Print a constant string.  Give string as argument..*\[\r\n\]+C escape sequences may be used in the argument..*\[\r\n\]+No newline is added at the end of the argument;.*\[\r\n\]+use \".n\" if you want a newline to be printed..*\[\r\n\]+Since leading and trailing whitespace are ignored in command arguments,.*\[\r\n\]+if you want to print some you must use \".\" before leading whitespace.*\[\r\n\]+to be printed or after trailing whitespace." "help echo"
 # test help enable breakpoints delete
-send "help enable breakpoints delete\n"
-expect {
-       -re "Enable breakpoints and delete when hit.  Give breakpoint numbers..*
-If a breakpoint is hit while enabled in this fashion, it is deleted..*$prompt $"\
-                       { pass "help enable breakpoints delete" }
-       -re "$prompt $" { fail "help enable breakpoints delete" }
-       timeout         { fail "(timeout) help enable breakpoints delete" }
-       }
-
-
+gdb_test "help enable breakpoints delete" "Enable breakpoints and delete when hit.  Give breakpoint numbers..*\[\r\n\]+If a breakpoint is hit while enabled in this fashion, it is deleted." "help enable breakpoints delete"
 # test help enable breakpoints once
-send "help enable breakpoints once\n"
-expect {
-       -re "Enable breakpoints for one hit..*$prompt $"\
-                       { pass "help enable breakpoints once" }
-       -re "$prompt $" { fail "help enable breakpoints once" }
-       timeout         { fail "(timeout) help enable breakpoints once" }
-       }
-
-
+gdb_test "help enable breakpoints once" "Enable breakpoints for one hit..*"  "help enable breakpoints once"
 # test help enable breakpoints
-send "help enable breakpoints\n"
-expect {
-       -re "Enable some breakpoints..*
-Give breakpoint numbers .separated by spaces. as arguments..*
-This is used to cancel the effect of the \"disable\" command..*
-May be abbreviated to simply \"enable\"..*.*
-List of enable breakpoints subcommands:.*
-enable breakpoints delete -- Enable breakpoints and delete when hit.*
-enable breakpoints once -- Enable breakpoints for one hit.*
-Type \"help enable breakpoints\" followed by enable breakpoints subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help enable breakpoints" }
-       -re "$prompt $" { fail "help enable breakpoints" }
-       timeout         { fail "(timeout) help enable breakpoints" }
-       }
-
-
+gdb_test "help enable breakpoints" "Enable some breakpoints..*\[\r\n\]+Give breakpoint numbers .separated by spaces. as arguments..*\[\r\n\]+This is used to cancel the effect of the \"disable\" command..*\[\r\n\]+May be abbreviated to simply \"enable\"..*.*\[\r\n\]+List of enable breakpoints subcommands:.*\[\r\n\]+enable breakpoints delete -- Enable breakpoints and delete when hit.*\[\r\n\]+enable breakpoints once -- Enable breakpoints for one hit.*\[\r\n\]+Type \"help enable breakpoints\" followed by enable breakpoints subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help enable breakpoints"
 # test help enable delete
-send "help enable delete\n"
-expect {
-       -re "Enable breakpoints and delete when hit.  Give breakpoint numbers..*
-If a breakpoint is hit while enabled in this fashion, it is deleted..*$prompt $"\
-                       { pass "help enable delete" }
-       -re "$prompt $" { fail "help enable delete" }
-       timeout         { fail "(timeout) help enable delete" }
-       }
-
-
+gdb_test "help enable delete" "Enable breakpoints and delete when hit.  Give breakpoint numbers..*\[\r\n\]+If a breakpoint is hit while enabled in this fashion, it is deleted." "help enable delete"
 # test help enable display
-send "help enable display\n"
-expect {
-       -re "Enable some expressions to be displayed when program stops..*
-Arguments are the code numbers of the expressions to resume displaying..*
-No argument means enable all automatic-display expressions..*
-Do \"info display\" to see current list of code numbers..*$prompt $"\
-                       { pass "help enable display" }
-       -re "$prompt $" { fail "help enable display" }
-       timeout         { fail "(timeout) help enable display" }
-       }
-
-
+gdb_test "help enable display" "Enable some expressions to be displayed when program stops..*\[\r\n\]+Arguments are the code numbers of the expressions to resume displaying..*\[\r\n\]+No argument means enable all automatic-display expressions..*\[\r\n\]+Do \"info display\" to see current list of code numbers." "help enable display"
 # test help enable once
-send "help enable once\n"
-expect {
-       -re "Enable breakpoints for one hit.*$prompt $"\
-                       { pass "help enable once" }
-       -re "$prompt $" { fail "help enable once" }
-       timeout         { fail "(timeout) help enable once" }
-       }
-
-
+gdb_test "help enable once" "Enable breakpoints for one hit.*"  "help enable once"
 # test help enable
-send "help enable\n"
-expect {
-       -re "Enable some breakpoints..*
-Give breakpoint numbers .separated by spaces. as arguments..*
-With no subcommand, breakpoints are enabled until you command otherwise..*
-This is used to cancel the effect of the \"disable\" command..*
-With a subcommand you can enable temporarily..*
-List of enable subcommands:.*
-enable display -- Enable some expressions to be displayed when program stops.*
-enable once -- Enable breakpoints for one hit.*
-enable delete -- Enable breakpoints and delete when hit.*
-Type \"help enable\" followed by enable subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help enable" }
-       -re "$prompt $" { fail "help enable" }
-       timeout         { fail "(timeout) help enable" }
-       }
-
-
+gdb_test "help enable" "Enable some breakpoints..*\[\r\n\]+Give breakpoint numbers .separated by spaces. as arguments..*\[\r\n\]+With no subcommand, breakpoints are enabled until you command otherwise..*\[\r\n\]+This is used to cancel the effect of the \"disable\" command..*\[\r\n\]+With a subcommand you can enable temporarily..*\[\r\n\]+List of enable subcommands:.*\[\r\n\]+enable display -- Enable some expressions to be displayed when program stops.*\[\r\n\]+enable once -- Enable breakpoints for one hit.*\[\r\n\]+enable delete -- Enable breakpoints and delete when hit.*\[\r\n\]+Type \"help enable\" followed by enable subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help enable"
 # test help exec-file
-send "help exec-file\n"
-expect {
-       -re "Use FILE as program for getting contents of pure memory..*
-If FILE cannot be found as specified, your execution directory path.*
-is searched for a command of that name..*
-No arg means have no executable file..*$prompt $"\
-                       { pass "help exec-file" }
-       -re "$prompt $" { fail "help exec-file" }
-       timeout         { fail "(timeout) help exec-file" }
-       }
-
-
+gdb_test "help exec-file" "Use FILE as program for getting contents of pure memory..*\[\r\n\]+If FILE cannot be found as specified, your execution directory path.*\[\r\n\]+is searched for a command of that name..*\[\r\n\]+No arg means have no executable file." "help exec-file"
 # test help frame "f" abbreviation
-send "help f\n"
-expect {
-       -re "Select and print a stack frame..*
-With no argument, print the selected stack frame.  .See also \"info frame\".*
-An argument specifies the frame to select..*
-It can be a stack frame number or the address of the frame..*
-With argument, nothing is printed if input is coming from.*
-a command file or a user-defined command..*$prompt $"\
-                       { pass "help frame \"f\" abbreviation" }
-       -re "$prompt $" { fail "help frame \"f\" abbreviation" }
-       timeout         { fail "(timeout) help frame \"f\" abbreviation" }
-       }
-
-
+gdb_test "help f" "Select and print a stack frame..*\[\r\n\]+With no argument, print the selected stack frame.  .See also \"info frame\".*\[\r\n\]+An argument specifies the frame to select..*\[\r\n\]+It can be a stack frame number or the address of the frame..*\[\r\n\]+With argument, nothing is printed if input is coming from.*\[\r\n\]+a command file or a user-defined command." "help frame \"f\" abbreviation"
 # test help frame
-send "help frame\n"
-expect {
-       -re "Select and print a stack frame..*
-With no argument, print the selected stack frame.  .See also \"info frame\"...*
-An argument specifies the frame to select..*
-It can be a stack frame number or the address of the frame..*
-With argument, nothing is printed if input is coming from.*
-a command file or a user-defined command..*$prompt $"\
-                       { pass "help frame" }
-       -re "$prompt $" { fail "help frame" }
-       timeout         { fail "(timeout) help frame" }
-       }
-
-
+gdb_test "help frame" "Select and print a stack frame..*\[\r\n\]+With no argument, print the selected stack frame.  .See also \"info frame\"...*\[\r\n\]+An argument specifies the frame to select..*\[\r\n\]+It can be a stack frame number or the address of the frame..*\[\r\n\]+With argument, nothing is printed if input is coming from.*\[\r\n\]+a command file or a user-defined command." "help frame"
 # test help fg
-send "help fg\n"
-expect {
-       -re "Continue program being debugged.*$prompt $"\
-                       { pass "help fg" }
-       -re "$prompt $" { fail "help fg" }
-       timeout         { fail "(timeout) help fg" }
-       }
-
-
+gdb_test "help fg" "Continue program being debugged.*"  "help fg"
 # test help file
-send "help file\n"
-expect {
-       -re "Use FILE as program to be debugged..*
-It is read for its symbols, for getting the contents of pure memory,.*
-and it is the program executed when you use the `run' command..*
-If FILE cannot be found as specified, your execution directory path.*
-..PATH. is searched for a command of that name..*
-No arg means to have no executable file and no symbols..*$prompt $"\
-                       { pass "help file" }
-       -re "$prompt $" { fail "help file" }
-       timeout         { fail "(timeout) help file" }
-       }
-
-
+gdb_test "help file" "Use FILE as program to be debugged..*\[\r\n\]+It is read for its symbols, for getting the contents of pure memory,.*\[\r\n\]+and it is the program executed when you use the `run' command..*\[\r\n\]+If FILE cannot be found as specified, your execution directory path.*\[\r\n\]+..PATH. is searched for a command of that name..*\[\r\n\]+No arg means to have no executable file and no symbols." "help file"
 # test help files
-send "help files\n"
-expect {
-       -re "Specifying.*$prompt $"  { pass "help files" }
-       -re "$prompt $" { fail "help files" }
-       timeout         { fail "(timeout) help files" }
-       }
-
-
+gdb_test "help files" "Specifying.*" "help files"
 # test help finish
-send "help finish\n"
-expect {
-       -re "Execute until selected stack frame returns..*
-Upon return, the value returned is printed and put in the value history..*$prompt $"\
-                       { pass "help finish" }
-       -re "$prompt $" { fail "help finish" }
-       timeout         { fail "(timeout) help finish" }
-       }
-
-
+gdb_test "help finish" "Execute until selected stack frame returns..*\[\r\n\]+Upon return, the value returned is printed and put in the value history." "help finish"
 # test help forward-search
-send "help forward-search\n"
-expect {
-       -re "Search for regular expression .see regex.3.. from last line listed..*$prompt $"\
-                       { pass "help forward-search" }
-       -re "$prompt $" { fail "help forward-search" }
-       timeout         { fail "(timeout) help forward-search" }
-       }
-
-
+gdb_test "help forward-search" "Search for regular expression .see regex.3.. from last line listed..*"  "help forward-search"
 # test help help "h" abbreviation 
-send "help h\n"
-expect {
-       -re "Print list of commands..*$prompt $"\
-                       { pass "help help \"h\" abbreviation" }
-       -re "$prompt $" { fail "help help \"h\" abbreviation" }
-       timeout         { fail "(timeout) help help \"h\" abbreviation" }
-       }
-
-
+gdb_test "help h" "Print list of commands."  "help help \"h\" abbreviation"
 # test help help
-send "help help\n"
-expect {
-       -re "Print list of commands..*$prompt $"\
-                       { pass "help help" }
-       -re "$prompt $" { fail "help help" }
-       timeout         { fail "(timeout) help help" }
-       }
-
-
+gdb_test "help help" "Print list of commands."  "help help"
 # test help handle
-send "help handle\n"
-expect {
-       -re "Specify how to handle a signal..*$prompt $"\
-                       { pass "help handle" }
-       -re "$prompt $" { fail "help handle" }
-       timeout         { fail "(timeout) help handle" }
-       }
-
-
+gdb_test "help handle" "Specify how to handle a signal..*"  "help handle"
 # test help info "i" abbreviation
-send "help i\n"
-expect {
-       -re "Generic command for showing things about the program being debugged..*
-List of info subcommands:.*
-Type \"help info\" followed by info subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help info \"i\" abbreviation" }
-       -re "$prompt $" { fail "help info \"i\" abbreviation" }
-       timeout         { fail "(timeout) help info \"i\" abbreviation" }
-       }
-
-
+gdb_test "help i" "Generic command for showing things about the program being debugged..*\[\r\n\]+List of info subcommands:.*\[\r\n\]+Type \"help info\" followed by info subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help info \"i\" abbreviation"
 # test help info
-send "help info\n"
-expect {
-       -re "Generic command for showing things about the program being debugged..*
-List of info subcommands:.*
-Type \"help info\" followed by info subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help info" }
-       -re "$prompt $" { fail "help info" }
-       timeout         { fail "(timeout) help info" }
-       }
-
-
+gdb_test "help info" "Generic command for showing things about the program being debugged..*\[\r\n\]+List of info subcommands:.*\[\r\n\]+Type \"help info\" followed by info subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help info"
 # test help ignore
-send "help ignore\n"
-expect {
-       -re "Set ignore-count of breakpoint number N to COUNT..*
-Usage is `ignore N COUNT'..*$prompt $"\
-                       { pass "help ignore" }
-       -re "$prompt $" { fail "help ignore" }
-       timeout         { fail "(timeout) help ignore" }
-       }
-
-
+gdb_test "help ignore" "Set ignore-count of breakpoint number N to COUNT..*\[\r\n\]+Usage is `ignore N COUNT'." "help ignore"
 # test help info address
-send "help info address\n"
-expect {
-       -re "Describe where variable VAR is stored..*$prompt $"\
-                       { pass "help info address" }
-       -re "$prompt $" { fail "help info address" }
-       timeout         { fail "(timeout) help info address" }
-       }
-
-
+gdb_test "help info address" "Describe where variable VAR is stored."  "help info address"
 # test help info all-registers
-send "help info all-registers\n"
-expect {
-       -re "List of all registers and their contents, for selected stack frame..*
-Register name as argument means describe only that register..*$prompt $"\
-                       { pass "help info all-registers" }
-       -re "$prompt $" { fail "help info all-registers" }
-       timeout         { fail "(timeout) help info all-registers" }
-       }
-
-
+gdb_test "help info all-registers" "List of all registers and their contents, for selected stack frame..*\[\r\n\]+Register name as argument means describe only that register." pass "help info all-registers"  "help info all-registers"
 # test help info args
-send "help info args\n"
-expect {
-       -re "Argument variables of current stack frame..*$prompt $"\
-                       { pass "help info args" }
-       -re "$prompt $" { fail "help info args" }
-       timeout         { fail "(timeout) help info args" }
-       }
-
-
+gdb_test "help info args" "Argument variables of current stack frame."  "help info args"
 # test help info breakpoints
-send "help info breakpoints\n"
-expect {
-       -re "Status of user-settable breakpoints, or breakpoint number NUMBER..*
-breakpoint set..*$prompt $"\
-                       { pass "help info breakpoints" }
-       -re "$prompt $" { fail "help info breakpoints" }
-       timeout         { fail "(timeout) help info breakpoints" }
-       }
-
-
+gdb_test "help info breakpoints" "Status of user-settable breakpoints, or breakpoint number NUMBER..*\[\r\n\]+breakpoint set." "help info breakpoints"
 # test help info catch
-send "help info catch\n"
-expect {
-       -re "Exceptions that can be caught in the current stack frame..*$prompt $"\
-                       { pass "help info catch" }
-       -re "$prompt $" { fail "help info catch" }
-       timeout         { fail "(timeout) help info catch" }
-       }
-
-
+gdb_test "help info catch" "Exceptions that can be caught in the current stack frame."  "help info catch"
 # test help info copying
-send "help info copying\n"
-expect {
-       -re "Conditions for redistributing copies of GDB..*$prompt $"\
-                       { pass "help info copying" }
-       -re "$prompt $" { fail "help info copying" }
-       timeout         { fail "(timeout) help info copying" }
-       }
-
-
+gdb_test "help info copying" "Conditions for redistributing copies of GDB."  "help info copying"
 # test help info display
-send "help info display\n"
-expect {
-       -re "Expressions to display when program stops, with code numbers..*$prompt $"\
-                       { pass "help info display" }
-       -re "$prompt $" { fail "help info display" }
-       timeout         { fail "(timeout) help info display" }
-       }
-
-
+gdb_test "help info display" "Expressions to display when program stops, with code numbers."  "help info display"
 # test help info frame "f" abbreviation
-send "help info f\n"
-expect {
-       -re "All about selected stack frame, or frame at ADDR..*$prompt $"\
-                       { pass "help info frame \"f\" abbreviation" }
-       -re "$prompt $" { fail "help info frame \"f\" abbreviation" }
-       timeout         { fail "(timeout) help info frame \"f\" abbreviation" }
-       }
-
-
+gdb_test "help info f" "All about selected stack frame, or frame at ADDR."  "help info frame \"f\" abbreviation"
 # test help info frame
-send "help info frame\n"
-expect {
-       -re "All about selected stack frame, or frame at ADDR..*$prompt $"\
-                       { pass "help info frame" }
-       -re "$prompt $" { fail "help info frame" }
-       timeout         { fail "(timeout) help info frame" }
-       }
-
-
+gdb_test "help info frame" "All about selected stack frame, or frame at ADDR."  "help info frame"
 # test help info files
-send "help info files\n"
-expect {
-       -re "Names of targets and files being debugged..*
-Shows the entire stack of targets currently in use .including the exec-file,.*
-core-file, and process, if any., as well as the symbol file name..*$prompt $"\
-                       { pass "help info files" }
-       -re "$prompt $" { fail "help info files" }
-       timeout         { fail "(timeout) help info files" }
-       }
-
-
+gdb_test "help info files" "Names of targets and files being debugged..*\[\r\n\]+Shows the entire stack of targets currently in use .including the exec-file,.*\[\r\n\]+core-file, and process, if any., as well as the symbol file name." "help info files"
 # test help info float
-send "help info float\n"
-expect {
-       -re "Print the status of the floating point unit.*$prompt $"\
-                       { pass "help info float" }
-       -re "$prompt $" { fail "help info float" }
-       timeout         { fail "(timeout) help info float" }
-       }
-
-
+gdb_test "help info float" "Print the status of the floating point unit"  "help info float"
 # test help info functions
-send "help info functions\n"
-expect {
-       -re "All function names, or those matching REGEXP..*$prompt $"\
-                       { pass "help info functions" }
-       -re "$prompt $" { fail "help info functions" }
-       timeout         { fail "(timeout) help info functions" }
-       }
-
-
+gdb_test "help info functions" "All function names, or those matching REGEXP."  "help info functions"
 # test help info line
-send "help info line\n"
-expect {
-       -re "Core addresses of the code for a source line..*
-Line can be specified as.*
-  LINENUM, to list around that line in current file,.*
-  FILE:LINENUM, to list around that line in that file,.*
-  FUNCTION, to list around beginning of that function,.*
-  FILE:FUNCTION, to distinguish among like-named static functions..*
-Default is to describe the last source line that was listed..*
-This sets the default address for \"x\" to the line's first instruction.*
-so that \"x.i\" suffices to start examining the machine code..*
-The address is also stored as the value of \"._\"..*$prompt $"\
-                       { pass "help info line" }
-       -re "$prompt $" { fail "help info line" }
-       timeout         { fail "(timeout) help info line" }
-       }
-
-
+gdb_test "help info line" "Core addresses of the code for a source line..*\[\r\n\]+Line can be specified as.*\[\r\n\]+  LINENUM, to list around that line in current file,.*\[\r\n\]+  FILE:LINENUM, to list around that line in that file,.*\[\r\n\]+  FUNCTION, to list around beginning of that function,.*\[\r\n\]+  FILE:FUNCTION, to distinguish among like-named static functions..*\[\r\n\]+Default is to describe the last source line that was listed..*\[\r\n\]+This sets the default address for \"x\" to the line's first instruction.*\[\r\n\]+so that \"x.i\" suffices to start examining the machine code..*\[\r\n\]+The address is also stored as the value of \"._\"." "help info line"
 # test help info locals
-send "help info locals\n"
-expect {
-       -re "Local variables of current stack frame..*$prompt $"\
-                       { pass "help info locals" }
-       -re "$prompt $" { fail "help info locals" }
-       timeout         { fail "(timeout) help info locals" }
-       }
-
-
+gdb_test "help info locals" "Local variables of current stack frame."  "help info locals"
 # test help info program
-send "help info program\n"
-expect {
-       -re "Execution status of the program..*$prompt $"\
-                       { pass "help info program" }
-       -re "$prompt $" { fail "help info program" }
-       timeout         { fail "(timeout) help info program" }
-       }
-
-
+gdb_test "help info program" "Execution status of the program."  "help info program"
 # test help info registers
-send "help info registers\n"
-expect {
-       -re "List of integer registers and their contents, for selected stack frame..*
-Register name as argument means describe only that register..*$prompt $"\
-                       { pass "help info registers" }
-       -re "$prompt $" { fail "help info registers" }
-       timeout         { fail "(timeout) help info registers" }
-       }
-
-
+gdb_test "help info registers" "List of integer registers and their contents, for selected stack frame..*\[\r\n\]+Register name as argument means describe only that register." "help info registers"
 # test help info stack "s" abbreviation
-send "help info s\n"
-expect {
-       -re "Backtrace of the stack, or innermost COUNT frames..*$prompt $"\
-                       { pass "help info stack \"s\" abbreviation" }
-       -re "$prompt $" { fail "help info stack \"s\" abbreviation" }
-       timeout         { fail "(timeout) help info stack \"s\" abbreviation" }
-       }
-
-
+gdb_test "help info s" "Backtrace of the stack, or innermost COUNT frames."  "help info stack \"s\" abbreviation"
 # test help info stack
-send "help info stack\n"
-expect {
-       -re "Backtrace of the stack, or innermost COUNT frames..*$prompt $"\
-                       { pass "help info stack" }
-       -re "$prompt $" { fail "help info stack" }
-       timeout         { fail "(timeout) help info stack" }
-       }
-
-
+gdb_test "help info stack" "Backtrace of the stack, or innermost COUNT frames."  "help info stack"
 # test help info set
-send "help info set\n"
-expect {
-       -re "Show all GDB settings..*$prompt $"\
-                       { pass "help info set" }
-       -re "$prompt $" { fail "help info set" }
-       timeout         { fail "(timeout) help info set" }
-       }
-
-
+gdb_test "help info set" "Show all GDB settings."  "help info set"
 # test help info signals
-send "help info signals\n"
-expect {
-       -re "What debugger does when program gets various signals.*$prompt $"\
-                       { pass "help info signals" }
-       -re "$prompt $" { fail "help info signals" }
-       timeout         { fail "(timeout) help info signals" }
-       }
-
-
+gdb_test "help info signals" "What debugger does when program gets various signals.*"  "help info signals"
 # test help info source
-send "help info source\n"
-expect {
-       -re "Information about the current source file..*$prompt $"\
-                       { pass "help info source" }
-       -re "$prompt $" { fail "help info source" }
-       timeout         { fail "(timeout) help aliases" }
-       }
-
-
+gdb_test "help info source" "Information about the current source file."  "help info source"
 # test help info sources
-send "help info sources\n"
-expect {
-       -re "Source files in the program..*$prompt $"\
-                       { pass "help info sources" }
-       -re "$prompt $" { fail "help info sources" }
-       timeout         { fail "(timeout) help info sources" }
-       }
-
-
+gdb_test "help info sources" "Source files in the program."  "help info sources"
 # test help info target
-send "help info target\n"
-expect {
-       -re "Names of targets and files being debugged..*
-Shows the entire stack of targets currently in use .including the exec-file,.*
-core-file, and process, if any., as well as the symbol file name..*$prompt $"\
-                       { pass "help info target" }
-       -re "$prompt $" { fail "help info target" }
-       timeout         { fail "(timeout) help info target" }
-       }
-
-
+gdb_test "help info target" "Names of targets and files being debugged..*\[\r\n\]+Shows the entire stack of targets currently in use .including the exec-file,.*\[\r\n\]+core-file, and process, if any., as well as the symbol file name." "help info target"
 # test help info terminal
-send "help info terminal\n"
-expect {
-       -re "Print inferior's saved terminal status..*$prompt $"\
-                       { pass "help info terminal" }
-       -re "$prompt $" { fail "help info terminal" }
-       timeout         { fail "(timeout) help info terminal" }
-       }
-
-
+gdb_test "help info terminal" "Print inferior's saved terminal status."  "help info terminal"
 # test help info types
-send "help info types\n"
-expect {
-       -re "All type names, or those matching REGEXP..*$prompt $"\
-                       { pass "help info types" }
-       -re "$prompt $" { fail "help info types" }
-       timeout         { fail "(timeout) help info types" }
-       }
-
-
+gdb_test "help info types" "All type names, or those matching REGEXP."  "help info types"
 # test help info variables
-send "help info variables\n"
-expect {
-       -re "All global and static variable names, or those matching REGEXP..*$prompt $"\
-                       { pass "help info variables" }
-       -re "$prompt $" { fail "help info variables" }
-       timeout         { fail "(timeout) help info variables" }
-       }
-
-
+gdb_test "help info variables" "All global and static variable names, or those matching REGEXP."  "help info variables"
 # test help info warranty
-send "help info warranty\n"
-expect {
-       -re "Various kinds of warranty you do not have..*$prompt $"\
-                       { pass "help info warranty" }
-       -re "$prompt $" { fail "help info warranty" }
-       timeout         { fail "(timeout) help info warranty" }
-       }
-
-
+gdb_test "help info warranty" "Various kinds of warranty you do not have."  "help info warranty"
 # test help info watchpoints
-send "help info watchpoints\n"
-expect {
-       -re "Synonym for ``info breakpoints''..*$prompt $"\
-                       { pass "help info watchpoints" }
-       -re "$prompt $" { fail "help info watchpoints" }
-       timeout         { fail "(timeout) help info watchpoints" }
-       }
-
-
+gdb_test "help info watchpoints" "Synonym for ``info breakpoints''."  "help info watchpoints"
 # test help inspect
-send "help inspect\n"
-expect {
-       -re "Same as \"print\" command, except that if you are running in the epoch.*
-environment, the value is printed in its own window..*$prompt $"\
-                       { pass "help inspect" }
-       -re "$prompt $" { fail "help inspect" }
-       timeout         { fail "(timeout) help inspect" }
-       }
-
-
+gdb_test "help inspect" "Same as \"print\" command, except that if you are running in the epoch.*\[\r\n\]+environment, the value is printed in its own window." "help inspect"
 # test help jump
-send "help jump\n"
-expect {
-       -re "Continue program being debugged at specified line or address..*
-Give as argument either LINENUM or \[*\]+ADDR, where ADDR is an expression.*
-for an address to start at..*$prompt $"\
-                       { pass "help jump" }
-       -re "$prompt $" { fail "help jump" }
-       timeout         { fail "(timeout) help jump" }
-       }
-
-
+gdb_test "help jump" "Continue program being debugged at specified line or address..*\[\r\n\]+Give as argument either LINENUM or \[*\]+ADDR, where ADDR is an expression.*\[\r\n\]+for an address to start at." "help jump"
 # test help kill
-send "help kill\n"
-expect {
-       -re "Kill execution of program being debugged..*$prompt $"\
-                       { pass "help kill" }
-       -re "$prompt $" { fail "help kill" }
-       timeout         { fail "(timeout) help kill" }
-       }
-
-
+gdb_test "help kill" "Kill execution of program being debugged."  "help kill"
 # test help list "l" abbreviation
-send "help l\n"
-expect {
-       -re "List specified function or line..*
-With no argument, lists ten more lines after or around previous listing..*
-\"list -\" lists the ten lines before a previous ten-line listing..*
-One argument specifies a line, and ten lines are listed around that line..*
-Two arguments with comma between specify starting and ending lines to list..*
-Lines can be specified in these ways:.*
-  LINENUM, to list around that line in current file,.*
-  FILE:LINENUM, to list around that line in that file,.*
-  FUNCTION, to list around beginning of that function,.*
-  FILE:FUNCTION, to distinguish among like-named static functions..*
-  \[*\]+ADDRESS, to list around the line containing that address..*
-With two args if one is empty it stands for ten lines away from the other arg..*$prompt $"\
-                       { pass "help list \"l\" abbreviation" }
-       -re "$prompt $" { fail "help list \"l\" abbreviation" }
-       timeout         { fail "(timeout) help list \"l\" abbreviation" }
-       }
-
-
+gdb_test "help l" "List specified function or line..*\[\r\n\]+With no argument, lists ten more lines after or around previous listing..*\[\r\n\]+\"list -\" lists the ten lines before a previous ten-line listing..*\[\r\n\]+One argument specifies a line, and ten lines are listed around that line..*\[\r\n\]+Two arguments with comma between specify starting and ending lines to list..*\[\r\n\]+Lines can be specified in these ways:.*\[\r\n\]+  LINENUM, to list around that line in current file,.*\[\r\n\]+  FILE:LINENUM, to list around that line in that file,.*\[\r\n\]+  FUNCTION, to list around beginning of that function,.*\[\r\n\]+  FILE:FUNCTION, to distinguish among like-named static functions..*\[\r\n\]+  \[*\]+ADDRESS, to list around the line containing that address..*\[\r\n\]+With two args if one is empty it stands for ten lines away from the other arg." "help list \"l\" abbreviation"
 # test help list
-send "help list\n"
-expect {
-       -re "List specified function or line..*
-With no argument, lists ten more lines after or around previous listing..*
-\"list -\" lists the ten lines before a previous ten-line listing..*
-One argument specifies a line, and ten lines are listed around that line..*
-Two arguments with comma between specify starting and ending lines to list..*
-Lines can be specified in these ways:.*
-  LINENUM, to list around that line in current file,.*
-  FILE:LINENUM, to list around that line in that file,.*
-  FUNCTION, to list around beginning of that function,.*
-  FILE:FUNCTION, to distinguish among like-named static functions..*
-  \[*\]+ADDRESS, to list around the line containing that address..*
-With two args if one is empty it stands for ten lines away from the other arg..*$prompt $"\
-                       { pass "help list" }
-       -re "$prompt $" { fail "help list" }
-       timeout         { fail "(timeout) help list" }
-       }
-
-
+gdb_test "help list" "List specified function or line..*\[\r\n\]+With no argument, lists ten more lines after or around previous listing..*\[\r\n\]+\"list -\" lists the ten lines before a previous ten-line listing..*\[\r\n\]+One argument specifies a line, and ten lines are listed around that line..*\[\r\n\]+Two arguments with comma between specify starting and ending lines to list..*\[\r\n\]+Lines can be specified in these ways:.*\[\r\n\]+  LINENUM, to list around that line in current file,.*\[\r\n\]+  FILE:LINENUM, to list around that line in that file,.*\[\r\n\]+  FUNCTION, to list around beginning of that function,.*\[\r\n\]+  FILE:FUNCTION, to distinguish among like-named static functions..*\[\r\n\]+  \[*\]+ADDRESS, to list around the line containing that address..*\[\r\n\]+With two args if one is empty it stands for ten lines away from the other arg." "help list"
 # test help load
-send "help load\n"
-expect {
-       -re "Dynamically load FILE into the running program, and record its symbols.*
-for access from GDB..*$prompt $"\
-                       { pass "help load" }
-       -re "$prompt $" { fail "help load" }
-       timeout         { fail "(timeout) help load" }
-       }
-
-
+gdb_test "help load" "Dynamically load FILE into the running program, and record its symbols.*\[\r\n\]+for access from GDB." "help load"
 # test help make
-send "help make\n"
-expect {
-       -re "Run the ``make'' program using the rest of the line as arguments..*$prompt $"\
-                       { pass "help make" }
-       -re "$prompt $" { fail "help make" }
-       timeout         { fail "(timeout) help make" }
-       }
-
-
+gdb_test "help make" "Run the ``make'' program using the rest of the line as arguments."  "help make"
 # test help next "n" abbreviation
-send "help n\n"
-expect {
-       -re "Step program, proceeding through subroutine calls..*
-Like the \"step\" command as long as subroutine calls do not happen;.*
-when they do, the call is treated as one instruction..*
-Argument N means do this N times .or till program stops for another reason...*$prompt $"\
-                       { pass "help next \"n\" abbreviation" }
-       -re "$prompt $" { fail "help next \"n\" abbreviation" }
-       timeout         { fail "(timeout) help next \"n\" abbreviation" }
-       }
-
-
+gdb_test "help n" "Step program, proceeding through subroutine calls..*\[\r\n\]+Like the \"step\" command as long as subroutine calls do not happen;.*\[\r\n\]+when they do, the call is treated as one instruction..*\[\r\n\]+Argument N means do this N times .or till program stops for another reason.." "help next \"n\" abbreviation"
 # test help next
-send "help next\n"
-expect {
-       -re "Step program, proceeding through subroutine calls..*
-Like the \"step\" command as long as subroutine calls do not happen;.*
-when they do, the call is treated as one instruction..*
-Argument N means do this N times .or till program stops for another reason...*$prompt $"\
-                       { pass "help next" }
-       -re "$prompt $" { fail "help next" }
-       timeout         { fail "(timeout) help next" }
-       }
-
-
+gdb_test "help next" "Step program, proceeding through subroutine calls..*\[\r\n\]+Like the \"step\" command as long as subroutine calls do not happen;.*\[\r\n\]+when they do, the call is treated as one instruction..*\[\r\n\]+Argument N means do this N times .or till program stops for another reason.." "help next"
 # test help nexti
-send "help ni\n"
-expect {
-       -re "Step one instruction, but proceed through subroutine calls..*
-Argument N means do this N times .or till program stops for another reason...*$prompt $"\
-                       { pass "help nexti" }
-       -re "$prompt $" { fail "help nexti" }
-       timeout         { fail "(timeout) help nexti" }
-       }
-
-
+gdb_test "help ni" "Step one instruction, but proceed through subroutine calls..*\[\r\n\]+Argument N means do this N times .or till program stops for another reason.." "help nexti"
 # all the commands that used to be here are now in "maintainance" instead
 # test help obscure
-send "help obscure\n"
-expect {
-       -re "Obscure features..*
-List of commands:.*
-Type \"help\" followed by command name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help obscure" }
-       -re "$prompt $" { fail "help obscure" }
-       timeout         { fail "(timeout) help obscure" }
-       }
-
-
+gdb_test "help obscure" "Obscure features..*\[\r\n\]+List of commands:.*\[\r\n\]+Type \"help\" followed by command name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help obscure"
 # test help output
-send "help output\n"
-expect {
-       -re "Like \"print\" but don't put in value history and don't print newline..*
-This is useful in user-defined commands..*$prompt $"\
-                       { pass "help output" }
-       -re "$prompt $" { fail "help output" }
-       timeout         { fail "(timeout) help output" }
-       }
-
-
+gdb_test "help output" "Like \"print\" but don't put in value history and don't print newline..*\[\r\n\]+This is useful in user-defined commands." "help output"
 # test help print "p" abbreviation
-send "help p\n"
-expect {
-       -re "Print value of expression EXP..*
-Variables accessible are those of the lexical environment of the selected.*
-EXP may be preceded with /FMT, where FMT is a format letter.*
-but no count or size letter .see \"x\" command...*$prompt $"\
-                       { pass "help print \"p\" abbreviation" }
-       -re "$prompt $" { fail "help print \"p\" abbreviation" }
-       timeout         { fail "(timeout) help print \"p\" abbreviation" }
-       }
-
-
+gdb_test "help p" "Print value of expression EXP..*\[\r\n\]+Variables accessible are those of the lexical environment of the selected.*\[\r\n\]+EXP may be preceded with /FMT, where FMT is a format letter.*\[\r\n\]+but no count or size letter .see \"x\" command.." "help print \"p\" abbreviation"
 # test help print
-send "help print\n"
-expect {
-       -re "Print value of expression EXP..*
-Variables accessible are those of the lexical environment of the selected.*
-EXP may be preceded with /FMT, where FMT is a format letter.*
-but no count or size letter .see \"x\" command...*$prompt $"\
-                       { pass "help print" }
-       -re "$prompt $" { fail "help print" }
-       timeout         { fail "(timeout) help print" }
-       }
-
-
+gdb_test "help print" "Print value of expression EXP..*\[\r\n\]+Variables accessible are those of the lexical environment of the selected.*\[\r\n\]+EXP may be preceded with /FMT, where FMT is a format letter.*\[\r\n\]+but no count or size letter .see \"x\" command.." "help print"
 # test help path
-send "help path\n"
-expect {
-       -re "Add directory DIR.s. to beginning of search path for object files..*
-.cwd in the path means the current working directory..*
-This path is equivalent to the .PATH shell variable.  It is a list of.*
-directories, separated by colons.  These directories are searched to find.*
-fully linked executable files and separately compiled object files as needed..*$prompt $"\
-                       { pass "help path" }
-       -re "$prompt $" { fail "help path" }
-       timeout         { fail "(timeout) help path" }
-       }
-
-
+gdb_test "help path" "Add directory DIR.s. to beginning of search path for object files..*\[\r\n\]+.cwd in the path means the current working directory..*\[\r\n\]+This path is equivalent to the .PATH shell variable.  It is a list of.*\[\r\n\]+directories, separated by colons.  These directories are searched to find.*\[\r\n\]+fully linked executable files and separately compiled object files as needed." "help path"
 # test help printcmds
-send "help printcmds\n"
-expect {
-       -re "Undefined command: \"printcmds\".  Try \"help\"..*$prompt $"\
-                       { pass "help printcmds" }
-       -re "$prompt $" { fail "help printcmds" }
-       timeout         { fail "(timeout) help printcmds" }
-       }
-
-
+gdb_test "help printcmds" "Undefined command: \"printcmds\".  Try \"help\"."  "help printcmds"
 # test help printf
-send "help printf\n"
-expect {
-       -re "printf \"printf format string\", arg1, arg2, arg3, ..., argn.*
-This is useful for formatted output in user-defined commands..*$prompt $"\
-                       { pass "help printf" }
-       -re "$prompt $" { fail "help printf" }
-       timeout         { fail "(timeout) help printf" }
-       }
-
-
-# this command doesn't exist in GDB 4.5.8
-# test help printsyms
-#send "help printsyms\n"
-#expect {
-#      -re "Print dump of current symbol definitions to file OUTFILE..*
-#If a SOURCE file is specified, dump only that file's symbols..*$prompt $"\
-#                      { pass "help printsyms" }
-#      -re "$prompt $" { fail "help printsyms" }
-#      timeout         { fail "(timeout) help printsyms" }
-#      }
-
+gdb_test "help printf" "printf \"printf format string\", arg1, arg2, arg3, ..., argn.*\[\r\n\]+This is useful for formatted output in user-defined commands." "help printf"
 # test help ptype
-send "help ptype\n"
-expect {
-       -re "Print definition of type.*$prompt $"\
-                       { pass "help ptype" }
-       -re "$prompt $" { fail "help ptype" }
-       timeout         { fail "(timeout) help ptype" }
-       }
-
-
+gdb_test "help ptype" "Print definition of type.*"  "help ptype"
 # test help pwd
-send "help pwd\n"
-expect {
-       -re "Print working directory.  This is used for your program as well..*$prompt $"\
-                       { pass "help pwd" }
-       -re "$prompt $" { fail "help pwd" }
-       timeout         { fail "(timeout) help pwd" }
-       }
-
-
+gdb_test "help pwd" "Print working directory.  This is used for your program as well."  "help pwd"
 # test help quit "q" abbreviation
-send "help q\n"
-expect {
-       -re "Exit gdb..*$prompt $"\
-                       { pass "help quit \"q\" abbreviation" }
-       -re "$prompt $" { fail "help quit \"q\" abbreviation" }
-       timeout         { fail "(timeout) help quit \"q\" abbreviation" }
-       }
-
-
+gdb_test "help q" "Exit gdb." "help quit \"q\" abbreviation"
 # test help quit
-send "help quit\n"
-expect {
-       -re "Exit gdb..*$prompt $"\
-                       { pass "help quit" }
-       -re "$prompt $" { fail "help quit" }
-       timeout         { fail "(timeout) help quit" }
-       }
-
-
+gdb_test "help quit" "Exit gdb."  "help quit"
 # test help run "r" abbreviation
-send "help r\n"
-expect {
-       -re "Start debugged program.  You may specify arguments to give it..*
-Args may include .*, or .*; they are expanded using \"sh\"..*
-Input and output redirection with \".\", \".\", or \"..\" are also allowed..*
-With no arguments, uses arguments last specified .with \"run\" or \"set args\"...*
-To cancel previous arguments and run with no arguments,.*
-use \"set args\" without arguments..*$prompt $"\
-                       { pass "help run \"r\" abbreviation" }
-       -re "$prompt $" { fail "help run \"r\" abbreviation" }
-       timeout         { fail "(timeout) help run \"r\" abbreviation" }
-       }
-
-
+gdb_test "help r" "Start debugged program.  You may specify arguments to give it..*\[\r\n\]+Args may include .*, or .*; they are expanded using \"sh\"..*\[\r\n\]+Input and output redirection with \".\", \".\", or \"..\" are also allowed..*\[\r\n\]+With no arguments, uses arguments last specified .with \"run\" or \"set args\"...*\[\r\n\]+To cancel previous arguments and run with no arguments,.*\[\r\n\]+use \"set args\" without arguments." "help run \"r\" abbreviation"
 # test help run
-send "help run\n"
-expect {
-       -re "Start debugged program.  You may specify arguments to give it..*
-Args may include .*, or .*; they are expanded using \"sh\"..*
-Input and output redirection with \".\", \".\", or \"..\" are also allowed..*
-With no arguments, uses arguments last specified .with \"run\" or \"set args\"...*
-To cancel previous arguments and run with no arguments,.*
-use \"set args\" without arguments..*$prompt $"\
-                       { pass "help run" }
-       -re "$prompt $" { fail "help run" }
-       timeout         { fail "(timeout) help run" }
-       }
-
-
+gdb_test "help run" "Start debugged program.  You may specify arguments to give it..*\[\r\n\]+Args may include .*, or .*; they are expanded using \"sh\"..*\[\r\n\]+Input and output redirection with \".\", \".\", or \"..\" are also allowed..*\[\r\n\]+With no arguments, uses arguments last specified .with \"run\" or \"set args\"...*\[\r\n\]+To cancel previous arguments and run with no arguments,.*\[\r\n\]+use \"set args\" without arguments." "help run"
 # test help rbreak
-send "help rbreak\n"
-expect {
-       -re "Set a breakpoint for all functions matching REGEXP..*$prompt $"\
-                       { pass "help rbreak" }
-       -re "$prompt $" { fail "help rbreak" }
-       timeout         { fail "(timeout) help rbreak" }
-       }
-
-
+gdb_test "help rbreak" "Set a breakpoint for all functions matching REGEXP."  "help rbreak"
 # test help return
-send "help return\n"
-expect {
-       -re "Make selected stack frame return to its caller..*
-Control remains in the debugger, but when you continue.*
-execution will resume in the frame above the one now selected..*
-If an argument is given, it is an expression for the value to return..*$prompt $"\
-                       { pass "help return" }
-       -re "$prompt $" { fail "help return" }
-       timeout         { fail "(timeout) help return" }
-       }
-
-
+gdb_test "help return" "Make selected stack frame return to its caller..*\[\r\n\]+Control remains in the debugger, but when you continue.*\[\r\n\]+execution will resume in the frame above the one now selected..*\[\r\n\]+If an argument is given, it is an expression for the value to return." "help return"
 # test help reverse-search
-send "help reverse-search\n"
-expect {
-       -re "Search backward for regular expression .see regex.3.. from last line listed..*$prompt $"\
-                       { pass "help reverse-search" }
-       -re "$prompt $" { fail "help reverse-search" }
-       timeout         { fail "(timeout) help reverse-search" }
-       }
-
-
+gdb_test "help reverse-search" "Search backward for regular expression .see regex.3.. from last line listed..*"  "help reverse-search"
 # test help running
-send "help running\n"
-expect {
-       -re "Running the program..*
-List of commands:.*
-Type \"help\" followed by command name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help running" }
-       -re "$prompt $" { fail "help running" }
-       timeout         { fail "(timeout) help running" }
-       }
-
-
+gdb_test "help running" "Running the program..*\[\r\n\]+List of commands:.*\[\r\n\]+Type \"help\" followed by command name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help running"
 # test help step "s" abbreviation
-send "help s\n"
-expect {
-       -re "Step program until it reaches a different source line..*
-Argument N means do this N times .or till program stops for another reason...*$prompt $"\
-                       { pass "help step \"s\" abbreviation" }
-       -re "$prompt $" { fail "help step \"s\" abbreviation" }
-       timeout         { fail "(timeout) help step \"s\" abbreviation" }
-       }
-
-
+gdb_test "help s" "Step program until it reaches a different source line..*\[\r\n\]+Argument N means do this N times .or till program stops for another reason.." "help step \"s\" abbreviation"
 # test help step
-send "help step\n"
-expect {
-       -re "Step program until it reaches a different source line..*
-Argument N means do this N times .or till program stops for another reason...*$prompt $"\
-                       { pass "help step" }
-       -re "$prompt $" { fail "help step" }
-       timeout         { fail "(timeout) help step" }
-       }
-
-
+gdb_test "help step" "Step program until it reaches a different source line..*\[\r\n\]+Argument N means do this N times .or till program stops for another reason.." "help step"
 # test help search
-send "help search\n"
-expect {
-       -re "Search for regular expression .see regex.3.. from last line listed..*$prompt $"\
-                       { pass "help search" }
-       -re "$prompt $" { fail "help search" }
-       timeout         { fail "(timeout) help search" }
-       }
-
-
+gdb_test "help search" "Search for regular expression .see regex.3.. from last line listed..*"  "help search"
 # test help section
-send "help section\n"
-expect {
-       -re "Change the base address of section SECTION of the exec file to ADDR..*
-This can be used if the exec file does not contain section addresses,.*
-.such as in the a.out format., or when the addresses specified in the.*
-file itself are wrong.  Each section must be changed separately.  The.*
-``info files'' command lists all the sections and their addresses..*$prompt $"\
-                       { pass "help section" }
-       -re "$prompt $" { fail "help section" }
-       timeout         { fail "(timeout) help section" }
-       }
-
-
+gdb_test "help section" "Change the base address of section SECTION of the exec file to ADDR..*\[\r\n\]+This can be used if the exec file does not contain section addresses,.*\[\r\n\]+.such as in the a.out format., or when the addresses specified in the.*\[\r\n\]+file itself are wrong.  Each section must be changed separately.  The.*\[\r\n\]+``info files'' command lists all the sections and their addresses." "help section"
+#test help set annotate
+gdb_test "help set annotate" "Set annotation_level.*\[\r\n\]+0 == normal;     1 == fullname \\(for use when running under emacs\\).*\[\r\n\]+2 == output annotated suitably for use by programs that control GDB." "help set annotate"
 # test help set args
-send "help set args\n"
-expect {
-       -re "Set arguments to give program being debugged when it is started..*
-Follow this command with any number of args, to be passed to the program..*$prompt $"\
-                       { pass "help set args" }
-       -re "$prompt $" { fail "help set args" }
-       timeout         { fail "(timeout) help set args" }
-       }
-
-
+gdb_test "help set args" "Set arguments to give program being debugged when it is started..*\[\r\n\]+Follow this command with any number of args, to be passed to the program."  -re "Set arguments to give program being debugged when it is started..*\[\r\n\]+Follow this command with any number of args, to be passed to the program..*$prompt $"
+gdb_test "help set args"
 # test help set check "c" abbreviation
-send "help set c\n"
-expect {
-       -re "Set the status of the type/range checker.*
-List of set check subcommands:.*
-set check range -- Set range checking.*
-set check type -- Set type checking.*
-Type \"help set check\" followed by set check subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help set check \"c\" abbreviation" }
-       -re "$prompt $" { fail "help set check \"c\" abbreviation" }
-       timeout         { fail "(timeout) help set check \"c\" abbreviation" }
-       }
-
-
+gdb_test "help set c" "Set the status of the type/range checker.*\[\r\n\]+List of set check subcommands:.*\[\r\n\]+set check range -- Set range checking.*\[\r\n\]+set check type -- Set type checking.*\[\r\n\]+Type \"help set check\" followed by set check subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help set check \"c\" abbreviation"
 # test help set check "ch" abbreviation
-send "help set ch\n"
-expect {
-       -re "Set the status of the type/range checker.*
-List of set check subcommands:.*
-set check range -- Set range checking.*
-set check type -- Set type checking.*
-Type \"help set check\" followed by set check subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help set check \"ch\" abbreviation" }
-       -re "$prompt $" { fail "help set check \"ch\" abbreviation" }
-       timeout         { fail "(timeout) help set check \"ch\" abbreviation" }
-       }
-
-
+gdb_test "help set ch" "Set the status of the type/range checker.*\[\r\n\]+List of set check subcommands:.*\[\r\n\]+set check range -- Set range checking.*\[\r\n\]+set check type -- Set type checking.*\[\r\n\]+Type \"help set check\" followed by set check subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help set check \"ch\" abbreviation"
 # test help set check
-send "help set check\n"
-expect {
-       -re "Set the status of the type/range checker.*
-List of set check subcommands:.*
-set check range -- Set range checking.*
-set check type -- Set type checking.*
-Type \"help set check\" followed by set check subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help set check" }
-       -re "$prompt $" { fail "help set check" }
-       timeout         { fail "(timeout) help set check" }
-       }
-
-
+gdb_test "help set check" "Set the status of the type/range checker.*\[\r\n\]+List of set check subcommands:.*\[\r\n\]+set check range -- Set range checking.*\[\r\n\]+set check type -- Set type checking.*\[\r\n\]+Type \"help set check\" followed by set check subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help set check"
 # test help set check range
-send "help set check range\n"
-expect {
-       -re "Set range checking.  .on/warn/off/auto..*$prompt $"\
-                       { pass "help set check range" }
-       -re "$prompt $" { fail "help set check range" }
-       timeout         { fail "(timeout) help set check range" }
-       }
-
-
+gdb_test "help set check range" "Set range checking.  .on/warn/off/auto."  "help set check range"
 # test help set check type
-send "help set check type\n"
-expect {
-       -re "Set type checking.  .on/warn/off/auto..*$prompt $"\
-                       { pass "help set check type" }
-       -re "$prompt $" { fail "help set check type" }
-       timeout         { fail "(timeout) help set check type" }
-       }
-
-
+gdb_test "help set check type" "Set type checking.  .on/warn/off/auto."  "help set check type"
 # test help set complaints
-send "help set complaints\n"
-expect {
-       -re "Set max number of complaints about incorrect symbols..*$prompt $"\
-                       { pass "help set complaints" }
-       -re "$prompt $" { fail "help set complaints" }
-       timeout         { fail "(timeout) help set complaints" }
-       }
-
-
+gdb_test "help set complaints" "Set max number of complaints about incorrect symbols."  "help set complaints"
 # test help set confirm
-send "help set confirm\n"
-expect {
-       -re "Set whether to confirm potentially dangerous operations..*$prompt $"\
-                       { pass "help set confirm" }
-       -re "$prompt $" { fail "help set confirm" }
-       timeout         { fail "(timeout) help set confirm" }
-       }
-
-
+gdb_test "help set confirm" "Set whether to confirm potentially dangerous operations."  "help set confirm"
 # test help set editing
-send "help set editing\n"
-expect {
-       -re "Set editing of command lines as they are typed..*
-Use \"on\" to enable to enable the editing, and \"off\" to disable it..*
-Without an argument, command line editing is enabled.  To edit, use.*
-EMACS-like or VI-like commands like control-P or ESC..*$prompt $"\
-                       { pass "help set editing" }
-       -re "$prompt $" { fail "help set editing" }
-       timeout         { fail "(timeout) help set editing" }
-       }
-
-
+gdb_test "help set editing" "Set editing of command lines as they are typed..*\[\r\n\]+Use \"on\" to enable to enable the editing, and \"off\" to disable it..*\[\r\n\]+Without an argument, command line editing is enabled.  To edit, use.*\[\r\n\]+EMACS-like or VI-like commands like control-P or ESC." "help set editing"
 # test help set environment
-send "help set environment\n"
-expect {
-       -re "Set environment variable value to give the program..*
-Arguments are VAR VALUE where VAR is variable name and VALUE is value..*
-VALUES of environment variables are uninterpreted strings..*
-This does not affect the program until the next \"run\" command..*$prompt $"\
-                       { pass "help set environment" }
-       -re "$prompt $" { fail "help set environment" }
-       timeout         { fail "(timeout) help set environment" }
-       }
-
-
+gdb_test "help set environment" "Set environment variable value to give the program..*\[\r\n\]+Arguments are VAR VALUE where VAR is variable name and VALUE is value..*\[\r\n\]+VALUES of environment variables are uninterpreted strings..*\[\r\n\]+This does not affect the program until the next \"run\" command." "help set environment"
 # test help set height
-send "help set height\n"
-expect {
-       -re "Set number of lines gdb thinks are in a page..*$prompt $"\
-                       { pass "help set height" }
-       -re "$prompt $" { fail "help set height" }
-       timeout         { fail "(timeout) help set height" }
-       }
-
-
+gdb_test "help set height" "Set number of lines gdb thinks are in a page."  "help set height"
 # test help set history expansion
-send "help set history expansion\n"
-expect {
-       -re "Set history expansion on command input..*
-Without an argument, history expansion is enabled..*$prompt $"\
-                       { pass "help set history expansion" }
-       -re "$prompt $" { fail "help set history expansion" }
-       timeout         { fail "(timeout) help set history expansion" }
-       }
-
-
+gdb_test "help set history expansion" "Set history expansion on command input..*\[\r\n\]+Without an argument, history expansion is enabled." "help set history expansion"
 # test help set history filename
-send "help set history filename\n"
-expect {
-       -re "Set the filename in which to record the command history.*
- .the list of previous commands of which a record is kept...*$prompt $"\
-                       { pass "help set history filename" }
-       -re "$prompt $" { fail "help set history filename" }
-       timeout         { fail "(timeout) help set history filename" }
-       }
-
-
+gdb_test "help set history filename" "Set the filename in which to record the command history.*\[\r\n\]+ .the list of previous commands of which a record is kept.." "help set history filename"
 # test help set history save
-send "help set history save\n"
-expect {
-       -re "Set saving of the history record on exit..*
-Use \"on\" to enable to enable the saving, and \"off\" to disable it..*
-Without an argument, saving is enabled..*$prompt $"\
-                       { pass "help set history save" }
-       -re "$prompt $" { fail "help set history save" }
-       timeout         { fail "(timeout) help set history save" }
-       }
-
-
+gdb_test "help set history save" "Set saving of the history record on exit..*\[\r\n\]+Use \"on\" to enable to enable the saving, and \"off\" to disable it..*\[\r\n\]+Without an argument, saving is enabled." "help set history save"
 # test help set history size
-send "help set history size\n"
-expect {
-       -re "Set the size of the command history, .*
-ie. the number of previous commands to keep a record of..*$prompt $"\
-                       { pass "help set history size" }
-       -re "$prompt $" { fail "help set history size" }
-       timeout         { fail "(timeout) help set history size" }
-       }
-
-
+gdb_test "help set history size" "Set the size of the command history, .*\[\r\n\]+ie. the number of previous commands to keep a record of." "help set history size"
 # test help set history
-send "help set history\n"
-expect {
-       -re "Generic command for setting command history parameters..*
-List of set history subcommands:.*
-set history filename -- Set the filename in which to record the command history.*
-set history size -- Set the size of the command history.*
-set history save -- Set saving of the history record on exit.*
-set history expansion -- Set history expansion on command input.*
-Type \"help set history\" followed by set history subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help set history" }
-       -re "$prompt $" { fail "help set history" }
-       timeout         { fail "(timeout) help set history" }
-       }
-
-
+gdb_test "help set history" "Generic command for setting command history parameters..*\[\r\n\]+List of set history subcommands:.*\[\r\n\]+set history filename -- Set the filename in which to record the command history.*\[\r\n\]+set history size -- Set the size of the command history.*\[\r\n\]+set history save -- Set saving of the history record on exit.*\[\r\n\]+set history expansion -- Set history expansion on command input.*\[\r\n\]+Type \"help set history\" followed by set history subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help set history"
 # test help set language
-send "help set language\n"
-expect {
-       -re "Set the current source language..*$prompt $"\
-                       { pass "help set language" }
-       -re "$prompt $" { fail "help set language" }
-       timeout         { fail "(timeout) help set language" }
-       }
-
-
+gdb_test "help set language" "Set the current source language."  "help set language"
 # test help set listsize
-send "help set listsize\n"
-expect {
-       -re "Set number of source lines gdb will list by default..*$prompt $"\
-                       { pass "help set listsize" }
-       -re "$prompt $" { fail "help set listsize" }
-       timeout         { fail "(timeout) help set listsize" }
-       }
-
-
+gdb_test "help set listsize" "Set number of source lines gdb will list by default."  "help set listsize"
 # test help set print "p" abbreviation
 # FIXME -- Ultrix hangs randomly on this very long output from gdb and
 # continues with its output only if something is sent to gdb.
-# This behaviour throws expect and gdb out of sync, so we better skip this 
 # test.
 # Also, if the system is slow, it may time out because the output is large.
-# Just skip the test rather than bothering with increasing the timeout.
-if 0 then {
-send "help set p\n"
-expect {
-       -re ".*
-Generic command for setting how things print..*
-List of set print subcommands:.*
-Type \"help set print\" followed by set print subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help set print \"p\" abbreviatio" }
-       -re "$prompt $" { fail "help set print \"p\" abbreviatio" }
-       timeout         { fail "(timeout) help set print \"p\" abbreviatio" }
-       }
-
+gdb_test "help set p" ".*\[\r\n\]+Generic command for setting how things print..*\[\r\n\]+List of set print subcommands:.*\[\r\n\]+Type \"help set print\" followed by set print subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help set print \"p\" abbreviatio"
 # test help set print "pr" abbreviation
-send "help set pr\n"
-expect {
-       -re ".*
-Generic command for setting how things print..*
-List of set print subcommands:.*
-Type \"help set print\" followed by set print subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help set print \"pr\" abbreviation" }
-       -re "$prompt $" { fail "help set print \"pr\" abbreviation" }
-       timeout         { fail "(timeout) help set print \"pr\" abbreviation" }
-       }
-
-
+gdb_test "help set pr" ".*\[\r\n\]+Generic command for setting how things print..*\[\r\n\]+List of set print subcommands:.*\[\r\n\]+Type \"help set print\" followed by set print subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help set print \"pr\" abbreviation"
 # test help set print
-send "help set print\n"
-expect {
-       -re ".*
-Generic command for setting how things print..*
-List of set print subcommands:.*
-Type \"help set print\" followed by set print subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help set print" }
-       -re "$prompt $" { fail "help set print" }
-       timeout         { fail "(timeout) help set print" }
-       }
-}
-
+gdb_test "help set print" ".*\[\r\n\]+Generic command for setting how things print..*\[\r\n\]+List of set print subcommands:.*\[\r\n\]+Type \"help set print\" followed by set print subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help set print"
 # test help set print address
-send "help set print address\n"
-expect {
-       -re "Set printing of addresses..*$prompt $"\
-                       { pass "help set print address" }
-       -re "$prompt $" { fail "help set print address" }
-       timeout         { fail "(timeout) help set print address" }
-       }
-
-
+gdb_test "help set print address" "Set printing of addresses."  "help set print address"
 # test help set print array
-send "help set print array\n"
-expect {
-       -re "Set prettyprinting of arrays..*$prompt $"\
-                       { pass "help set print array" }
-       -re "$prompt $" { fail "help set print array" }
-       timeout         { fail "(timeout) help set print array" }
-       }
-
-
+gdb_test "help set print array" "Set prettyprinting of arrays."  "help set print array"
 # test help set print asm-demangle
-send "help set print asm-demangle\n"
-expect {
-       -re "Set demangling of C\[+\]+ names in disassembly listings..*$prompt $"\
-                       { pass "help set print asm-demangle" }
-       -re "$prompt $" { fail "help set print asm-demangle" }
-       timeout         { fail "(timeout) help set print asm-demangle" }
-       }
-
-
+gdb_test "help set print asm-demangle" "Set demangling of C\[+\]+ names in disassembly listings."  "help set print asm-demangle"
 # test help set print demangle
-send "help set print demangle\n"
-expect {
-       -re "Set demangling of encoded C\[+\]+ names when displaying symbols..*$prompt $"\
-                       { pass "help set print demangle" }
-       -re "$prompt $" { fail "help set print demangle" }
-       timeout         { fail "(timeout) help set print demangle" }
-       }
-
-
+gdb_test "help set print demangle" "Set demangling of encoded C\[+\]+ names when displaying symbols."  "help set print demangle"
 # test help set print elements
-send "help set print elements\n"
-expect {
-       -re "Set limit on string chars or array elements to print..*
-\"set print elements 0\" causes there to be no limit..*$prompt $"\
-                       { pass "help set print elements" }
-       -re "$prompt $" { fail "help set print elements" }
-       timeout         { fail "(timeout) help set print elements" }
-       }
-
-
+gdb_test "help set print elements" "Set limit on string chars or array elements to print..*\[\r\n\]+\"set print elements 0\" causes there to be no limit." "help set print elements"
 # test help set print object
-send "help set print object\n"
-expect {
-       -re "Set printing of object's derived type based on vtable info..*$prompt $"\
-                       { pass "help set print object" }
-       -re "$prompt $" { fail "help set print object" }
-       timeout         { fail "(timeout) help set print object" }
-       }
-
-
+gdb_test "help set print object" "Set printing of object's derived type based on vtable info."  "help set print object"
 # test help set print pretty
-send "help set print pretty\n"
-expect {
-       -re "Set prettyprinting of structures..*$prompt $"\
-                       { pass "help set print pretty" }
-       -re "$prompt $" { fail "help set print pretty" }
-       timeout         { fail "(timeout) help set print pretty" }
-       }
-
-
+gdb_test "help set print pretty" "Set prettyprinting of structures."  "help set print pretty"
 # test help set print sevenbit-strings
-send "help set print sevenbit-strings\n"
-expect {
-       -re "Set printing of 8-bit characters in strings as .nnn..*$prompt $"\
-                       { pass "help set print sevenbit-strings" }
-       -re "$prompt $" { fail "help set print sevenbit-strings" }
-       timeout         { fail "(timeout) help set print sevenbit-strings" }
-       }
-
-
+gdb_test "help set print sevenbit-strings" "Set printing of 8-bit characters in strings as .nnn."  "help set print sevenbit-strings"
 # test help set print union
-send "help set print union\n"
-expect {
-       -re "Set printing of unions interior to structures..*$prompt $"\
-                       { pass "help set print union" }
-       -re "$prompt $" { fail "help set print union" }
-       timeout         { fail "(timeout) help set print union" }
-       }
-
-
+gdb_test "help set print union" "Set printing of unions interior to structures."  "help set print union"
 # test help set print vtbl
-send "help set print vtbl\n"
-expect {
-       -re "Set printing of C\[+\]+ virtual function tables..*$prompt $"\
-                       { pass "help set print vtbl" }
-       -re "$prompt $" { fail "help set print vtbl" }
-       timeout         { fail "(timeout) help set print vtbl" }
-       }
-
-
+gdb_test "help set print vtbl" "Set printing of C\[+\]+ virtual function tables."  "help set print vtbl"
 # test help set prompt
-send "help set prompt\n"
-expect {
-       -re "Set gdb's prompt.*$prompt $"\
-                       { pass "help set prompt" }
-       -re "$prompt $" { fail "help set prompt" }
-       timeout         { fail "(timeout) help set prompt" }
-       }
-
-
+gdb_test "help set prompt" "Set gdb's prompt"  "help set prompt"
 # test help set radix
-send "help set radix\n"
-expect {
-       -re "Set default input and output number radices.*
-Use \'set input-radix\' or \'set output-radix\' to independently set each..*
-Without an argument, sets both radices back to the default value of 10..*
-.*$prompt $"\
-                       { pass "help set radix" }
-       -re "Set default input and output number radix..*$prompt $"\
-                       { fail "help set radix (obsolete radix support)" }
-       -re "$prompt $" { fail "help set radix" }
-       timeout         { fail "(timeout) help set radix" }
-       }
-
-
+gdb_test "help set radix" "Set default input and output number radices.*\[\r\n\]+Use \'set input-radix\' or \'set output-radix\' to independently set each..*\[\r\n\]+Without an argument, sets both radices back to the default value of 10..*\[\r\n\]+" "help set radix"
 # test help set symbol-reloading
-send "help set symbol-reloading\n"
-expect {
-       -re "Set dynamic symbol table reloading multiple times in one run..*$prompt $"\
-                       { pass "help set symbol-reloading" }
-       -re "$prompt $" { fail "help set symbol-reloading" }
-       timeout         { fail "(timeout) help set symbol-reloading" }
-       }
-
-
+gdb_test "help set symbol-reloading" "Set dynamic symbol table reloading multiple times in one run."  "help set symbol-reloading"
 # test help set variable
-send "help set variable\n"
-expect {
-       -re ".*
-Evaluate expression EXP and assign result to variable VAR, using assignment.*
-syntax appropriate for the current language .VAR = EXP or VAR := EXP for.*
-example..  VAR may be a debugger \"convenience\" variable .names starting.*
-with \\\$., a register .a few standard names starting with \\\$., or an actual.*
-variable in the program being debugged.  EXP is any valid expression.*
-This may usually be abbreviated to simply \"set\"..*$prompt $"\
-                       { pass "help set variable" }
-       -re "$prompt $" { fail "help set variable" }
-       timeout         { fail "(timeout) help set variable" }
-       }
-
-
+gdb_test "help set variable" ".*\[\r\n\]+Evaluate expression EXP and assign result to variable VAR, using assignment.*\[\r\n\]+syntax appropriate for the current language .VAR = EXP or VAR := EXP for.*\[\r\n\]+example..  VAR may be a debugger \"convenience\" variable .names starting.*\[\r\n\]+with \\\$., a register .a few standard names starting with \\\$., or an actual.*\[\r\n\]+variable in the program being debugged.  EXP is any valid expression.*\[\r\n\]+This may usually be abbreviated to simply \"set\"." "help set variable"
 # test help set verbose
-send "help set verbose\n"
-expect {
-       -re "Set verbosity..*$prompt $"\
-                       { pass "help set verbose" }
-       -re "Set verbose printing of informational messages.*$prompt $"\
-                       { pass "help set verbose. FIXME" }
-       -re "$prompt $" { fail "help set verbose" }
-       timeout         { fail "(timeout) help set verbose" }
-       }
-
-
+gdb_test "help set verbose" "Set verbosity."  "help set verbose"
 #test help set width
-send "help set width\n"
-expect {
-       -re "Set number of characters gdb thinks are in a line..*$prompt $"\
-                       { pass "help set width" }
-       -re "$prompt $" { fail "help set width" }
-       timeout         { fail "(timeout) help set width" }
-       }
-
-
+gdb_test "help set width" "Set number of characters gdb thinks are in a line."  "help set width"
 # test help set write
 # This is only supported on targets which use exec.o.
-if ![istarget "rs6000-*-*"] then {
-    send "help set write\n"
-    expect {
-       -re "Set writing into executable and core files..*$prompt $"\
-                       { pass "help set write" }
-       -re "$prompt $" { fail "help set write" }
-       timeout         { fail "(timeout) help set write" }
-       }
-}
-
+gdb_test "help set write" "Set writing into executable and core files."  "help set write"
 # test help set
 # FIXME -- Ultrix hangs randomly on this very long output from gdb and
 # continues with its output only if something is sent to gdb.
-# This behaviour throws expect and gdb out of sync, so we better skip this 
 # test.
 # Also, if the system is slow, it may time out because the output is large.
-# Just skip the test rather than bothering with increasing the timeout.
-if 0 then {
-if ![istarget "*-*-ultrix*"] then {
-    send "help set\n"
-    expect {
-       -re ".*
-Evaluate expression EXP and assign result to variable VAR, using assignment.*
-syntax appropriate for the current language .VAR = EXP or VAR := EXP for.*
-example..  VAR may be a debugger \"convenience\" variable .names starting.*
-with \\\$., a register .a few standard names starting with \\\$., or an actual.*
-variable in the program being debugged.  EXP is any valid expression.*
-set listsize -- Set number of source lines gdb will list by default.*
-Type \"help set\" followed by set subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*
-$prompt $"\
-                       { pass "help set" }
-       -re "$prompt $" { fail "help set" }
-       timeout         { fail "(timeout) help set" }
-       }
-}
-}
-
+gdb_test "help set" ".*\[\r\n\]+Evaluate expression EXP and assign result to variable VAR, using assignment.*\[\r\n\]+syntax appropriate for the current language .VAR = EXP or VAR := EXP for.*\[\r\n\]+example..  VAR may be a debugger \"convenience\" variable .names starting.*\[\r\n\]+with \\\$., a register .a few standard names starting with \\\$., or an actual.*\[\r\n\]+variable in the program being debugged.  EXP is any valid expression.*\[\r\n\]+set listsize -- Set number of source lines gdb will list by default.*\[\r\n\]+Type \"help set\" followed by set subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous..*\[\r\n\]+" "help set"
 # test help shell
-send "help shell\n"
-expect {
-       -re "Execute the rest of the line as a shell command.  .*
-With no arguments, run an inferior shell..*$prompt $"\
-                       { pass "help shell" }
-       -re "$prompt $" { fail "help shell" }
-       timeout         { fail "(timeout) help shell" }
-       }
-
-
+gdb_test "help shell" "Execute the rest of the line as a shell command.  .*\[\r\n\]+With no arguments, run an inferior shell." "help shell"
+#test help show annotate
+gdb_test "help show annotate" "Show annotation_level.*\[\r\n\]+0 == normal;     1 == fullname \\(for use when running under emacs\\).*\[\r\n\]+2 == output annotated suitably for use by programs that control GDB." "help show annotate"
 # test help show args
-send "help show args\n"
-expect {
-       -re "Show arguments to give program being debugged when it is started..*
-Follow this command with any number of args, to be passed to the program..*$prompt $"\
-                       { pass "help show args" }
-       -re "$prompt $" { fail "help show args" }
-       timeout         { fail "(timeout) help show args" }
-       }
-
-
+gdb_test "help show args" "Show arguments to give program being debugged when it is started..*\[\r\n\]+Follow this command with any number of args, to be passed to the program."  -re "Show arguments to give program being debugged when it is started..*\[\r\n\]+Follow this command with any number of args, to be passed to the program..*$prompt $"
+gdb_test "help show args"
 # test help show check "c" abbreviation
-send "help show c\n"
-expect {
-       -re "Show the status of the type/range checker.*
-List of show check subcommands:.*
-show check range -- Show range checking.*
-show check type -- Show type checking.*
-Type \"help show check\" followed by show check subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help show check \"c\" abbreviation" }
-       -re "$prompt $" { fail "help show check \"c\" abbreviation" }
-       timeout         { fail "(timeout) help show check \"c\" abbreviation" }
-       }
-
-
+gdb_test "help show c" "Show the status of the type/range checker.*\[\r\n\]+List of show check subcommands:.*\[\r\n\]+show check range -- Show range checking.*\[\r\n\]+show check type -- Show type checking.*\[\r\n\]+Type \"help show check\" followed by show check subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help show check \"c\" abbreviation"
 # test help show check
-send "help show check\n"
-expect {
-       -re "Show the status of the type/range checker.*
-List of show check subcommands:.*
-show check range -- Show range checking.*
-show check type -- Show type checking.*
-Type \"help show check\" followed by show check subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help show check" }
-       -re "$prompt $" { fail "help show check" }
-       timeout         { fail "(timeout) help show check" }
-       }
-
-
+gdb_test "help show check" "Show the status of the type/range checker.*\[\r\n\]+List of show check subcommands:.*\[\r\n\]+show check range -- Show range checking.*\[\r\n\]+show check type -- Show type checking.*\[\r\n\]+Type \"help show check\" followed by show check subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help show check"
 # test help show check range
-send "help show check range\n"
-expect {
-       -re "Show range checking.  .on/warn/off/auto..*$prompt $"\
-                       { pass "help show check range" }
-       -re "$prompt $" { fail "help show check range" }
-       timeout         { fail "(timeout) help show check range" }
-       }
-
-
+gdb_test "help show check range" "Show range checking.  .on/warn/off/auto."  "help show check range"
 # test help show check type
-send "help show check type\n"
-expect {
-       -re "Show type checking.  .on/warn/off/auto..*$prompt $"\
-                       { pass "help show check type" }
-       -re "$prompt $" { fail "help show check type" }
-       timeout         { fail "(timeout) help show check type" }
-       }
-
-
+gdb_test "help show check type" "Show type checking.  .on/warn/off/auto."  "help show check type"
 # test help show commands
-send "help show commands\n"
-expect {
-       -re "Show the the history of commands you typed..*
-You can supply a command number to start with, or a `\[+\]' to start after.*
-the previous command number shown..*$prompt $"\
-                       { pass "help show commands" }
-       -re "$prompt $" { fail "help show commands" }
-       timeout         { fail "(timeout) help show commands" }
-       }
-
-
+gdb_test "help show commands" "Show the history of commands you typed..*\[\r\n\]+You can supply a command number to start with, or a `\[+\]' to start after.*\[\r\n\]+the previous command number shown." "help show commands"
 # test help show complaints
-send "help show complaints\n"
-expect {
-       -re "Show max number of complaints about incorrect symbols..*$prompt $"\
-                       { pass "help show complaints" }
-       -re "$prompt $" { fail "help show complaints" }
-       timeout         { fail "(timeout) help show complaints" }
-       }
-
-
+gdb_test "help show complaints" "Show max number of complaints about incorrect symbols."  "help show complaints"
 # test help show confirm
-send "help show confirm\n"
-expect {
-       -re "Show whether to confirm potentially dangerous operations..*$prompt $"\
-                       { pass "help show confirm" }
-       -re "$prompt $" { fail "help show confirm" }
-       timeout         { fail "(timeout) help show confirm" }
-       }
-
-
+gdb_test "help show confirm" "Show whether to confirm potentially dangerous operations."  "help show confirm"
 # test help show convenience
-send "help show convenience\n"
-expect {
-       -re "Debugger convenience .\".foo\". variables..*
-These variables are created when you assign them values;.*
-thus, \"print .foo=1\" gives \".foo\" the value 1.  Values may be any type..*
-A few convenience variables are given values automatically:.*
-\"._\"holds the last address examined with \"x\" or \"info lines\",.*
-\".__\" holds the contents of the last address examined with \"x\"..*$prompt $"\
-                       { pass "help show convenience" }
-       -re "$prompt $" { fail "help show convenience" }
-       timeout         { fail "(timeout) help show convenience" }
-       }
-
-
+gdb_test "help show convenience" "Debugger convenience .\".foo\". variables..*\[\r\n\]+These variables are created when you assign them values;.*\[\r\n\]+thus, \"print .foo=1\" gives \".foo\" the value 1.  Values may be any type..*\[\r\n\]+A few convenience variables are given values automatically:.*\[\r\n\]+\"._\"holds the last address examined with \"x\" or \"info lines\",.*\[\r\n\]+\".__\" holds the contents of the last address examined with \"x\"." "help show convenience"
 # test help show directories
-send "help show directories\n"
-expect {
-       -re "Current search path for finding source files..*
-.cwd in the path means the current working directory..*
-.cdir in the path means the compilation directory of the source file..*$prompt $"\
-                       { pass "help show directories" }
-       -re "$prompt $" { fail "help show directories" }
-       timeout         { fail "(timeout) help show directories" }
-       }
-
-
+gdb_test "help show directories" "Current search path for finding source files..*\[\r\n\]+.cwd in the path means the current working directory..*\[\r\n\]+.cdir in the path means the compilation directory of the source file." "help show directories"
 # test help show editing
-send "help show editing\n"
-expect {
-       -re "Show editing of command lines as they are typed..*
-Use \"on\" to enable to enable the editing, and \"off\" to disable it..*
-Without an argument, command line editing is enabled.  To edit, use.*
-EMACS-like or VI-like commands like control-P or ESC..*$prompt $"\
-                       { pass "help show editing" }
-       -re "$prompt $" { fail "help show editing" }
-       timeout         { fail "(timeout) help show editing" }
-       }
-
-
+gdb_test "help show editing" "Show editing of command lines as they are typed..*\[\r\n\]+Use \"on\" to enable to enable the editing, and \"off\" to disable it..*\[\r\n\]+Without an argument, command line editing is enabled.  To edit, use.*\[\r\n\]+EMACS-like or VI-like commands like control-P or ESC." "help show editing"
 # test help show environment
-send "help show environment\n"
-expect {
-       -re "The environment to give the program, or one variable's value..*
-With an argument VAR, prints the value of environment variable VAR to.*
-give the program being debugged.  With no arguments, prints the entire.*
-environment to be given to the program..*$prompt $"\
-                       { pass "help show environment" }
-       -re "$prompt $" { fail "help show environment" }
-       timeout         { fail "(timeout) help show environment" }
-       }
-
-
+gdb_test "help show environment" "The environment to give the program, or one variable's value..*\[\r\n\]+With an argument VAR, prints the value of environment variable VAR to.*\[\r\n\]+give the program being debugged.  With no arguments, prints the entire.*\[\r\n\]+environment to be given to the program." "help show environment"
 # test help show height
-send "help show height\n"
-expect {
-       -re "Show number of lines gdb thinks are in a page..*$prompt $"\
-                       { pass "help show height" }
-       -re "$prompt $" { fail "help show height" }
-       timeout         { fail "(timeout) help show height" }
-       }
-
-
+gdb_test "help show height" "Show number of lines gdb thinks are in a page."  "help show height"
 # test help show history expansion
-send "help show history expansion\n"
-expect {
-       -re "Show history expansion on command input..*
-Without an argument, history expansion is enabled..*$prompt $"\
-                       { pass "help show history expansion" }
-       -re "$prompt $" { fail "help show history expansion" }
-       timeout         { fail "(timeout) help show history expansion" }
-       }
-
-
+gdb_test "help show history expansion" "Show history expansion on command input..*\[\r\n\]+Without an argument, history expansion is enabled." "help show history expansion"
 # test help show history filename
-send "help show history filename\n"
-expect {
-       -re "Show the filename in which to record the command history.*
- .the list of previous commands of which a record is kept...*$prompt $"\
-                       { pass "help show history filename" }
-       -re "$prompt $" { fail "help show history filename" }
-       timeout         { fail "(timeout) help show history filename" }
-       }
-
-
+gdb_test "help show history filename" "Show the filename in which to record the command history.*\[\r\n\]+ .the list of previous commands of which a record is kept.." "help show history filename"
 # test help show history save
-send "help show history save\n"
-expect {
-       -re "Show saving of the history record on exit..*
-Use \"on\" to enable to enable the saving, and \"off\" to disable it..*
-Without an argument, saving is enabled..*$prompt $"\
-                       { pass "help show history save" }
-       -re "$prompt $" { fail "help show history save" }
-       timeout         { fail "(timeout) help show history save" }
-       }
-
-
+gdb_test "help show history save" "Show saving of the history record on exit..*\[\r\n\]+Use \"on\" to enable to enable the saving, and \"off\" to disable it..*\[\r\n\]+Without an argument, saving is enabled." "help show history save"
 # test help show history size
-send "help show history size\n"
-expect {
-       -re "Show the size of the command history, .*
-ie. the number of previous commands to keep a record of..*$prompt $"\
-                       { pass "help show history size" }
-       -re "$prompt $" { fail "help show history size" }
-       timeout         { fail "(timeout) help show history size" }
-       }
-
-
+gdb_test "help show history size" "Show the size of the command history, .*\[\r\n\]+ie. the number of previous commands to keep a record of." "help show history size"
 # test help show history
-send "help show history\n"
-expect {
-       -re "Generic command for showing command history parameters..*
-List of show history subcommands:.*
-show history filename -- Show the filename in which to record the command history.*
-show history size -- Show the size of the command history.*
-show history save -- Show saving of the history record on exit.*
-show history expansion -- Show history expansion on command input.*
-Type \"help show history\" followed by show history subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help show history" }
-       -re "$prompt $" { fail "help show history" }
-       timeout         { fail "(timeout) help show history" }
-       }
-
-
+gdb_test "help show history" "Generic command for showing command history parameters..*\[\r\n\]+List of show history subcommands:.*\[\r\n\]+show history filename -- Show the filename in which to record the command history.*\[\r\n\]+show history size -- Show the size of the command history.*\[\r\n\]+show history save -- Show saving of the history record on exit.*\[\r\n\]+show history expansion -- Show history expansion on command input.*\[\r\n\]+Type \"help show history\" followed by show history subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help show history"
 # test help show language
-send "help show language\n"
-expect {
-       -re "Show the current source language..*$prompt $"\
-                       { pass "help show language" }
-       -re "$prompt $" { fail "help show language" }
-       timeout         { fail "(timeout) help show language" }
-       }
-
-
+gdb_test "help show language" "Show the current source language."  "help show language"
 # test help show listsize
-send "help show listsize\n"
-expect {
-       -re "Show number of source lines gdb will list by default..*$prompt $"\
-                       { pass "help show listsize" }
-       -re "$prompt $" { fail "help show listsize" }
-       timeout         { fail "(timeout) help show listsize" }
-       }
-
-
+gdb_test "help show listsize" "Show number of source lines gdb will list by default."  "help show listsize"
 # test help show print "p" abbreviation
-send "help show p\n"
-expect {
-       -re "Generic command for showing print settings..*
-List of show print subcommands:.*
-Type \"help show print\" followed by show print subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help show print \"p\" abbreviation" }
-       -re "$prompt $" { fail "help show print \"p\" abbreviation" }
-       timeout         { fail "(timeout) help show print \"p\" abbreviation" }
-       }
-
-
+gdb_test "help show p" "Generic command for showing print settings..*\[\r\n\]+List of show print subcommands:.*\[\r\n\]+Type \"help show print\" followed by show print subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help show print \"p\" abbreviation"
 # test help show print "pr" abbreviation
-send "help show pr\n"
-expect {
-       -re "Generic command for showing print settings..*
-List of show print subcommands:.*
-Type \"help show print\" followed by show print subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help show print \"pr\" abbreviation" }
-       -re "$prompt $" { fail "help show print \"pr\" abbreviation" }
-       timeout         { fail "(timeout) help show print \"pr\" abbreviation" }
-       }
-
-
+gdb_test "help show pr" "Generic command for showing print settings..*\[\r\n\]+List of show print subcommands:.*\[\r\n\]+Type \"help show print\" followed by show print subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help show print \"pr\" abbreviation"
 # test help show print
-send "help show print\n"
-expect {
-       -re "Generic command for showing print settings..*
-List of show print subcommands:.*
-Type \"help show print\" followed by show print subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help show print" }
-       -re "$prompt $" { fail "help show print" }
-       timeout         { fail "(timeout) help show print" }
-       }
-
-
+gdb_test "help show print" "Generic command for showing print settings..*\[\r\n\]+List of show print subcommands:.*\[\r\n\]+Type \"help show print\" followed by show print subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help show print"
 # test help show paths
-send "help show paths\n"
-expect {
-       -re "Current search path for finding object files..*
-.cwd in the path means the current working directory..*
-This path is equivalent to the .PATH shell variable.  It is a list of.*
-directories, separated by colons.  These directories are searched to find.*
-fully linked executable files and separately compiled object files as needed..*$prompt $"\
-                       { pass "help show paths" }
-       -re "$prompt $" { fail "help show paths" }
-       timeout         { fail "(timeout) help show paths" }
-       }
-
-
+gdb_test "help show paths" "Current search path for finding object files..*\[\r\n\]+.cwd in the path means the current working directory..*\[\r\n\]+This path is equivalent to the .PATH shell variable.  It is a list of.*\[\r\n\]+directories, separated by colons.  These directories are searched to find.*\[\r\n\]+fully linked executable files and separately compiled object files as needed." "help show paths"
 # test help show print address
-send "help show print address\n"
-expect {
-       -re "Show printing of addresses..*$prompt $"\
-                       { pass "help show print address" }
-       -re "$prompt $" { fail "help show print address" }
-       timeout         { fail "(timeout) help show print address" }
-       }
-
-
+gdb_test "help show print address" "Show printing of addresses."  "help show print address"
 # test help show print array
-send "help show print array\n"
-expect {
-       -re "Show prettyprinting of arrays..*$prompt $"\
-                       { pass "help show print array" }
-       -re "$prompt $" { fail "help show print array" }
-       timeout         { fail "(timeout) help show print array" }
-       }
-
-
+gdb_test "help show print array" "Show prettyprinting of arrays."  "help show print array"
 # test help show print asm-demangle
-send "help show print asm-demangle\n"
-expect {
-       -re "Show demangling of C\[+\]+ names in disassembly listings..*$prompt $"\
-                       { pass "help show print asm-demangle" }
-       -re "$prompt $" { fail "help show print asm-demangle" }
-       timeout         { fail "(timeout) help show print asm-demangle" }
-       }
-
-
+gdb_test "help show print asm-demangle" "Show demangling of C\[+\]+ names in disassembly listings."  "help show print asm-demangle"
 # test help show print demangle
-send "help show print demangle\n"
-expect {
-       -re "Show demangling of encoded C\[+\]+ names when displaying symbols..*$prompt $"\
-                       { pass "help show print demangle" }
-       -re "$prompt $" { fail "help show print demangle" }
-       timeout         { fail "(timeout) help show print demangle" }
-       }
-
-
+gdb_test "help show print demangle" "Show demangling of encoded C\[+\]+ names when displaying symbols."  "help show print demangle"
 # test help show print elements
-send "help show print elements\n"
-expect {
-       -re "Show limit on string chars or array elements to print..*
-\"set print elements 0\" causes there to be no limit..*$prompt $"\
-                       { pass "help show print elements" }
-       -re "$prompt $" { fail "help show print elements" }
-       timeout         { fail "(timeout) help show print elements" }
-       }
-
-
+gdb_test "help show print elements" "Show limit on string chars or array elements to print..*\[\r\n\]+\"set print elements 0\" causes there to be no limit." "help show print elements"
 # test help show print object
-send "help show print object\n"
-expect {
-       -re "Show printing of object's derived type based on vtable info..*$prompt $"\
-                       { pass "help show print object" }
-       -re "$prompt $" { fail "help show print object" }
-       timeout         { fail "(timeout) help show print object" }
-       }
-
-
+gdb_test "help show print object" "Show printing of object's derived type based on vtable info."  "help show print object"
 # test help show print pretty
-send "help show print pretty\n"
-expect {
-       -re "Show prettyprinting of structures..*$prompt $"\
-                       { pass "help show print pretty" }
-       -re "$prompt $" { fail "help show print pretty" }
-       timeout         { fail "(timeout) help show print pretty" }
-       }
-
-
+gdb_test "help show print pretty" "Show prettyprinting of structures."  "help show print pretty"
 # test help show print sevenbit-strings
-send "help show print sevenbit-strings\n"
-expect {
-       -re "Show printing of 8-bit characters in strings as .nnn..*$prompt $"\
-                       { pass "help show print sevenbit-strings" }
-       -re "$prompt $" { fail "help show print sevenbit-strings" }
-       timeout         { fail "(timeout) help show print sevenbit-strings" }
-       }
-
-
+gdb_test "help show print sevenbit-strings" "Show printing of 8-bit characters in strings as .nnn."  "help show print sevenbit-strings"
 # test help show print union
-send "help show print union\n"
-expect {
-       -re "Show printing of unions interior to structures..*$prompt $"\
-                       { pass "help show print union" }
-       -re "$prompt $" { fail "help show print union" }
-       timeout         { fail "(timeout) help show print union" }
-       }
-
-
+gdb_test "help show print union" "Show printing of unions interior to structures."  "help show print union"
 # test help show print vtbl
-send "help show print vtbl\n"
-expect {
-       -re "Show printing of C\[+\]+ virtual function tables..*$prompt $"\
-                       { pass "help show print vtbl" }
-       -re "$prompt $" { fail "help show print vtbl" }
-       timeout         { fail "(timeout) help show print vtbl" }
-       }
-
-
+gdb_test "help show print vtbl" "Show printing of C\[+\]+ virtual function tables."  "help show print vtbl"
 # test help show prompt
-send "help show prompt\n"
-expect {
-       -re "Show gdb's prompt.*$prompt $"\
-                       { pass "help show prompt" }
-       -re "$prompt $" { fail "help show prompt" }
-       timeout         { fail "(timeout) help show prompt" }
-       }
-
-
+gdb_test "help show prompt" "Show gdb's prompt"  "help show prompt"
 # test help show radix
-send "help show radix\n"
-expect {
-       -re "Show the default input and output number radices.*
-Use \'show input-radix\' or \'show output-radix\' to independently show each.*
-$prompt $"\
-                       { pass "help show radix" }
-       -re "Show default input and output number radix..*$prompt $"\
-                       { fail "help show radix (obsolete radix support)" }
-       -re "$prompt $" { fail "help show radix" }
-       timeout         { fail "(timeout) help show radix" }
-       }
-
-
+gdb_test "help show radix" "Show the default input and output number radices.*\[\r\n\]+Use \'show input-radix\' or \'show output-radix\' to independently show each.*\[\r\n\]+" "help show radix"
 # test help show symbol-reloading
-send "help show symbol-reloading\n"
-expect {
-       -re "Show dynamic symbol table reloading multiple times in one run..*$prompt $"\
-                       { pass "help show symbol-reloading" }
-       -re "$prompt $" { fail "help show symbol-reloading" }
-       timeout         { fail "(timeout) help show symbol-reloading" }
-       }
-
-
+gdb_test "help show symbol-reloading" "Show dynamic symbol table reloading multiple times in one run." "help show symbol-reloading"
 # test help show user
-send "help show user\n"
-expect {
-       -re "Show definitions of user defined commands..*
-Argument is the name of the user defined command..*
-With no argument, show definitions of all user defined commands..*$prompt $"\
-                       { pass "help show user" }
-       -re "$prompt $" { fail "help show user" }
-       timeout         { fail "(timeout) help show user" }
-       }
-
-
+gdb_test "help show user" "Show definitions of user defined commands..*\[\r\n\]+Argument is the name of the user defined command..*\[\r\n\]+With no argument, show definitions of all user defined commands." "help show user"
 # test help show values
-send "help show values\n"
-expect {
-       -re "Elements of value history around item number IDX .or last ten...*$prompt $"\
-                       { pass "help show values" }
-       -re "$prompt $" { fail "help show values" }
-       timeout         { fail "(timeout) help show values" }
-       }
-
-
+gdb_test "help show values" "Elements of value history around item number IDX .or last ten.."  "help show values"
 # test help show verbose
-send "help show verbose\n"
-expect {
-       -re "Show verbosity..*$prompt $"\
-                       { pass "help show verbose" }
-       -re "Show verbose printing of informational messages..*$prompt $"\
-                       { pass "help show verbose. FIXME" }
-       -re "$prompt $" { fail "help show verbose" }
-       timeout         { fail "(timeout) help show verbose" }
-       }
-
-
+gdb_test "help show verbose" "Show verbosity..*"  "help show verbose"
 # test help show version
-send "help show version\n"
-expect {
-       -re "Show what version of GDB this is..*$prompt $"\
-                       { pass "help show version" }
-       -re "$prompt $" { fail "help show version" }
-       timeout         { fail "(timeout) help show version" }
-       }
-
-
+gdb_test "help show version" "Show what version of GDB this is."  "help show version"
 # test help show width
-send "help show width\n"
-expect {
-       -re "Show number of characters gdb thinks are in a line..*$prompt $"\
-                       { pass "help show width" }
-       -re "$prompt $" { fail "help show width" }
-       timeout         { fail "(timeout) help show width" }
-       }
-
-
+gdb_test "help show width" "Show number of characters gdb thinks are in a line."  "help show width"
 # test help show write
 # This is only supported on targets which use exec.o.
-if ![istarget "rs6000-*-*"] then {
-    send "help show write\n"
-    expect {
-       -re "Show writing into executable and core files..*$prompt $"\
-                       { pass "help show write" }
-       -re "$prompt $" { fail "help show write" }
-       timeout         { fail "(timeout) help show write" }
-       }
-}
-
+gdb_test "help show write" "Show writing into executable and core files."  "help show write"
 # test help show
-send "help show\n"
-expect {
-       -re "Generic command for showing things about the debugger..*
-List of show subcommands:.*
-show listsize -- Show number of source lines gdb will list by default.*
-show directories -- Current search path for finding source files.*
-Type \"help show\" followed by show subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help show" }
-       -re "$prompt $" { fail "help show" }
-       timeout         { fail "(timeout) help show" }
-       }
-
-
-
+# If the system is slow, it may time out because the output is large.
+gdb_test "help show" "Generic command for showing things about the debugger..*\[\r\n\]+List of show subcommands:.*\[\r\n\]+show listsize -- Show number of source lines gdb will list by default.*\[\r\n\]+show directories -- Current search path for finding source files.*\[\r\n\]+Type \"help show\" followed by show subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help show"
 # test help step
-send "help step\n"
-expect {
-       -re "Step program until it reaches a different source line..*
-Argument N means do this N times .or till program stops for another reason...*$prompt $"\
-                       { pass "help step" }
-       -re "$prompt $" { fail "help step" }
-       timeout         { fail "(timeout) help step" }
-       }
-
+gdb_test "help step" "Step program until it reaches a different source line..*\[\r\n\]+Argument N means do this N times .or till program stops for another reason.." "help step"
 # test help stepi "si" abbreviation
-send "help si\n"
-expect {
-       -re "Step one instruction exactly..*
-Argument N means do this N times .or till program stops for another reason...*$prompt $"\
-                       { pass "help stepi \"si\" abbreviation" }
-       -re "$prompt $" { fail "help stepi \"si\" abbreviation" }
-       timeout         { fail "(timeout) help stepi \"si\" abbreviation" }
-       }
-
-
+gdb_test "help si" "Step one instruction exactly..*\[\r\n\]+Argument N means do this N times .or till program stops for another reason.." "help stepi \"si\" abbreviation"
 # test help stepi
-send "help stepi\n"
-expect {
-       -re "Step one instruction exactly..*
-Argument N means do this N times .or till program stops for another reason...*$prompt $"\
-                       { pass "help stepi" }
-       -re "$prompt $" { fail "help stepi" }
-       timeout         { fail "(timeout) help stepi" }
-       }
-
-
+gdb_test "help stepi" "Step one instruction exactly..*\[\r\n\]+Argument N means do this N times .or till program stops for another reason.." "help stepi"
 # test help signal
-send "help signal\n"
-expect {
-       -re "Continue program giving it signal.*$prompt $"\
-                       { pass "help signal" }
-       -re "$prompt $" { fail "help signal" }
-       timeout         { fail "(timeout) help signal" }
-       }
-
-
+gdb_test "help signal" "Continue program giving it signal.*"  "help signal"
 # test help source
 # vxgdb reads .vxgdbinit
-send "help source\n"
-expect {
-       -re "Read commands from a file named FILE..*
-Note that the file \".(vx)?gdbinit\" is read automatically in this way.*
-when gdb is started..*$prompt $"\
-                       { pass "help source" }
-       -re "$prompt $" { fail "help source" }
-       timeout         { fail "(timeout) help source" }
-       }
-
-
+gdb_test "help source" "Read commands from a file named FILE..*\[\r\n\]+Note that the file \"\[^\"\]*\" is read automatically in this way.*\[\r\n\]+when gdb is started." "help source"
 # test help stack
-send "help stack\n"
-expect {
-       -re "Examining the stack..*
-The stack is made up of stack frames.  Gdb assigns numbers to stack frames.*
-counting from zero for the innermost .currently executing. frame..*
-At any time gdb identifies one frame as the \"selected\" frame..*
-Variable lookups are done with respect to the selected frame..*
-When the program being debugged stops, gdb selects the innermost frame..*
-The commands below can be used to select other frames by number or address..*
-List of commands:.*
-bt -- Print backtrace of all stack frames.*
-backtrace -- Print backtrace of all stack frames.*
-select-frame -- Select a stack frame without printing anything.*
-frame -- Select and print a stack frame.*
-down -- Select and print stack frame called by this one.*
-up -- Select and print stack frame that called this one.*
-return -- Make selected stack frame return to its caller.*
-Type \"help\" followed by command name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help stack" }
-       -re "$prompt $" { fail "help stack" }
-       timeout         { fail "(timeout) help stack" }
-       }
-
-
+gdb_test "help stack" "Examining the stack..*\[\r\n\]+The stack is made up of stack frames.  Gdb assigns numbers to stack frames.*\[\r\n\]+counting from zero for the innermost .currently executing. frame..*\[\r\n\]+At any time gdb identifies one frame as the \"selected\" frame..*\[\r\n\]+Variable lookups are done with respect to the selected frame..*\[\r\n\]+When the program being debugged stops, gdb selects the innermost frame..*\[\r\n\]+The commands below can be used to select other frames by number or address..*\[\r\n\]+List of commands:.*\[\r\n\]+bt -- Print backtrace of all stack frames.*\[\r\n\]+backtrace -- Print backtrace of all stack frames.*\[\r\n\]+select-frame -- Select a stack frame without printing anything.*\[\r\n\]+frame -- Select and print a stack frame.*\[\r\n\]+down -- Select and print stack frame called by this one.*\[\r\n\]+up -- Select and print stack frame that called this one.*\[\r\n\]+return -- Make selected stack frame return to its caller.*\[\r\n\]+Type \"help\" followed by command name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help stack"
 # test help status
-send "help status\n"
-expect {
-       -re "Status inquiries..*
-List of commands:.*
-show -- Generic command for showing things about the debugger.*
-info -- Generic command for showing things about the program being debugged.*
-Type \"help\" followed by command name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help status" }
-       -re "$prompt $" { fail "help status" }
-       timeout         { fail "(timeout) help status" }
-       }
-
-
+gdb_test "help status" "Status inquiries..*\[\r\n\]+List of commands:.*\[\r\n\]+show -- Generic command for showing things about the debugger.*\[\r\n\]+info -- Generic command for showing things about the program being debugged.*\[\r\n\]+Type \"help\" followed by command name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help status"
 # test help support
 # FIXME -- Ultrix hangs randomly on this very long output from gdb and
 # continues with its output only if something is sent to gdb.
-# This behaviour throws expect and gdb out of sync, so we better skip this 
 # test.
 # Also, if the system is slow, it may time out because the output is large.
-# Just skip the test rather than bothering with increasing the timeout.
-if 0 then {
-send "help support\n"
-expect {
-       -re "Support facilities..*
-List of commands:.*
-show confirm -- Show whether to confirm potentially dangerous operations.*
-show history -- Generic command for showing command history parameters.*
-down-silently -- Same as the `down' command.*
-up-silently -- Same as the `up' command.*
-Type \"help\" followed by command name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help support" }
-       -re "$prompt $" { fail "help support" }
-       timeout         { fail "(timeout) help support" }
-       }
-}
-
+gdb_test "help support" "Support facilities..*\[\r\n\]+List of commands:.*\[\r\n\]+show confirm -- Show whether to confirm potentially dangerous operations.*\[\r\n\]+show history -- Generic command for showing command history parameters.*\[\r\n\]+down-silently -- Same as the `down' command.*\[\r\n\]+up-silently -- Same as the `up' command.*\[\r\n\]+Type \"help\" followed by command name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help support"
 # test help symbol-file
-send "help symbol-file\n"
-expect {
-       -re "Load symbol table from executable file FILE..*
-The `file' command can also load symbol tables, as well as setting the file.*
-to execute..*$prompt $"\
-                       { pass "help symbol-file" }
-       -re "$prompt $" { fail "help symbol-file" }
-       timeout         { fail "(timeout) help symbol-file" }
-       }
-
-
+gdb_test "help symbol-file" "Load symbol table from executable file FILE..*\[\r\n\]+The `file' command can also load symbol tables, as well as setting the file.*\[\r\n\]+to execute." "help symbol-file"
 # test help target child
-send "help target child\n"
-expect {
-       -re "Unix child process .started by the \"run\" command...*$prompt $"\
-           { pass "help target child (non-procfs version)" }
-       -re "Undefined target command: \"child\".  Try \"help target\"..*$prompt $"\
-           { pass "help target child (procfs version)" }
-       -re "$prompt $" { fail "help target child" }
-       timeout         { fail "(timeout) help target child" }
-       }
-
-
+gdb_test "help target child" "Unix child process .started by the \"run\" command..*|Undefined target command: \"child\".  Try \"help target\"." "help target child"
 # test help target procfs
-send "help target procfs\n"
-expect {
-       -re "Unix /proc child process .started by the \"run\" command...*$prompt $"\
-           { pass "help target procfs (procfs version)" }
-       -re "Undefined target command: \"procfs\".  Try \"help target\"..*$prompt $"\
-           { pass "help target procfs (non-procfs version)" }
-       -re "$prompt $" { fail "help target procfs" }
-       timeout         { fail "(timeout) help target procfs" }
-       }
-
-
+gdb_test "help target procfs" "Unix /proc child process .started by the \"run\" command.*|Undefined target command: \"procfs\".  Try \"help target\"." "help target procfs (procfs version)"
 # test help target core
-send "help target core\n"
-expect {
-       -re "Use a core file as a target.  Specify the filename of the core file..*$prompt $"\
-                       { pass "help target core" }
-       -re "Undefined target command: \"core\".  Try \"help target\"..*$prompt $"\
-                       { pass "help target core" }
-       -re "$prompt $" { fail "help target core" }
-       timeout         { fail "(timeout) help target core" }
-       }
-
-
+gdb_test "help target core" ".*Use a core file as a target.*Specify the filename of the core file.*|(Undefined target command: \"core\".  Try \"help target\".)" "help target core"
 # test help target exec
-send "help target exec\n"
-expect {
-       -re "Use an executable file as a target..*
-Specify the filename of the executable file..*$prompt $"\
-                       { pass "help target exec" }
-       -re "$prompt $" { fail "help target exec" }
-       timeout         { fail "(timeout) help target exec" }
-       }
-
-
+gdb_test "help target exec" "Use an executable file as a target..*\[\r\n\]+Specify the filename of the executable file." "help target exec"
 # test help target remote
-if ![istarget "*-*-udi*"] then {
-    send "help target remote\n"
-    expect {
-       -re "Use a remote computer via a serial line, using a gdb-specific protocol..*
-Specify the serial device it is connected to .e.g. /dev/ttya...*$prompt $"\
-                       { pass "help target remote" }
-       -re "$prompt $" { fail "help target remote" }
-       timeout         { fail "(timeout) help target remote" }
-    }
-}
-
+gdb_test "help target remote" "Use a remote computer via a serial line, using a gdb-specific protocol..*\[\r\n\]+Specify the serial device it is connected to .e.g. /dev/ttya..*" "help target remote"
 # test help target
 # the child process target may be "target child" or "target procfs"
-send "help target\n"
-expect {
-       -re "Connect to a target machine or process..*
-The first argument is the type or protocol of the target machine..*
-Remaining arguments are interpreted by the target protocol.  For more.*
-information on the arguments for a particular protocol, type.*
-`help target ' followed by the protocol name..*
-List of target subcommands:.*
-target exec -- Use an executable file as a target.*
-Type \"help target\" followed by target subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help target" }
-       -re "$prompt $" { fail "help target" }
-       timeout         { fail "(timeout) help target" }
-       }
-
-
+gdb_test "help target" "Connect to a target machine or process..*\[\r\n\]+The first argument is the type or protocol of the target machine..*\[\r\n\]+Remaining arguments are interpreted by the target protocol.  For more.*\[\r\n\]+information on the arguments for a particular protocol, type.*\[\r\n\]+`help target ' followed by the protocol name..*\[\r\n\]+List of target subcommands:.*\[\r\n\]+target exec -- Use an executable file as a target.*\[\r\n\]+Type \"help target\" followed by target subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help target"
 # test help tbreak
-send "help tbreak\n"
-expect {
-       -re "Set a temporary breakpoint.*$prompt $"\
-                       { pass "help tbreak" }
-       -re "$prompt $" { fail "help tbreak" }
-       timeout         { fail "(timeout) help tbreak" }
-       }
-
-
+gdb_test "help tbreak" "Set a temporary breakpoint.*"  "help tbreak"
 # test help tty
-send "help tty\n"
-expect {
-       -re "Set terminal for future runs of program being debugged..*$prompt $"\
-                       { pass "help tty" }
-       -re "$prompt $" { fail "help tty" }
-       timeout         { fail "(timeout) help tty" }
-       }
-
-
+gdb_test "help tty" "Set terminal for future runs of program being debugged."  "help tty"
 # test help until "u" abbreviation
-send "help u\n"
-expect {
-       -re "Execute until the program reaches a source line greater than the current.*
-or a specified line or address or function .same args as break command...*
-Execution will also stop upon exit from the current stack frame..*$prompt $"\
-                       { pass "help until \"u\" abbreviation" }
-       -re "$prompt $" { fail "help until \"u\" abbreviation" }
-       timeout         { fail "(timeout) help until \"u\" abbreviation" }
-       }
-
-
+gdb_test "help u" "Execute until the program reaches a source line greater than the current.*\[\r\n\]+or a specified line or address or function .same args as break command...*\[\r\n\]+Execution will also stop upon exit from the current stack frame." "help until \"u\" abbreviation"
 # test help until
-send "help until\n"
-expect {
-       -re "Execute until the program reaches a source line greater than the current.*
-or a specified line or address or function .same args as break command...*
-Execution will also stop upon exit from the current stack frame..*$prompt $"\
-                       { pass "help until" }
-       -re "$prompt $" { fail "help until" }
-       timeout         { fail "(timeout) help until" }
-       }
-
-
+gdb_test "help until" "Execute until the program reaches a source line greater than the current.*\[\r\n\]+or a specified line or address or function .same args as break command...*\[\r\n\]+Execution will also stop upon exit from the current stack frame." "help until"
 # test help undisplay
-send "help undisplay\n"
-expect {
-       -re "Cancel some expressions to be displayed when program stops..*
-Arguments are the code numbers of the expressions to stop displaying..*
-No argument means cancel all automatic-display expressions..*
-\"delete display\" has the same effect as this command..*
-Do \"info display\" to see current list of code numbers..*$prompt $"\
-                       { pass "help undisplay" }
-       -re "$prompt $" { fail "help undisplay" }
-       timeout         { fail "(timeout) help undisplay" }
-       }
-
-
+gdb_test "help undisplay" "Cancel some expressions to be displayed when program stops..*\[\r\n\]+Arguments are the code numbers of the expressions to stop displaying..*\[\r\n\]+No argument means cancel all automatic-display expressions..*\[\r\n\]+\"delete display\" has the same effect as this command..*\[\r\n\]+Do \"info display\" to see current list of code numbers." "help undisplay"
 # test help unset environment
-send "help unset environment\n"
-expect {
-       -re "Cancel environment variable VAR for the program..*
-This does not affect the program until the next \"run\" command..*$prompt $"\
-                       { pass "help unset environment" }
-       -re "$prompt $" { fail "help unset environment" }
-       timeout         { fail "(timeout) help unset environment" }
-       }
-
-
+gdb_test "help unset environment" "Cancel environment variable VAR for the program..*\[\r\n\]+This does not affect the program until the next \"run\" command." "help unset environment"
 # test help unset
-send "help unset\n"
-expect {
-       -re "Complement to certain \"set\" commands.*
-List of unset subcommands:.*
-unset environment -- Cancel environment variable VAR for the program.*
-Type \"help unset\" followed by unset subcommand name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help unset" }
-       -re "$prompt $" { fail "help unset" }
-       timeout         { fail "(timeout) help unset" }
-       }
-
-
+gdb_test "help unset" "Complement to certain \"set\" commands.*\[\r\n\]+List of unset subcommands:.*\[\r\n\]+unset environment -- Cancel environment variable VAR for the program.*\[\r\n\]+Type \"help unset\" followed by unset subcommand name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help unset"
 # test help up
-send "help up\n"
-expect {
-       -re "Select and print stack frame that called this one..*
-An argument says how many frames up to go..*$prompt $"\
-                       { pass "help up" }
-       -re "$prompt $" { fail "help up" }
-       timeout         { fail "(timeout) help up" }
-       }
-
-
+gdb_test "help up" "Select and print stack frame that called this one..*\[\r\n\]+An argument says how many frames up to go." "help up"
 # test help up-silently
-send "help up-silently\n"
-expect {
-       -re "Same as the `up' command, but does not print anything..*
-This is useful in command scripts..*$prompt $"\
-                       { pass "help up-silently" }
-       -re "$prompt $" { fail "help up-silently" }
-       timeout         { fail "(timeout) help up-silently" }
-       }
-
-
+gdb_test "help up-silently" "Same as the `up' command, but does not print anything..*\[\r\n\]+This is useful in command scripts." "help up-silently"
 # test help user-defined
-send "help user-defined\n"
-expect {
-       -re "User-defined commands..*
-The commands in this class are those defined by the user..*
-Use the \"define\" command to define a command..*
-List of commands:.*
-Type \"help\" followed by command name for full documentation..*
-Command name abbreviations are allowed if unambiguous..*$prompt $"\
-                       { pass "help user-defined" }
-       -re "$prompt $" { fail "help user-defined" }
-       timeout         { fail "(timeout) help user-defined" }
-       }
-
-
+gdb_test "help user-defined" "User-defined commands..*\[\r\n\]+The commands in this class are those defined by the user..*\[\r\n\]+Use the \"define\" command to define a command..*\[\r\n\]+List of commands:.*\[\r\n\]+Type \"help\" followed by command name for full documentation..*\[\r\n\]+Command name abbreviations are allowed if unambiguous." "help user-defined"
 # test help watch
-send "help watch\n"
-expect {
-       -re "Set a watchpoint for an expression..*
-A watchpoint stops execution of your program whenever the value of.*
-an expression changes..*$prompt $"\
-                       { pass "help watch" }
-       -re "$prompt $" { fail "help watch" }
-       timeout         { fail "(timeout) help watch" }
-       }
-
-
+gdb_test "help watch" "Set a watchpoint for an expression..*\[\r\n\]+A watchpoint stops execution of your program whenever the value of.*\[\r\n\]+an expression changes." "help watch"
 # test help whatis
-send "help whatis\n"
-expect {
-       -re "Print data type of expression EXP..*$prompt $"\
-                       { pass "help whatis" }
-       -re "$prompt $" { fail "help whatis" }
-       timeout         { fail "(timeout) help whatis" }
-       }
-
-
+gdb_test "help whatis" "Print data type of expression EXP."  "help whatis"
 # test help where
-send "help where\n"
-expect {
-       -re "Print backtrace of all stack frames, or innermost COUNT frames..*
-With a negative argument, print outermost -COUNT frames..*$prompt $"\
-                       { pass "help where" }
-       -re "$prompt $" { fail "help where" }
-       timeout         { fail "(timeout) help where" }
-       }
-
-
+gdb_test "help where" "Print backtrace of all stack frames, or innermost COUNT frames..*\[\r\n\]+With a negative argument, print outermost -COUNT frames." "help where"
 # test help x
-send "help x\n"
-expect {
-       -re "Examine memory: x/FMT ADDRESS..*
-ADDRESS is an expression for the memory address to examine..*
-FMT is a repeat count followed by a format letter and a size letter..*
-Defaults for format and size letters are those previously used..*
-Default count is 1.  Default address is following last thing printed.*
-with this command or \"print\"..*$prompt $"\
-                       { pass "help x" }
-       -re "$prompt $" { fail "help x" }
-       timeout         { fail "(timeout) help x" }
-       }
-
-
+gdb_test "help x" "Examine memory: x/FMT ADDRESS..*\[\r\n\]+ADDRESS is an expression for the memory address to examine..*\[\r\n\]+FMT is a repeat count followed by a format letter and a size letter..*\[\r\n\]+Defaults for format and size letters are those previously used..*\[\r\n\]+Default count is 1.  Default address is following last thing printed.*\[\r\n\]+with this command or \"print\"." "help x"
 # test help info bogus-gdb-command
-send "help info bogus-gdb-command\n"
-expect {
-       -re "Undefined info command: \"bogus-gdb-command\".  Try \"help info\"..*$prompt $"\
-                       { pass "help info bogus-gdb-command" }
-       -re "$prompt $" { fail "help info bogus-gdb-command" }
-       timeout         { fail "(timeout) help info bogus-gdb-command" }
-       }
-
-
+gdb_test "help info bogus-gdb-command" "Undefined info command: \"bogus-gdb-command\".  Try \"help info\"."  "help info bogus-gdb-command"
 # test help gotcha
-send "help gotcha\n"
-expect {
-       -re "Undefined command: \"gotcha\".  Try \"help\"..*$prompt $"\
-                       { pass "help gotcha" }
-       -re "$prompt $" { fail "help gotcha" }
-       timeout         { fail "(timeout) help gotcha" }
-       }
-
+gdb_test "help gotcha" "Undefined command: \"gotcha\".  Try \"help\"."  "help gotcha"
index b3895f026c6b9802e883bb79c4404d52f579a672..aa9cc2e85e2e476af54574ac12e6b289a93b043e 100644 (file)
@@ -17,8 +17,8 @@
 # Please email any bugs, comments, and/or additions to this file to:
 # bug-gdb@prep.ai.mit.edu
 
-if [info exists nointerrupts] {
-    if $nointerrupts {
+if [host_info exists name] {
+    if [board_info host exists gdb,nointerrupts] {
        verbose "Skipping interrupt.exp because of nointerrupts."
        continue
     }
@@ -32,18 +32,20 @@ set prms_id 0
 set bug_id 0
 
 set testfile interrupt
-set srcfile ${srcdir}/$subdir/${testfile}.c
+set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
-if  { [compile "${srcfile} -g -o ${binfile}"] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     perror "Couldn't compile ${srcfile}"
     return -1
 }
 
-if $noinferiorio {
+if [target_info exists gdb,noinferiorio] {
     verbose "Skipping interrupt.exp because of noinferiorio."
     return
 }
-    
+
+gdb_start
+
 
 if ![file exists $binfile] then {
     perror "$binfile does not exist."
@@ -51,12 +53,15 @@ if ![file exists $binfile] then {
 } else {
     gdb_reinitialize_dir $srcdir/$subdir
     gdb_load $binfile
+    # Hope this is unix :-)
     gdb_test "shell stty intr '^C'" "" \
        "set interrupt character in interrupt.exp"
     if [runto_main] then {
-       send "continue\n"
+       send_gdb "continue\n"
        expect {
-           -re "\r\ntalk to me baby\r\n$" {}
+           -re "\r\ntalk to me baby\r\n$" {
+               pass "child process is alive"
+           }
            timeout { fail "run (timeout)" }
            eof { fail "run (eof)" }
        }
@@ -64,29 +69,35 @@ if ![file exists $binfile] then {
        # program's output.  Under dejagnu (but not interactively) for
        # SunOS4, it only appears once.  Don't worry about it, I imagine
        # dejagnu has just done something to the tty modes.
-       send "a\n"
+       send_gdb "a\n"
        expect {
-           -re "^a\r\n(|a\r\n)$" {}
+           -re "^a\r\n(|a\r\n)$" {
+               pass "child process ate our char"
+           }
            timeout { fail "echo a (timeout)" }
            eof { fail "echo a (eof)" }
        }
        # Wait until the program is in the read system call again.
-       exec sleep 2
+       sleep 2
 
-       send "\003"
+       send_gdb "\003"
        expect {
            -re "Program received signal SIGINT.*$prompt $" {
-               pass "send control C"
+               pass "send_gdb control C"
            }
-           -re ".*$prompt $" { fail "send control C" }
-           timeout { fail "send control C (timeout)" }
-           eof { fail "send control C (eof)" }
+           -re ".*$prompt $" { fail "send_gdb control C" }
+           timeout { fail "send_gdb control C (timeout)" }
+           eof { fail "send_gdb control C (eof)" }
        }
 
-       setup_xfail "i*86-*-linux*"
-       send "p func1 ()\n"
+       send_gdb "p func1 ()\n"
        expect {
            -re " = 4.*$prompt $" { pass "call function when asleep" }
+           -re ".*Program received signal SIGSEGV.*$prompt $" {
+               setup_xfail "i*86-pc-linux*-gnu"
+               fail "child died when we called func1, skipped rest of tests"
+               return
+           }
            -re "$prompt $" { fail "call function when asleep (wrong output)" }
            default {
 
@@ -94,7 +105,7 @@ if ![file exists $binfile] then {
                # don't use PRSABORT), but apparently also happens on
                # other machines as well.
 
-               setup_xfail "sparc-*-solaris2*"
+               setup_xfail "sparc*-*-solaris2*"
                setup_xfail "mips-*-ultrix*"
                setup_xfail "hppa*-*-*"
                setup_xfail "i386*-*-bsd*"
@@ -105,8 +116,8 @@ if ![file exists $binfile] then {
                setup_xfail "*-*-hpux*"
                setup_xfail "*-*-*lynx*"
                fail "call function when asleep (stays asleep)"
-               # Send a newline to wake it up
-               send "\n"
+               # Send_Gdb a newline to wake it up
+               send_gdb "\n"
                gdb_test "" " = 4" "call function after waking it"
            }
 #          eof { fail "call function when asleep (eof)" }
@@ -120,18 +131,18 @@ if ![file exists $binfile] then {
        # to wake the program, in which case the program now sends it
        # back.  We check for it either here or in the next expect
        # command, because which one it ends up in is timing dependent.
-       send "continue\n"
+       send_gdb "continue\n"
        # For some reason, i386-*-sysv4 gdb fails to issue the Continuing
        # message, but otherwise appears normal (FIXME).
        expect {
            -re "^continue\r\nContinuing.\r\n(\r\n|)$" { pass "continue" }
            -re "^continue\r\n\r\n" { fail "continue (missing Continuing.)" }
            -re "$prompt $" { fail "continue" }
-           timeout { fail "continue" }
-           eof { fail "continue" }
+           timeout { fail "continue (timeout)" }
+           eof { fail "continue (eof)" }
        }
 
-       send "data\n"
+       send_gdb "data\n"
        # The optional leading \r\n is in case we sent a newline above
        # to wake the program, in which case the program now sends it
        # back.
@@ -141,11 +152,11 @@ if ![file exists $binfile] then {
            eof { fail "echo data (eof)" }
        }
 
-       setup_xfail "i*86-*-linux*"
-       send "\004"
+       setup_xfail "i*86-pc-linux*-gnu"
+       send_gdb "\004"
        expect {
            -re "end of file.*Program exited normally.*$prompt $" {
-               pass "send end of file"
+               pass "send_gdb end of file"
            }
            -re "$prompt $" { fail "send end of file" }
            timeout { fail "send end of file (timeout)" }
index 8671e38f972270fd011c939207ab8dfe5762e0a7..c9340f4384d63b5941a05e750c6512918f9e76f2 100644 (file)
@@ -7,27 +7,21 @@ set bug_id 0
 
 set testfile langs
 set binfile ${objdir}/${subdir}/${testfile}
-if  { [compile "${srcdir}/${subdir}/langs0.c -g -c -o ${binfile}0.o "] != "" } {
-    perror "Couldn't compile langs0.c to object"
-    return -1
-}
-if  { [compile "${srcdir}/${subdir}/langs1.c -g -c -o ${binfile}1.o "] != "" } {
-    perror "Couldn't compile langs1.c to object"
-    return -1
-}
-if  { [compile "${srcdir}/${subdir}/langs2.c -g -c -o ${binfile}2.o "] != "" } {
-    perror "Couldn't compile langs2.c to object"
-    return -1
+
+if [is_remote host] {
+    remote_download host ${srcdir}/${subdir}/langs1.f
+    remote_download host ${srcdir}/${subdir}/langs2.cxx
 }
-if  { [compile "${binfile}0.o ${binfile}1.o ${binfile}2.o  -o ${binfile}"] != "" } {
+
+if  { [gdb_compile "${srcdir}/${subdir}/langs0.c ${srcdir}/${subdir}/langs1.c ${srcdir}/${subdir}/langs2.c" "${binfile}" executable {debug}] != "" } {
     perror "Couldn't link langs."
     return -1
 }
 
-execute_anywhere "rm -f ${binfile}.ci"
-if  { [compile "-E ${srcdir}/${subdir}/compiler.c > ${binfile}.ci"] != "" } {
-    perror "Couldn't make ${testfile}.ci file"
-    return -1
+# Create and source the file that provides information about the compiler
+# used to compile the test case.
+if [get_compiler_info ${binfile}] {
+    return -1;
 }
 
 gdb_exit
@@ -35,8 +29,6 @@ gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load $binfile
 
-source ${binfile}.ci
-
 gdb_test "b langs0" {Function "langs0" not defined\.} \
     "break on nonexistent function in langs.exp"
 
@@ -85,8 +77,12 @@ if [runto csub] then {
 
     if $noresults==1 then { return }
 
-    gdb_test "cont" "Program exited normally\\." \
-       "continue to exit in langs.exp"
+    if [target_info exists use_gdb_stub] {
+       gdb_test "cont" "Breakpoint .*exit.*" "continue to exit in langs.exp"
+    } else {
+       gdb_test "cont" "Program exited normally\\." \
+               "continue to exit in langs.exp"
+    }
 }
 
 return 0
index 8177c6242cc0c539cacff4c5113349a65c15f808..e0cf2c2f99c57841125fdcb7ed2dfe1502713b27 100644 (file)
@@ -28,29 +28,20 @@ set bug_id 0
 
 set testfile "list"
 set binfile ${objdir}/${subdir}/${testfile}
-if  { [compile "-g -c ${srcdir}/${subdir}/list0.c"] != "" } {
-    perror "Couldn't compile ${testfile}0.c to object"
-    return -1
-}
-execute_anywhere "mv list0.o ${binfile}0.o"
-if  { [compile "-g -c ${srcdir}/${subdir}/list1.c"] != "" } {
-    perror "Couldn't compile ${testfile}1.c to object"
-    return -1
-}
-execute_anywhere "mv list1.o ${binfile}1.o"
-if  { [compile "${binfile}0.o ${binfile}1.o -o ${binfile}"] != "" } {
-    perror "Couldn't link ${testfile}."
+
+# Need to download the header to the host.
+remote_download host ${srcdir}/${subdir}/list0.h list0.h
+
+if { [gdb_compile "${srcdir}/${subdir}/list0.c ${srcdir}/${subdir}/list1.c" ${binfile} executable {debug}] != "" } {
+    perror "Couldn't compile list0.c list1.c to executable ${binfile}"
     return -1
 }
 
 # Create and source the file that provides information about the compiler
 # used to compile the test case.
-execute_anywhere "rm -f ${binfile}.ci"
-if  { [compile "-E ${srcdir}/${subdir}/compiler.c > ${binfile}.ci"] != "" } {
-    perror "Couldn't make ${binfile}.ci file"
-    return -1
+if [get_compiler_info ${binfile}] {
+    return -1;
 }
-source ${binfile}.ci
 
 #
 # Local utility proc just to set and verify listsize
@@ -60,18 +51,15 @@ source ${binfile}.ci
 proc set_listsize { arg } {
     global prompt
 
-    send "set listsize $arg\n"
-    expect {
-       -re "set listsize $arg\[\r\n\]+$prompt $" {}
-       -re ".*$prompt $" { fail "setting listsize to $arg" ; return 0 }
-       timeout { fail "set listsize to $arg (timeout)" ; return 0 } 
+    if [gdb_test "set listsize $arg" "" "setting listsize to $arg"] {
+       return 0;
     }
-    
-    send "show listsize\n"
-    expect {
-       -re "Number of source lines .* is $arg.\r\n.*$prompt $" {}
-       -re ".*$prompt $" { fail "listsize not set to $arg" ; return 0 }
-       timeout { fail "show listsize (timeout)" ; return 0 }
+    if { $arg <= 0 } {
+       set arg "unlimited";
+    }
+
+    if [gdb_test "show listsize" "Number of source lines.* is ${arg}.*" "show listsize $arg"] {
+       return 0;
     }
     return 1
 }
@@ -85,342 +73,72 @@ proc test_listsize {} {
 
     # Show default size
 
-    send "show listsize\n"
-    expect {
-       -re "Number of source lines gdb will list by default is 10.*$prompt $" {
-           pass "show default list size"
-       }
-       -re ".*$prompt $" {
-           fail "show default listsize (10)"
-       }
-       timeout {
-           fail "show listsize (timeout)"
-       }
-    }
+    gdb_test "show listsize" "Number of source lines gdb will list by default is 10.*" "show default list size"
     
     # Show the default lines
     # The second case is for optimized code, it is still correct.
     
     # This doesn't work for COFF targets.
     setup_xfail "a29k-*-udi"
-    send "list\n"
-    expect {
-       -re "1\[ \t\]+#include \"list0.h\".*10\[ \t\]+x = 0;\r\n$prompt $" {
-           pass "list default lines around main"
-       }
-       -re "2.*11\[ \t\]+foo .x\[+)\]+;\r\n$prompt $" {
-           pass "list default lines around main"
-       }
-       -re ".*$prompt $" {
-           fail "list default lines around main"
-       }
-       timeout {
-           fail "list default lines around main (timeout)"
-       }
-    }
+    gdb_test "list" "(1\[ \t\]+#include \"list0.h\".*10\[ \t\]+x = 0;|2.*11\[ \t\]+foo .x\[+)\]+;)" "list default lines around main"
     
     # Ensure we can limit printouts to one line
     
     if [ set_listsize 1 ] then {
        setup_xfail "*-*-*"
-       send "list 1\n"
-       expect {
-           -re "1\[ \t\]+#include \"list0.h\"\r\n$prompt $" {
-               pass "list line 1 with listsize 1"
-           }
-           -re "list 1\r\n$prompt $" {
-               fail "list line 1 with listsize 1"
-           }
-           -re ".*$prompt $" {
-               fail "list line 1 with listsize 1"
-           }
-           timeout {
-               fail "list line 1 with listsize 1 (timeout)"
-           }
-       }
-       
+       gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"" "list line 1 with listsize 1"
        setup_xfail "*-*-*"
-       send "list 2\n"
-       expect {
-           -re "2\[ \t\]+\r\n$prompt $" {
-               pass "list line 2 with listsize 1"
-           }
-           -re "list 2\r\n$prompt $" {
-               fail "list line 2 with listsize 1"
-           }
-           -re ".*$prompt $" {
-               fail "list line 2 with listsize 1"
-           }
-           timeout {
-               fail "list line 2 with listsize 1 (timeout)"
-           }
-       }
+       gdb_test "list 2" "2\[ \t\]+" "list line 2 with listsize 1"
     }    
 
     # Try just two lines
     
-    if [ set_listsize 2 ] then {
-       send "list 1\n"
-       expect {
-           -re "1\[ \t\]+#include \"list0.h\"\r\n$prompt $" {
-               pass "list line 1 with listsize 2"
-           }
-           -re ".*$prompt $" {
-               fail "list line 1 with listsize 2"
-           }
-           timeout {
-               fail "list line 1 with listsize 2 (timeout)"
-           }
-       }
-       
-       send "list 2\n"
-       expect {
-           -re "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+\r\n$prompt $" {
-               pass "list line 2 with listsize 2"
-           }
-           -re ".*$prompt $" {
-               fail "list line 2 with listsize 2"
-           }
-           timeout {
-               fail "list line 2 with listsize 2 (timeout)"
-           }
-       }
-       
-       send "list 3\n"
-       expect {
-           -re "2\[ \t\]+\r\n3\[ \t\]+main \[)(\]+\r\n$prompt $" {
-               pass "list line 3 with listsize 2"
-           }
-           -re ".*$prompt $" {
-               fail "list line 3 with listsize 2"
-           }
-           timeout {
-               fail "list line 3 with listsize 2 (timeout)"
-           }
-       }
-    }    
+    if [ set_listsize 2 ] {
+       gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"" "list line 1 with listsize 2"
+       gdb_test "list 2" "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+" "list line 2 with listsize 2"
+       gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+main \[)(\]+" "list line 3 with listsize 2"
+    }
 
     # Try small listsize > 1 that is an odd number
-    
-    if [ set_listsize 3 ] then {
+
+    if [ set_listsize 3 ] {
        setup_xfail "*-*-*"
-       send "list 1\n"
-       expect {
-           -re "1\[ \t\]+#include \"list0.h\"2\[ \t\]+\r\n$prompt $" {
-               pass "list line 1 with listsize 3"
-           }
-           -re "1\[ \t\]+#include \"list0.h\"\r\n$prompt $" {
-               fail "list line 1 with listsize 3"
-           }
-           -re ".*$prompt $" {
-               fail "list line 1 with listsize 3"
-           }
-           timeout {
-               fail "list line 1 with listsize 3 (timeout)"
-           }
-       }
-       
+       gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"2\[ \t\]+" "list line 1 with listsize 3"
        setup_xfail "*-*-*"
-       send "list 2\n"
-       expect {
-           -re "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+main \[)(\]+\r\n$prompt $" {
-               pass "list line 2 with listsize 3"
-           }
-           -re "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+\r\n$prompt $" {
-               fail "list line 2 with listsize 3"
-           }
-           -re ".*$prompt $" {
-               fail "list line 2 with listsize 3"
-           }
-           timeout {
-               fail "list line 2 with listsize 3 (timeout)"
-           }
-       }
+       gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+main \[)(\]+" "list line 2 with listsize 3"
        
        setup_xfail "*-*-*"
-       send "list 3\n"
-       expect {
-           -re "2\[ \t\]+\r\n3\[ \t\]+main \[(\]+\[)\]+\r\n4\[ \t\]+\{\r\n$prompt $" {
-               pass "list line 3 with listsize 3"
-           }
-           -re "2\[ \t\]+\r\n3\[ \t\]+main \[)(\]+\r\n$prompt $" {
-               fail "list line 3 with listsize 3"
-           }
-           -re ".*$prompt $" {
-               fail "list line 3 with listsize 3"
-           }
-           timeout {
-               fail "list line 3 with listsize 3 (timeout)"
-           }
-       }
+       gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+main \[(\]+\[)\]+\r\n4\[ \t\]+\{" "list line 3 with listsize 3"
     }
 
     # Try small listsize > 2 that is an even number.
 
     if [ set_listsize 4 ] then {
-       send "list 1\n"
-       expect {
-           -re "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+\r\n$prompt $" {
-               pass "list line 1 with listsize 4"
-           }
-           -re ".*$prompt $" {
-               fail "list line 1 with listsize 4"
-           }
-           timeout {
-               fail "list line 1 with listsize 4 (timeout)"
-           }
-       }
-       
-       send "list 2\n"
-       expect {
-           -re "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+main \[)(\]+\r\n$prompt $" {
-               pass "list line 2 with listsize 4"
-           }
-           -re ".*$prompt $" {
-               fail "list line 2 with listsize 4"
-           }
-           timeout {
-               fail "list line 2 with listsize 4 (timeout)"
-           }
-       }
+       gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+" "list line 1 with listsize 4"
+       gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+main \[)(\]+" "list line 2 with listsize 4"
        
-       send "list 3\n"
-       expect {
-           -re "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{\r\n$prompt $" {
-               pass "list line 3 with listsize 4"
-           }
-           -re ".*$prompt $" {
-               fail "list line 3 with listsize 4"
-           }
-           timeout {
-               fail "list line 3 with listsize 4 (timeout)"
-           }
-       }
-       
-       send "list 4\n"
-       expect {
-           -re "2\[ \t\]+\r\n.*5\[ \t\]+int x;\r\n$prompt $" {
-               pass "list line 4 with listsize 4"
-           }
-           -re ".*$prompt $" {
-               fail "list line 4 with listsize 4"
-           }
-           timeout {
-               fail "list line 4 with listsize 4 (timeout)"
-           }
-       }
+       gdb_test "list 3" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list line 3 with listsize 4"
+       gdb_test "list 4" "2\[ \t\]+\r\n.*5\[ \t\]+int x;.*" "list line 4 with listsize 4"
     }
 
     # Try a size larger than the entire file.
 
     if [ set_listsize 100 ] then {
-       send "list 1\n"
-       expect {
-           -re "1\[ \t\]+#include \"list0.h\".*\r\n42\[ \t\]+\}\r\n$prompt $" {
-               pass "list line 1 with listsize 100"
-           }
-           -re ".*$prompt $" {
-               fail "list line 1 with listsize 100"
-           }
-           timeout {
-               fail "list line 1 with listsize 100 (timeout)"
-           }
-       }
+       gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*\r\n42\[ \t\]+\}" "list line 1 with listsize 100"
        
-       send "list 10\n"
-       expect {
-           -re "1\[ \t\]+#include \"list0.h\".*\r\n42\[ \t\]+\}\r\n$prompt $" {
-               pass "list line 10 with listsize 100"
-           }
-           -re ".*$prompt $" {
-               fail "list line 10 with listsize 100"
-           }
-           timeout {
-               fail "list line 10 with listsize 100 (timeout)"
-           }
-       }
+       gdb_test "list 10" "1\[ \t\]+#include \"list0.h\".*\r\n42\[ \t\]+\}" "list line 10 with listsize 100"
     }
 
     # Try listsize of 0 which suppresses printing.
 
-    send "set listsize 0\n"
-    expect {
-       -re "set listsize 0\[\r\n\]+$prompt $" {
-           setup_xfail "*-*-*"
-           send "show listsize\n"
-           expect {
-               -re "Number of source lines .* is 0.\r\n.*$prompt $" {
-                   pass "listsize of 0 displays as 0"
-               }
-               -re "Number of source lines .* is unlimited.\r\n.*$prompt $" {
-                   fail "listsize of 0 displays as unlimited"
-               }
-               -re ".*$prompt $" {
-                   fail "listsize not set to unlimited (0)"
-               }
-               timeout {
-                   fail "show listsize (timeout)"
-               }
-           }
-           send "list 1\n"
-           expect {
-               -re "list 1\[\r\n\]+$prompt $" {
-                   pass "listsize of 0 suppresses output"
-               }
-               -re ".*$prompt $" {
-                   fail "listsize of 0 should suppress output"
-               }
-               timeout {
-                   fail "listsize of 0 suppresses output (timeout)"
-               }
-           }
-       }
-       -re ".*$prompt $" {
-           fail "setting listsize to 0"
-       }
-       timeout {
-           fail "set listsize to 0 (timeout)"
-       }
-    }
+    set_listsize 0
+    gdb_test "list 1" "" "listsize of 0 suppresses output"
 
     # Try listsize of -1 which is special, and means unlimited.
 
-    send "set listsize -1\n"
-    expect {
-       -re "set listsize -1\[\r\n\]+$prompt $" {
-           send "show listsize\n"
-           expect {
-               -re "Number of source lines .* is unlimited.\r\n.*$prompt $" {
-                   pass "listsize of -1 displays as unlimited"
-               }
-               -re ".*$prompt $" {
-                   fail "listsize not set to unlimited (-1)"
-               }
-               timeout {
-                   fail "show listsize (timeout)"
-               }
-           }
-           setup_xfail "*-*-*"
-           send "list 1\n"
-           expect {
-               -re "1\[ \t\]+#include .*\r\n39\[ \t\]+\}\r\n$prompt $" {
-                   pass "list line 1 with unlimited listsize"
-               }
-               -re "list 1\[\r\n\]+$prompt $" {
-                   fail "listsize of -1 (unlimited) suppresses output"
-               }
-               timeout {
-                   fail "list line 1 with unlimited listsize (timeout)"
-               }
-           }
-       }
-       -re ".*$prompt $" {
-           fail "setting listsize to -1"
-       }
-       timeout {
-           fail "set listsize to -1 (timeout)"
-       }
-    }
+    set_listsize -1
+    setup_xfail "*-*-*"
+    gdb_test "list 1" "1\[ \t\]+#include .*\r\n39\[ \t\]+\}" "list line 1 with unlimited listsize"
 }
 
 #
@@ -432,39 +150,11 @@ proc test_list_include_file {} {
 
     # FIXME Fails for COFF as well, I think.
     setup_xfail "a29k-*-udi"
-    send "list list0.h:1\n"
-    expect {
-       -re "1\[ \t\]+/\[*\]+ An include file .*5\[ \t\]+foo \[(\]+x\[)\]+\r\n$prompt $" {
-           pass "list line 1 in include file"
-       }
-       -re "No source file named list0.h.\r\n$prompt $" {
-           fail "list line 1 in include file"
-       }
-       -re ".*$prompt $" {
-           fail "list line 1 in include file"
-       }
-       timeout {
-           fail "list line 1 in include file (timeout)"
-       }
-    }
+    gdb_test "list list0.h:1" "1\[ \t\]+/\[*\]+ An include file .*5\[ \t\]+foo \[(\]+x\[)\]+" "list line 1 in include file"
 
     # FIXME Fails for COFF as well, I think.
     setup_xfail "a29k-*-udi"
-    send "list list0.h:100\n"
-    expect {
-       -re "Line number 95 out of range; .*list0.h has 36 lines.\r\n$prompt $" {
-           pass "list message for lines past EOF"
-       }
-       -re "No source file named list0.h.\r\n$prompt $" {
-           fail "list message for lines past EOF"
-       }
-       -re ".*$prompt $" {
-           fail "list message for lines past EOF"
-       }
-       timeout {
-           fail "list message for lines past EOF (timeout)"
-       }
-    }
+    gdb_test "list list0.h:100" "Line number 95 out of range; .*list0.h has 36 lines." "list message for lines past EOF"
 }
 
 #
@@ -476,7 +166,7 @@ proc test_list_filename_and_number {} {
 
     set testcnt 0
 
-    send "list list0.c:1\n"
+    send_gdb "list list0.c:1\n"
     expect {
        -re "1\[ \t\]+#include \"list0.h\".*5\[ \t\]+int x;\r\n$prompt $" {
            incr testcnt 
@@ -484,7 +174,7 @@ proc test_list_filename_and_number {} {
        -re ".*$prompt $" { fail "list list0.c:1" ; return }
        timeout { fail "list list0.c:1 (timeout)" ; return }
     }
-    send "list list0.c:10\n"
+    send_gdb "list list0.c:10\n"
     expect {
        -re "5\[ \t\]+int x;.*14\[ \t\]+foo .x\[+)\]+;\r\n$prompt $" {
            incr testcnt 
@@ -492,7 +182,7 @@ proc test_list_filename_and_number {} {
        -re ".*$prompt $" { fail "list list.c:10" ; return }
        timeout { fail "list list.c:10 (timeout)" ; return }
     }
-    send "list list1.c:1\n"
+    send_gdb "list list1.c:1\n"
     expect {
        -re "1\[ \t\]+void.*5\[ \t\]+printf \[(\]+.*\[)\]+;\r\n$prompt $" {
            incr testcnt 
@@ -500,7 +190,7 @@ proc test_list_filename_and_number {} {
        -re ".*$prompt $" { fail "list list1.c:1" ; return }
        timeout { fail "list list1.c:1 (timeout)" ; return }
     }
-    send "list list1.c:12\n"
+    send_gdb "list list1.c:12\n"
     expect {
        -re "7\[ \t\]+long_line \[(\]+.*\[)\]+;.*14\[ \t\]+\}\r\n.*$prompt $" {
            incr testcnt 
@@ -523,56 +213,17 @@ proc test_list_function {} {
     # in include files, which breaks this test.
     # SunPRO cc is the second case below, it's also correct.
     setup_xfail "a29k-*-udi"
-    send "list main\n"
-    expect {
-       -re "1\[ \t\]+#include .*8\[ \t\]+breakpoint\[(\]\[)\]+;\r\n$prompt $" {
-           pass "list function in source file 1"
-       }
-       -re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$prompt $" {
-           pass "list function in source file 1"
-       }
-       -re ".*$prompt $" { fail "list main" ; return }
-       timeout { fail "list main (timeout)" ; return }
-    }
+    gdb_test "list main" "(5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;|1\[ \t\]+#include .*8\[ \t\]+breakpoint\[(\]\[)\]+;)" "list function in source file 1"
 
     # Ultrix gdb takes the second case below; it's also correct.
     # SunPRO cc is the third case.
-    send "list bar\n"
-    expect {
-       -re "1\[ \t\]+void.*8\[ \t\]+\}\r\n$prompt $" {
-           pass "list function in source file 2"
-       }
-       -re "1\[ \t\]+void.*7\[ \t\]*long_line ..;\r\n$prompt $" {
-           pass "list function in source file 2"
-       }
-       -re "1\[ \t\]+void.*7\[ \t\]*long_line ..;.*9\[ \t\]*\r\n$prompt $" {
-           pass "list function in source file 2"
-       }
-       -re ".*$prompt $" { fail "list bar" ; return }
-       timeout { fail "list bar (timeout)" ; return }
-    }
+    gdb_test "list bar" "(1\[ \t\]+void.*7\[ \t\]*long_line ..;.*9\[ \t\]*|1\[ \t\]+void.*8\[ \t\]+\}|1\[ \t\]+void.*7\[ \t\]*long_line ..;)" "list function in source file 2"
 
     # Test "list function" for C include file
     # Ultrix gdb is the second case, still correct.
     # SunPRO cc is the third case.
     setup_xfail "powerpc-*-*"
-    send "list foo\n"
-    expect {
-       -re "2\[ \t\]+including file.*11\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$prompt $" {
-           pass "list function in include file"
-       }
-       -re "1\[ \t\]+/. An include file.*10\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$prompt $" {
-           pass "list function in include file"
-       }
-       -re "3\[ \t\]+.*12\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$prompt $" {
-           pass "list function in include file"
-       }
-       -re ".*main \[)(\]+.*$prompt $" {
-           fail "list function in include file"
-       }
-       -re ".*$prompt $" { fail "list foo (in include file)" ; return }
-       timeout { fail "list foo (timeout)" ; return }
-    }
+    gdb_test "list foo" "(3\[ \t\]+.*12\[ \t\]+bar \[(\]+.*\[)\]+;|2\[ \t\]+including file.*11\[ \t\]+bar \[(\]+.*\[)\]+;|1\[ \t\]+/. An include file.*10\[ \t\]+bar \[(\]+.*\[)\]+;)" "list function in include file"
 }
 
 proc test_list_forward {} {
@@ -580,28 +231,28 @@ proc test_list_forward {} {
 
     set testcnt 0
 
-    send "list list0.c:10\n"
+    send_gdb "list list0.c:10\n"
     expect {
        -re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$prompt $" { incr testcnt }
        -re ".*$prompt $" { fail "list list0.c:10" ; return }
        timeout { fail "list list0.c:10 (timeout)" ; return }
     }
 
-    send "list\n"
+    send_gdb "list\n"
     expect {
        -re "15\[ \t\]+foo \[(\]+.*\[)\]+;.*24\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$prompt $" { incr testcnt }
        -re ".*$prompt $" { fail "list 15-24" ; return }
        timeout { fail "list 15-24 (timeout)" ; return }
     }
 
-    send "list\n"
+    send_gdb "list\n"
     expect {
        -re "25\[ \t\]+foo \[(\]+.*\[)\]+;.*34\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$prompt $" { incr testcnt }
        -re ".*$prompt $" { fail "list 25-34" ; return }
        timeout { fail "list 25-34 (timeout)" ; return }
     }
 
-    send "list\n"
+    send_gdb "list\n"
     expect {
        -re "35\[ \t\]+foo \[(\]+.*\[)\]+;.*42\[ \t\]+\}\r\n$prompt $" { incr testcnt }
        -re ".*$prompt $" { fail "list 35-42" ; return }
@@ -616,28 +267,28 @@ proc test_list_backwards {} {
 
     set testcnt 0
 
-    send "list list0.c:33\n"
+    send_gdb "list list0.c:33\n"
     expect {
        -re "28\[ \t\]+foo \[(\]+.*\[)\]+;.*37\[ \t\]+\r\n$prompt $" { incr testcnt }
        -re ".*$prompt $" { fail "list list0.c:33" ; return }
        timeout { fail "list list0.c:33 (timeout)" ; return }
     }
 
-    send "list -\n"
+    send_gdb "list -\n"
     expect {
        -re "18\[ \t\]+foo \[(\]+.*\[)\]+;.*27\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$prompt $" { incr testcnt }
        -re ".*$prompt $" { fail "list 18-27" ; return }
        timeout { fail "list 18-27 (timeout)" ; return }
     }
 
-    send "list -\n"
+    send_gdb "list -\n"
     expect {
        -re "8\[ \t\]+breakpoint\[(\]\[)\];.*17\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$prompt $" { incr testcnt }
        -re ".*$prompt $" { fail "list 8-17" ; return }
        timeout { fail "list 8-17 (timeout)" ; return }
     }
 
-    send "list -\n"
+    send_gdb "list -\n"
     expect {
        -re "1\[ \t\]+#include .*7\[ \t\]+set_debug_traps\[(\]\[)\]+;\r\n$prompt $" { incr testcnt }
        -re ".*$prompt $" { fail "list 1-7" ; return }
@@ -654,68 +305,19 @@ proc test_list_backwards {} {
 proc test_list_range {} {
     global prompt
 
-    send "list list0.c:2,list0.c:5\n"
-    expect {
-       -re "2\[ \t\]+\r\n3\[ \t\]+main \[)(\]+.*5\[ \t\]+int x;\r\n$prompt $" {
-           pass "list range; filename:line1,filename:line2"
-       }
-       -re ".*$prompt $" { fail "list list0.c:2,list0.c:5" }
-       timeout { fail "list list0.c:2,list0.c:5 (timeout)" }
-    }
+    gdb_test "list list0.c:2,list0.c:5" "2\[ \t\]+\r\n3\[ \t\]+main \[)(\]+.*5\[ \t\]+int x;" "list range; filename:line1,filename:line2"
 
-    send "list 2,5\n"
-    expect {
-       -re "2\[ \t\]+\r\n3\[ \t\]+main \[)(\]+.*5\[ \t\]+int x;\r\n$prompt $" {
-           pass "list range; line1,line2"
-       }
-       -re ".*$prompt $" { fail "list 2,5" }
-       timeout { fail "list 2,5 (timeout)" }
-    }
+    gdb_test "list 2,5" "2\[ \t\]+\r\n3\[ \t\]+main \[)(\]+.*5\[ \t\]+int x;" "list range; line1,line2"
 
-    #send "list -1,6\n"
-    #expect {
-       #-re "Line number 0 out of range; .*list0.c has 39 lines.\r\n$prompt $" {
-           #pass "list range; lower bound negative"
-       #}
-       #-re ".*$prompt $" { fail "list -1,6" }
-       #timeout { fail "list -1,6 (timeout)" }
-    #}
-
-    #send "list -100,-40\n"
-    #expect {
-       #-re "Line number -60 out of range; .*list0.c has 39 lines.\r\n$prompt $" {
-           #pass "list range; both bounds negative"
-       #}
-       #-re ".*$prompt $" { fail "-100,-40" }
-       #timeout { fail "-100,-40 (timeout)" }
-    #}
-
-    send "list 30,43\n"
-    expect {
-       -re "30\[ \t\]+foo \[(\]+.*\[)\]+;.*42\[ \t\]+\}\r\n$prompt $" {
-           pass "list range; upper bound past EOF"
-       }
-       -re ".*$prompt $" { fail "list 30,43" }
-       timeout { fail "list 30,43 (timeout)" }
-    }
+#    gdb_test     "list -1,6"  "Line number 0 out of range; .*list0.c has 39 lines." "list range; lower bound negative"
 
-    send "list 43,100\n"
-    expect {
-       -re "Line number 43 out of range; .*list0.c has 42 lines.\r\n$prompt $" {
-           pass "list range; both bounds past EOF"
-       }
-       -re ".*$prompt $" { fail "43,100" }
-       timeout { fail "43,100 (timeout)" }
-    }
+#    gdb_test     "list -100,-40"      "Line number -60 out of range; .*list0.c has 39 lines." "list range; both bounds negative"
 
-    send "list list0.c:2,list1.c:17\n"
-    expect {
-       -re "Specified start and end are in different files.\r\n$prompt $" {
-           pass "list range, must be same files"
-       }
-       -re ".*$prompt $" { fail "list0.c:2,list1.c:17" }
-       timeout { fail "list0.c:2,list1.c:17 (timeout)" }
-    }
+    gdb_test "list 30,43" "30\[ \t\]+foo \[(\]+.*\[)\]+;.*42\[ \t\]+\}" "list range; upper bound past EOF"
+
+    gdb_test "list 43,100" "Line number 43 out of range; .*list0.c has 42 lines." "list range; both bounds past EOF"
+
+    gdb_test "list list0.c:2,list1.c:17" "Specified start and end are in different files." "list range, must be same files"
 }
 
 #
@@ -731,7 +333,7 @@ proc test_list_filename_and_function {} {
     # in include files, which breaks this test.
     # SunPRO cc is the second case below, it's also correct.
     setup_xfail "a29k-*-udi"
-    send "list list0.c:main\n"
+    send_gdb "list list0.c:main\n"
     expect {
        -re "1\[ \t\]+#include .*8\[ \t\]+breakpoint\[(\]\[)\]+;\r\n$prompt $" {
            incr testcnt
@@ -748,7 +350,7 @@ proc test_list_filename_and_function {} {
     # Not sure what the point of having this function be unused is.
     # AIX is legitimately removing it.
     setup_xfail "rs6000-*-aix*"
-    send "list list0.c:unused\n"
+    send_gdb "list list0.c:unused\n"
     expect {
        -re "36\[ \t\]+\}.*42\[ \t\]+\}\r\n$prompt $" {
            incr testcnt
@@ -769,7 +371,7 @@ proc test_list_filename_and_function {} {
     setup_xfail "powerpc-*-*" 1804
     # FIXME Fails for COFF as well, I think.
     setup_xfail "a29k-*-udi"
-    send "list list0.h:foo\n"
+    send_gdb "list list0.h:foo\n"
     expect {
        -re "2\[ \t\]+including file.  This.*11\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$prompt $" {
            incr testcnt
@@ -789,7 +391,7 @@ proc test_list_filename_and_function {} {
 
     # Ultrix gdb is the second case.
     # a29k-amd-udi is the third case.
-    send "list list1.c:bar\n"
+    send_gdb "list list1.c:bar\n"
     expect {
        -re "1\[ \t\]+void.*8\[ \t\]+\}\r\n$prompt $" {
            incr testcnt
@@ -809,7 +411,7 @@ proc test_list_filename_and_function {} {
     # Not sure what the point of having this function be unused is.
     # AIX is legitimately removing it.
     setup_xfail "rs6000-*-aix*"
-    send "list list1.c:unused\n"
+    send_gdb "list list1.c:unused\n"
     expect {
        -re "7\[ \t\]+long_line \[(\]\[)\];.*14\[ \t\]+\}\r\n.*$prompt $" {
            incr testcnt
@@ -835,53 +437,11 @@ proc test_list_filename_and_function {} {
 # contain the requested symbol, it will subsequently search all of the symtabs
 # for the requested symbol.
 
-    send "list list0.c:foo\n"
-    expect {
-       -re "Function \"foo\" not defined in .*list0.c\r\n$prompt $" {
-           pass "list filename:function; wrong filename rejected"
-       }
-       -re "2\[ \t\]+including file.*11\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$prompt $" {
-           fail "list filename:function; wrong filename not rejected"
-       }
-       -re ".*main \[)(\]+.*$prompt $" {
-           fail "list filename:function; wrong filename not rejected"
-       }
-       -re ".*$prompt $" {
-           fail "list filename:function; wrong filename not rejected"
-       }
-       timeout {
-           fail "list filename:function; wrong filename (timeout)"
-       }
-    }
+    gdb_test "list list0.c:foo" "Function \"foo\" not defined in .*list0.c" "list filename:function; wrong filename rejected"
 
-    send "list foobar.c:main\n"
-    expect {
-       -re "No source file named foobar.c.\r\n$prompt $" {
-           pass "list filename:function; nonexistant file"
-       }
-       -re ".*$prompt $" {
-           fail "list filename:function; nonexistant file"
-       }
-       timeout {
-           fail "list filename:function; nonexistant file (timeout)"
-       }
-    }
+    gdb_test "list foobar.c:main" "No source file named foobar.c." "list filename:function; nonexistant file"
 
-    send "list list0.h:foobar\n"
-    expect {
-       -re "Function \"foobar\" not defined.\r\n$prompt $" {
-           pass "list filename:function; nonexistant function"
-       }
-       -re "No source file named list0.h.\r\n$prompt $" {
-           fail "list filename:function; nonexistant function"
-       }
-       -re ".*$prompt $" {
-           fail "list filename:function; nonexistant function"
-       }
-       timeout {
-           fail "list filename:function; nonexistant function (timeout)"
-       }
-    }
+    gdb_test "list list0.h:foobar" "Function \"foobar\" not defined." "list filename:function; nonexistant function"
 
 }
 
@@ -902,7 +462,7 @@ proc test_forward_search {} {
        # Test that GDB won't crash if the line being searched is extremely long.
 
        set oldtimeout $timeout
-       set timeout [expr "$timeout + 60"]
+       set timeout [expr "$timeout + 300"]
        verbose "Timeout is now $timeout seconds" 2
        match_max 10000
        gdb_test "search 1234" ".*1234.*" "search extremely long line (> 5000 chars)"
@@ -917,17 +477,17 @@ gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
 
-if $usestubs {
-    send "step\n"
+if [target_info exists use_gdb_stubs] {
+    send_gdb "step\n"
     # if use stubs step out of the breakpoint() function.
     expect {
         -re "main.* at .*$prompt $" {}
+       -re ".*in .*start.*$prompt $" {}
         timeout { fail "single step at breakpoint() (timeout)" ; return 0 }
     }
 }
 
-send "set width 0\n"
-expect -re "$prompt $"
+gdb_test "set width 0" "" "set width 0"
 
 test_listsize
 if [ set_listsize 10 ] then {
index 39a840ad75ca95ae07522dd523b85b496fbe48ce..4af88a8fcadd74ae2843d7e5ff2784f05ea2fea1 100644 (file)
@@ -10,32 +10,21 @@ set bug_id 0
 set testfile nodebug
 set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
-
-# Get rid of any -g options (including -gstabs, -gdwarf, etc...
-if [info exists target_info(target,cflags)] {
-       set saved_cflags $target_info(target,cflags)
-       regsub -all -- {[       ]-g[^   ]*} $target_info(target,cflags) { } target_info(target,cflags)
-}
-
-if  { [compile "${srcdir}/${subdir}/${srcfile} -o ${binfile}"] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ""] != "" } {
     perror "Couldn't compile ${srcfile}"
     return -1
 }
 
 # Create and source the file that provides information about the compiler
 # used to compile the test case.
-execute_anywhere "rm -f ${binfile}.ci"
-if  { [compile "-E ${srcdir}/${subdir}/compiler.c > ${binfile}.ci"] != "" } {
-    perror "Couldn't make ${binfile}.ci file"
-    return -1
-}
-
-if [info exists target_info(target,cflags)] {
-       set target_info(target,cflags) $saved_cflags
+if [get_compiler_info ${binfile}] {
+    return -1;
 }
 
 source ${binfile}.ci
 
+gdb_exit
+gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load $binfile
 
@@ -60,21 +49,27 @@ if [runto inner] then {
     # even without -g, which should be accepted.
     # Irix5, even though it is ELF, counts as "ecoff" because it
     # encapsulates ecoff debugging info in a .mdebug section.
+    # Irix6 gcc omits no debug info at all for static functions and
+    # variables, so all tests involving statics fail.
     
-    if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" }
+    if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" "mips-sgi-irix6*" }
     gdb_test "p top" \
        "{(<(text variable|function), no debug info>|short \\(\\))} \[0-9a-fx]* <top>"
-    if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" }
+    if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" "mips-sgi-irix6*" }
     gdb_test "whatis top" \
        "(<(text variable|function), no debug info>|short \\(\\))"
+    if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
     gdb_test "ptype top" "(short|int) \\((|<non-float parameter>|<non-float parameter>, <non-float parameter>)\\)"
     
     if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" }
+    setup_xfail "mips-sgi-irix6*"
     gdb_test "p middle" \
        "{(<(text variable|function), no debug info>|short \\(\\))} \[0-9a-fx]* <middle>"
     if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" }
+    setup_xfail "mips-sgi-irix6*"
     gdb_test "whatis middle" \
        "(<(text variable|function), no debug info>|short \\(\\))"
+    setup_xfail "mips-sgi-irix6*"
     gdb_test "ptype middle" "(short|int) \\((|<non-float parameter>|<non-float parameter>, <non-float parameter>)\\)"
     
     gdb_test "p dataglobal" "= 3"
@@ -88,14 +83,17 @@ if [runto inner] then {
     setup_xfail "rs6000*-*-aix*"
     setup_xfail "powerpc*-*-aix*"
     if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
+    if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
     gdb_test "p datalocal" "= 4"
     setup_xfail "rs6000*-*-aix*"
     setup_xfail "powerpc*-*-aix*"
     if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
+    if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
     gdb_test "whatis datalocal" "<(data variable|variable), no debug info>"
     setup_xfail "rs6000*-*-aix*"
     setup_xfail "powerpc*-*-aix*"
     if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
+    if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
     gdb_test "ptype datalocal" "<(data variable|variable), no debug info>"
     
     gdb_test "p bssglobal" "= 0"
@@ -105,16 +103,20 @@ if [runto inner] then {
     setup_xfail "rs6000*-*-aix*"
     setup_xfail "powerpc*-*-aix*"
     if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
+    if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
     gdb_test "p bsslocal" "= 0"
     setup_xfail "rs6000*-*-aix*"
     setup_xfail "powerpc*-*-aix*"
     if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
+    if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
     gdb_test "whatis bsslocal" "<(data variable|variable), no debug info>"
     setup_xfail "rs6000*-*-aix*"
     setup_xfail "powerpc*-*-aix*"
     if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
+    if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
     gdb_test "ptype bsslocal" "<(data variable|variable), no debug info>"
     
+    if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
     gdb_test "backtrace 10" "#0.*inner.*#1.*middle.*#2.*top.*#3.*main.*" \
        "backtrace from inner in nodebug.exp"
     # Or if that doesn't work, at least hope for the external symbols
@@ -125,11 +127,12 @@ if [runto inner] then {
     
     # This test is not as obscure as it might look.  `p getenv ("TERM")'
     # is a real-world example, at least on many systems.
-    if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
+    if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" "mips-sgi-irix6*" }
     gdb_test {p/c array_index("abcdef",2)} " = 99 'c'"
     
     # Now, try that we can give names of file-local symbols which happen
     # to be unique, and have it still work
+    if {$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" }
     if [runto middle] then {
        gdb_test "backtrace 10" "#0.*middle.*#1.*top.*#2.*main.*" \
            "backtrace from middle in nodebug.exp"
index 74d5312108871a05e876f51a14a0300a3256372f..b13fd793acf9401b863017c4bdc9a26affe9152c 100644 (file)
@@ -27,9 +27,9 @@ set prms_id 0
 set bug_id 0
 
 set testfile "printcmds"
-set srcfile ${srcdir}/$subdir/${testfile}.c
+set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
-if  { [compile "${srcfile} -g -o ${binfile}"] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     perror "Couldn't compile ${srcfile}"
     return -1
 }
@@ -40,27 +40,14 @@ if  { [compile "${srcfile} -g -o ${binfile}"] != "" } {
 proc set_lang_c {} {
     global prompt
 
-    send "set language c\n"
-    expect {
-       -re ".*$prompt $" {}
-       timeout { fail "set language c (timeout)" ; return 0 }
+    if [gdb_test "set language c" "" "set language c"] {
+       return 0
     }
 
-    send "show language\n"
-    expect {
-       -re ".* source language is \"c\".*$prompt $" {
-           pass "set language to \"c\""
-           return 1
-       }
-       -re ".*$prompt $" {
-           fail "setting language to \"c\""
-           return 0
-       }
-       timeout {
-           fail "can't show language (timeout)"
-           return 0
-       }
+    if [gdb_test "show language" ".* source language is \"c\".*"] {
+       return 0
     }
+    return 1;
 }
 
 proc test_integer_literals_accepted {} {
@@ -408,7 +395,7 @@ proc test_print_all_chars {} {
 proc test_print_repeats_10 {} {
     global prompt
 
-    send "set print elements 1\n" ; expect -re "$prompt $"
+    gdb_test "set print elements 1" ""
     gdb_test "p &ctable2\[0*16\]"  " = \\(unsigned char \\*\\) \"a\"..."
     gdb_test "p &ctable2\[1*16\]"  " = \\(unsigned char \\*\\) \"a\"..."
     gdb_test "p &ctable2\[2*16\]"  " = \\(unsigned char \\*\\) \"a\"..."
@@ -426,7 +413,7 @@ proc test_print_repeats_10 {} {
     gdb_test "p &ctable2\[14*16\]" " = \\(unsigned char \\*\\) \"a\"..."
     gdb_test "p &ctable2\[15*16\]" " = \\(unsigned char \\*\\) \"a\"..."
 
-    send "set print elements 2\n" ; expect -re "$prompt $"
+    gdb_test "set print elements 2" ""
     gdb_test "p &ctable2\[0*16\]"  " = \\(unsigned char \\*\\) \"aX\"..."
     gdb_test "p &ctable2\[1*16\]"  " = \\(unsigned char \\*\\) \"aa\"..."
     gdb_test "p &ctable2\[2*16\]"  " = \\(unsigned char \\*\\) \"aa\"..."
@@ -444,7 +431,7 @@ proc test_print_repeats_10 {} {
     gdb_test "p &ctable2\[14*16\]" " = \\(unsigned char \\*\\) \"aa\"..."
     gdb_test "p &ctable2\[15*16\]" " = \\(unsigned char \\*\\) \"aa\"..."
 
-    send "set print elements 3\n" ; expect -re "$prompt $"
+    gdb_test "set print elements 3" ""
     gdb_test "p &ctable2\[0*16\]"  " = \\(unsigned char \\*\\) \"aXX\"..."
     gdb_test "p &ctable2\[1*16\]"  " = \\(unsigned char \\*\\) \"aaX\"..."
     gdb_test "p &ctable2\[2*16\]"  " = \\(unsigned char \\*\\) \"aaa\"..."
@@ -462,7 +449,7 @@ proc test_print_repeats_10 {} {
     gdb_test "p &ctable2\[14*16\]" " = \\(unsigned char \\*\\) \"aaa\"..."
     gdb_test "p &ctable2\[15*16\]" " = \\(unsigned char \\*\\) \"aaa\"..."
 
-    send "set print elements 4\n" ; expect -re "$prompt $"
+    gdb_test "set print elements 4" ""
     gdb_test "p &ctable2\[0*16\]"  " = \\(unsigned char \\*\\) \"aXXX\"..."
     gdb_test "p &ctable2\[1*16\]"  " = \\(unsigned char \\*\\) \"aaXX\"..."
     gdb_test "p &ctable2\[2*16\]"  " = \\(unsigned char \\*\\) \"aaaX\"..."
@@ -480,7 +467,7 @@ proc test_print_repeats_10 {} {
     gdb_test "p &ctable2\[14*16\]" " = \\(unsigned char \\*\\) \"aaaa\"..."
     gdb_test "p &ctable2\[15*16\]" " = \\(unsigned char \\*\\) \"aaaa\"..."
 
-    send "set print elements 5\n" ; expect -re "$prompt $"
+    gdb_test "set print elements 5" ""
     gdb_test "p &ctable2\[0*16\]"  " = \\(unsigned char \\*\\) \"aXXXX\"..."
     gdb_test "p &ctable2\[1*16\]"  " = \\(unsigned char \\*\\) \"aaXXX\"..."
     gdb_test "p &ctable2\[2*16\]"  " = \\(unsigned char \\*\\) \"aaaXX\"..."
@@ -498,7 +485,7 @@ proc test_print_repeats_10 {} {
     gdb_test "p &ctable2\[14*16\]" " = \\(unsigned char \\*\\) \"aaaaa\"..."
     gdb_test "p &ctable2\[15*16\]" " = \\(unsigned char \\*\\) \"aaaaa\"..."
 
-    send "set print elements 6\n" ; expect -re "$prompt $"
+    gdb_test "set print elements 6" ""
     gdb_test "p &ctable2\[0*16\]"  " = \\(unsigned char \\*\\) \"aXXXXX\"..."
     gdb_test "p &ctable2\[1*16\]"  " = \\(unsigned char \\*\\) \"aaXXXX\"..."
     gdb_test "p &ctable2\[2*16\]"  " = \\(unsigned char \\*\\) \"aaaXXX\"..."
@@ -516,7 +503,7 @@ proc test_print_repeats_10 {} {
     gdb_test "p &ctable2\[14*16\]" " = \\(unsigned char \\*\\) \"aaaaaa\"..."
     gdb_test "p &ctable2\[15*16\]" " = \\(unsigned char \\*\\) \"aaaaaa\"..."
 
-    send "set print elements 7\n" ; expect -re "$prompt $"
+    gdb_test "set print elements 7" ""
     gdb_test "p &ctable2\[0*16\]"  " = \\(unsigned char \\*\\) \"aXXXXXX\"..."
     gdb_test "p &ctable2\[1*16\]"  " = \\(unsigned char \\*\\) \"aaXXXXX\"..."
     gdb_test "p &ctable2\[2*16\]"  " = \\(unsigned char \\*\\) \"aaaXXXX\"..."
@@ -534,7 +521,7 @@ proc test_print_repeats_10 {} {
     gdb_test "p &ctable2\[14*16\]" " = \\(unsigned char \\*\\) \"aaaaaaa\"..."
     gdb_test "p &ctable2\[15*16\]" " = \\(unsigned char \\*\\) \"aaaaaaa\"..."
 
-    send "set print elements 8\n" ; expect -re "$prompt $"
+    gdb_test "set print elements 8" ""
     gdb_test "p &ctable2\[0*16\]"  " = \\(unsigned char \\*\\) \"aXXXXXXX\"..."
     gdb_test "p &ctable2\[1*16\]"  " = \\(unsigned char \\*\\) \"aaXXXXXX\"..."
     gdb_test "p &ctable2\[2*16\]"  " = \\(unsigned char \\*\\) \"aaaXXXXX\"..."
@@ -552,7 +539,7 @@ proc test_print_repeats_10 {} {
     gdb_test "p &ctable2\[14*16\]" " = \\(unsigned char \\*\\) \"aaaaaaaa\"..."
     gdb_test "p &ctable2\[15*16\]" " = \\(unsigned char \\*\\) \"aaaaaaaa\"..."
 
-    send "set print elements 9\n" ; expect -re "$prompt $"
+    gdb_test "set print elements 9" ""
     gdb_test "p &ctable2\[0*16\]"  " = \\(unsigned char \\*\\) \"aXXXXXXXX\"..."
     gdb_test "p &ctable2\[1*16\]"  " = \\(unsigned char \\*\\) \"aaXXXXXXX\"..."
     gdb_test "p &ctable2\[2*16\]"  " = \\(unsigned char \\*\\) \"aaaXXXXXX\"..."
@@ -570,7 +557,7 @@ proc test_print_repeats_10 {} {
     gdb_test "p &ctable2\[14*16\]" " = \\(unsigned char \\*\\) \"aaaaaaaaa\"..."
     gdb_test "p &ctable2\[15*16\]" " = \\(unsigned char \\*\\) \"aaaaaaaaa\"..."
 
-    send "set print elements 10\n" ; expect -re "$prompt $"
+    gdb_test "set print elements 10" ""
     gdb_test "p &ctable2\[0*16\]"  " = \\(unsigned char \\*\\) \"aXXXXXXXXX\"..."
     gdb_test "p &ctable2\[1*16\]"  " = \\(unsigned char \\*\\) \"aaXXXXXXXX\"..."
     gdb_test "p &ctable2\[2*16\]"  " = \\(unsigned char \\*\\) \"aaaXXXXXXX\"..."
@@ -588,7 +575,7 @@ proc test_print_repeats_10 {} {
     gdb_test "p &ctable2\[14*16\]" " = \\(unsigned char \\*\\) \"aaaaaaaaaa\"..."
     gdb_test "p &ctable2\[15*16\]" " = \\(unsigned char \\*\\) \"aaaaaaaaaa\"..."
 
-    send "set print elements 11\n" ; expect -re "$prompt $"
+    gdb_test "set print elements 11" ""
     gdb_test "p &ctable2\[0*16\]" \
        " = \\(unsigned char \\*\\) \"aXXXXXXXXXX\"..."
     gdb_test "p &ctable2\[1*16\]" \
@@ -622,7 +609,7 @@ proc test_print_repeats_10 {} {
     gdb_test "p &ctable2\[15*16\]" \
        " = \\(unsigned char \\*\\) 'a' <repeats 11 times>..."
 
-    send "set print elements 12\n" ; expect -re "$prompt $"
+    gdb_test "set print elements 12" ""
     gdb_test "p &ctable2\[0*16\]" \
        " = \\(unsigned char \\*\\) \"a\", 'X' <repeats 11 times>..."
     gdb_test "p &ctable2\[1*16\]" \
@@ -656,7 +643,7 @@ proc test_print_repeats_10 {} {
     gdb_test "p &ctable2\[15*16\]" \
        " = \\(unsigned char \\*\\) 'a' <repeats 12 times>..."
 
-    send "set print elements 13\n" ; expect -re "$prompt $"
+    gdb_test "set print elements 13" ""
     gdb_test "p &ctable2\[0*16\]" \
        " = \\(unsigned char \\*\\) \"a\", 'X' <repeats 12 times>..."
     gdb_test "p &ctable2\[1*16\]" \
@@ -690,7 +677,7 @@ proc test_print_repeats_10 {} {
     gdb_test "p &ctable2\[15*16\]" \
        " = \\(unsigned char \\*\\) 'a' <repeats 13 times>..."
 
-    send "set print elements 14\n" ; expect -re "$prompt $"
+    gdb_test "set print elements 14" ""
     gdb_test "p &ctable2\[0*16\]" \
        " = \\(unsigned char \\*\\) \"a\", 'X' <repeats 13 times>..."
     gdb_test "p &ctable2\[1*16\]" \
@@ -724,7 +711,7 @@ proc test_print_repeats_10 {} {
     gdb_test "p &ctable2\[15*16\]" \
        " = \\(unsigned char \\*\\) 'a' <repeats 14 times>..."
 
-    send "set print elements 15\n" ; expect -re "$prompt $"
+    gdb_test "set print elements 15" ""
     gdb_test "p &ctable2\[0*16\]" \
        " = \\(unsigned char \\*\\) \"a\", 'X' <repeats 14 times>..."
     gdb_test "p &ctable2\[1*16\]" \
@@ -758,7 +745,7 @@ proc test_print_repeats_10 {} {
     gdb_test "p &ctable2\[15*16\]" \
        " = \\(unsigned char \\*\\) 'a' <repeats 15 times>..."
 
-    send "set print elements 16\n" ; expect -re "$prompt $"
+    gdb_test "set print elements 16" ""
     gdb_test "p &ctable2\[0*16\]" \
        " = \\(unsigned char \\*\\) \"a\", 'X' <repeats 15 times>..."
     gdb_test "p &ctable2\[1*16\]" \
@@ -801,23 +788,23 @@ proc test_print_strings {} {
 
     # Test that setting print elements unlimited doesn't completely suppress
     # printing; this was a bug in older gdb's.
-    send "set print elements 0\n" ; expect -re "$prompt $"
+    gdb_test "set print elements 0" ""
     gdb_test "p teststring" \
        " = (.unsigned char .. )?\"teststring contents\""
-    send "set print elements 1\n" ; expect -re "$prompt $"
+    gdb_test "set print elements 1" ""
     gdb_test "p teststring" \
        " = (.unsigned char .. )?\"t\"\\.\\.\\."
-    send "set print elements 5\n" ; expect -re "$prompt $"
+    gdb_test "set print elements 5" ""
     gdb_test "p teststring" \
        " = (.unsigned char .. )?\"tests\"\\.\\.\\."
-    send "set print elements 19\n" ; expect -re "$prompt $"
+    gdb_test "set print elements 19" ""
     gdb_test "p teststring" \
        " = (.unsigned char .. )?\"teststring contents\""
-    send "set print elements 20\n" ; expect -re "$prompt $"
+    gdb_test "set print elements 20" ""
     gdb_test "p teststring" \
        " = (.unsigned char .. )?\"teststring contents\""
 
-    send "set print elements 8\n" ; expect -re "$prompt $"
+    gdb_test "set print elements 8" ""
 
     gdb_test "p &ctable1\[0\]" \
        " = \\(unsigned char \\*\\) \"\""
@@ -890,7 +877,7 @@ proc test_print_strings {} {
 proc test_print_int_arrays {} {
     global prompt
 
-    send "set print elements 24\n" ; expect -re "$prompt $"
+    gdb_test "set print elements 24" ""
 
     gdb_test "p int1dim" \
        " = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}"
@@ -916,8 +903,8 @@ proc test_print_char_arrays {} {
     global prompt
     global hex
 
-    send "set print elements 24\n" ; expect -re "$prompt $"
-    send "set print address on\n" ; expect -re "$prompt $"
+    gdb_test "set print elements 24" ""
+    gdb_test "set print address on" ""
 
     gdb_test "p arrays" \
        " = {array1 = \"abc\", array2 = \"d\", array3 = \"e\", array4 = \"fg\", array5 = \"hij\"}"
@@ -934,13 +921,13 @@ proc test_print_char_arrays {} {
     gdb_test "p parrays->array5"       " = \"hij\""
     gdb_test "p &parrays->array5"      " = \\(unsigned char \\(\\*\\)\\\[4\\\]\\) $hex"
 
-    send "set print address off\n" ; expect -re "$prompt $"
+    gdb_test "set print address off" ""
 }
 
 proc test_print_string_constants {} {
     global prompt
 
-    send "set print elements 50\n" ; expect -re "$prompt $"
+    gdb_test "set print elements 50" ""
 
     setup_xfail "a29k-*-udi" 2416
     gdb_test "p \"a string\""          " = \"a string\""
@@ -1006,15 +993,11 @@ gdb_test "print \$pc" "No registers\\."
 
 gdb_load ${binfile}
 
-send "set print sevenbit-strings\n" ; expect -re "$prompt $"
-send "set print address off\n" ; expect -re "$prompt $"
-send "set width 0\n" ; expect -re "$prompt $"
+gdb_test "set print sevenbit-strings" ""
+gdb_test "set print address off" ""
+gdb_test "set width 0" ""
 
 if [set_lang_c] then {
-# On AIX, we can't print variables before we run the program.  This is because
-# the data segment and text segment are in the same range of addresses until
-# they are relocated.  Ick.
-    setup_xfail "rs6000-*-aix*"
     gdb_test "p ctable1\[120\]" "120 'x'"
 
     if [runto_main] then {
index c478dfde1b50d8ba475b3d130065d1c9a3d04b1d..7bd9ca85e84c04fa814ac4fc0c42dd8821928ff5 100644 (file)
@@ -30,17 +30,17 @@ set prms_id 0
 set bug_id 0
 
 set testfile "ptype"
-set srcfile ${srcdir}/$subdir/${testfile}.c
+set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
-if  { [compile "${srcfile} -g -o ${binfile}"] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     perror "Couldn't compile ${srcfile}"
     return -1
 }
 
-execute_anywhere "rm -f ${binfile}.ci"
-if  { [compile "-E ${srcdir}/${subdir}/compiler.c > ${binfile}.ci"] != "" } {
-    perror "Couldn't make ${testfile}.ci file"
-    return -1
+# Create and source the file that provides information about the compiler
+# used to compile the test case.
+if [get_compiler_info ${binfile}] {
+    return -1;
 }
 
 gdb_exit
@@ -48,14 +48,12 @@ gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
 
-source ${binfile}.ci
-
 # Test ptype of unnamed enumeration members before any action causes
 # the partial symbol table to be expanded to full symbols.  This fails
 # with stabs compilers which fail to use a nameless stab (such as
 # pre-2.4.5 versions of gcc and most non-gcc compilers).
 
-send "ptype red1\n"
+send_gdb "ptype red1\n"
 expect {
     -re "type = enum primary1_tag \{red1, green1, blue1\}.*$prompt $"\
        {
@@ -75,7 +73,7 @@ expect {
 # Here and elsewhere, we accept
 # "long", "long int", or "int" for long variables (whatis.exp already
 # has an XFAIL for "int" (Sun cc bug), so no need to fail it here).
-send "ptype struct t_struct\n"
+send_gdb "ptype struct t_struct\n"
 expect {
     -re "type = struct t_struct \{.*
     (unsigned |)char v_char_member;.*
@@ -113,11 +111,11 @@ if [gdb_test "ptype v_t_struct_p->v_float_member" "type = float"]<0 then {
 }
 
 
-send "ptype struct link\n"
+send_gdb "ptype struct link\n"
 expect {
     -re "type = struct link \{.*
     struct link \[*\]next;.*
-    struct link \[*(\]+linkfunc\[)(\]+;.*
+    struct link \[*(\]+linkfunc\[)(\]+(struct link \[*\], int\[)\]|);.*
     struct t_struct stuff.1..2..3.;.*
 \}.*$prompt $"                      { pass "ptype linked list structure" }
     -re ".*$prompt $"  { 
@@ -134,7 +132,7 @@ expect {
 #
 # test ptype command with unions
 #
-send "ptype union t_union\n"
+send_gdb "ptype union t_union\n"
 expect {
     -re "type = union t_union \{.*
     (unsigned |)char v_char_member;.*
@@ -149,11 +147,11 @@ expect {
 }
 
 
-send "ptype union tu_link\n"
+send_gdb "ptype union tu_link\n"
 expect {
     -re "type = union tu_link .*
     struct link \[*\]next;.*
-    struct link \[(\*\]+linkfunc\[)(\]+;.*
+    struct link \[(\*\]+linkfunc\[)(\]+(struct link \[*\], int\[)\]|);.*
     struct t_struct stuff.1..2..3.;.*
 \}.*$prompt $"                      { pass "ptype linked list union" }
     -re ".*$prompt $" {
@@ -171,7 +169,7 @@ expect {
 # test ptype command with enums
 #
 
-send "ptype primary\n"
+send_gdb "ptype primary\n"
 expect {
     -re "type = enum .red, green, blue.*$prompt $"       { pass "ptype unnamed enumeration" }
     -re ".*$prompt $"  { fail "ptype unnamed enumeration" }
@@ -179,7 +177,7 @@ expect {
 }
 
 
-send "ptype enum colors\n"
+send_gdb "ptype enum colors\n"
 expect {
     -re "type = enum colors \{yellow, purple, pink\}.*$prompt $"\
        { pass "ptype named enumeration" }
@@ -191,7 +189,7 @@ expect {
 #
 # test ptype command with enums as typedef
 #
-send "ptype boolean\n"
+send_gdb "ptype boolean\n"
 expect {
     -re "type = enum \{FALSE, TRUE\}.*$prompt $"   { pass "ptype unnamed typedef'd enumeration" }
     -re ".*$prompt $"  { fail "ptype unnamed typedef'd enumeration" }
@@ -207,8 +205,7 @@ expect {
 # GDB's behavior is correct; the type which the variable is defined
 # as (51) doesn't have a name.  Only 55 has a name.
 
-setup_xfail "i*86-*-sysv4*"
-if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
+if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "i*86-*-sysv4*" }
 gdb_test "whatis v_boolean" "type = boolean" \
   "whatis unnamed typedef'd enum (compiler bug in IBM's xlc)"
 
@@ -221,7 +218,7 @@ gdb_test "ptype t_union3" "type = union \{.*
  *double v_double_member;.*
  *int v_int_member;.*\}" "printing typedef'd union"
 
-send "ptype enum bvals\n"
+send_gdb "ptype enum bvals\n"
 expect {
     -re "type = enum bvals \{false, true\}.*$prompt $"   { pass "ptype named typedef'd enumf'd enum" }
     -re ".*$prompt $"  { fail "ptype named typedef'd enumeration" }
@@ -232,7 +229,7 @@ expect {
 #
 # test ptype command with out-of-order enum values
 #
-send "ptype enum misordered\n"
+send_gdb "ptype enum misordered\n"
 expect {
     -re "type = enum misordered \{two = 2, one = 1, zero = 0, three = 3\}.*$prompt $"\
        { pass "ptype misordered enumeration" }
@@ -244,7 +241,7 @@ expect {
 #
 # test ptype command with a named enum's value
 #
-send "ptype three\n"
+send_gdb "ptype three\n"
 expect {
     -re "type = enum misordered \{two = 2, one = 1, zero = 0, three = 3\}.*$prompt $"\
        { pass "ptype named enumeration member" }
@@ -253,7 +250,7 @@ expect {
 }
 
 
-send "ptype red\n"
+send_gdb "ptype red\n"
 expect {
     -re "type = enum \{red, green, blue\}.*$prompt $"\
        { pass "ptype unnamed enumeration member" }
@@ -297,7 +294,7 @@ expect {
 #}
 
 
-send "ptype v_short\n"
+send_gdb "ptype v_short\n"
 expect {
     -re "type = short(| int).*$prompt $"       { pass "ptype short" }
     -re ".*$prompt $"  { fail "ptype short" }
@@ -321,7 +318,7 @@ expect {
 #}
 
 
-send "ptype v_int\n"
+send_gdb "ptype v_int\n"
 expect {
     -re "type = int.*$prompt $"        { pass "ptype int" }
     -re ".*$prompt $"  { fail "ptype int" }
@@ -482,8 +479,7 @@ expect {
 #}
 #
 
-setup_xfail "i*86-*-sysv4*"
-if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
+if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "i*86-*-sysv4*" }
 gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]"
 
 #
@@ -608,7 +604,7 @@ gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]"
 #
 # test ptype command with nested structure and union
 #
-send "ptype struct outer_struct\n"
+send_gdb "ptype struct outer_struct\n"
 expect {
     -re "type = struct outer_struct \{.*
     int outer_int;.*
@@ -621,7 +617,7 @@ expect {
 }
 
 
-send "ptype struct inner_struct\n"
+send_gdb "ptype struct inner_struct\n"
 expect {
     -re "type = struct inner_struct \{.*
     int inner_int;.*
@@ -632,7 +628,7 @@ expect {
 }
 
 
-send "ptype union inner_union\n"
+send_gdb "ptype union inner_union\n"
 expect {
     -re "type = union inner_union \{.*
     int inner_union_int;.*
@@ -643,7 +639,7 @@ expect {
 }
 
 
-send "ptype nested_su\n"
+send_gdb "ptype nested_su\n"
 expect {
     -re "type = struct outer_struct \{.*
     int outer_int;.*
@@ -656,7 +652,7 @@ expect {
 }
 
 
-send "ptype nested_su.outer_int\n"
+send_gdb "ptype nested_su.outer_int\n"
 expect {
     -re "type = int.*$prompt $"           { pass "ptype outer int" }
     -re ".*$prompt $"  { fail "ptype outer int" }
@@ -664,7 +660,7 @@ expect {
 }
 
 
-send "ptype nested_su.inner_struct_instance\n"
+send_gdb "ptype nested_su.inner_struct_instance\n"
 expect {
     -re "type = struct inner_struct \{.*
     int inner_int;.*
@@ -675,7 +671,7 @@ expect {
 }
 
 
-send "ptype nested_su.inner_struct_instance.inner_int\n"
+send_gdb "ptype nested_su.inner_struct_instance.inner_int\n"
 expect {
     -re "type = int.*$prompt $"           { pass "ptype inner int" }
     -re ".*$prompt $"  { fail "ptype inner int" }
@@ -683,7 +679,7 @@ expect {
 }
 
 
-send "ptype nested_su.inner_union_instance\n"
+send_gdb "ptype nested_su.inner_union_instance\n"
 expect {
     -re "type = union inner_union \{.*
     int inner_union_int;.*
index 90c9d2e80389ea1f450b2f8336165d63ab6b43dc..5372390c05c6178026e5539065b8f20d914b0415 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 1992 Free Software Foundation, Inc.
+# Copyright (C) 1992, 1996 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -27,9 +27,9 @@ set prms_id 0
 set bug_id 0
 
 set testfile "recurse"
-set srcfile ${srcdir}/$subdir/${testfile}.c
+set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
-if  { [compile "${srcfile} -g -o ${binfile}"] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     perror "Couldn't compile ${srcfile}"
     return -1
 }
@@ -41,12 +41,7 @@ gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
 
-# Only enabled for some targets merely because it has not been tested 
-# elsewhere.
-if {[istarget "sparc*-*-sunos4*"] || [istarget "hppa*-*-bsd*"]} then {
-
-    # Preserve the old timeout, and set a new one that should be
-    # sufficient to avoid timing out during this test.
+proc recurse_tests {} {
 
     if [runto recurse] then {
        # First we need to step over the assignment of b, so it has a known
@@ -99,7 +94,6 @@ if {[istarget "sparc*-*-sunos4*"] || [istarget "hppa*-*-bsd*"]} then {
            "continue to recurse (a = 1)"
 
        # Continue until second set of b (second instance).
-       setup_xfail "sparc*-*-sunos4*"
        if [gdb_test "continue" \
            "Continuing.*\[Ww\]atchpoint.*: b.*Old value = 5.*New value = 120.*return.*" \
            "continue to second instance watchpoint, second time"] then { 
@@ -127,6 +121,21 @@ if {[istarget "sparc*-*-sunos4*"] || [istarget "hppa*-*-bsd*"]} then {
            return
        }
     }
+}
+
+# Only enabled for some targets merely because it has not been tested 
+# elsewhere.
+if {[istarget "sparc*-*-sunos4*"] || [istarget "hppa*-*-bsd*"] || [istarget "sparclet-*-*"] || [istarget "m32r-*-elf"]} then {
+
+    # Preserve the old timeout, and set a new one that should be
+    # sufficient to avoid timing out during this test.
+    set oldtimeout $timeout
+    set timeout [expr "$timeout + 60"]
+    verbose "Timeout is now $timeout seconds" 2
+
+    recurse_tests
 
     # Restore the preserved old timeout value.
+    set timeout $oldtimeout
+    verbose "Timeout is now $timeout seconds" 2
 }
index 620e5b605575243d96db2ff853c84027ca76ca33..612cf1e26770f3ca4db08549bcc20b91ee204c80 100644 (file)
@@ -27,9 +27,9 @@ set prms_id 0
 set bug_id 0
 
 set testfile "return"
-set srcfile ${srcdir}/$subdir/${testfile}.c
+set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
-if  { [compile "${srcfile} -g -o ${binfile}"] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     perror "Couldn't compile ${srcfile}"
     return -1
 }
@@ -39,14 +39,14 @@ proc return_tests { } {
 
 
     if { ! [ runto func1 ] } then { return 0 }
-    send "return\n"
+    send_gdb "return\n"
     expect {
        -re "Make .* return now.*y or n. $" {
-           send "y\n"
+           send_gdb "y\n"
            exp_continue
        }
        -re "func1 ..;.*$prompt $" {
-           send "step\n"
+           send_gdb "step\n"
            exp_continue
        }
     -re ".*in main after func1.*$prompt $" { pass "simple return" }
@@ -55,14 +55,14 @@ proc return_tests { } {
     }
 
     # Set breakpoints in other interesting functions.
-    send "break func2\n" ; expect -re ".*$prompt $"
-    send "break func3\n" ; expect -re ".*$prompt $"
+    gdb_test "break func2" "" "break func2"
+    gdb_test "break func3" "" "break func3"
 
-    gdb_test "continue" "return -5;"
-    send "return 5\n"
+    gdb_test "continue" "return -5;" "continue to return of -5"
+    send_gdb "return 5\n"
     expect {
        -re "Make .* return now.*y or n. $" {
-           send "y\n"
+           send_gdb "y\n"
            exp_continue
        }
     -re ".*tmp2 = func2.*$prompt $" { }
@@ -73,16 +73,16 @@ proc return_tests { } {
 
     gdb_test "p tmp2" ".* = 5" "correct value returned (integer test)"
 
-    gdb_test "continue" "return -5.0;"
-    send "return 5.0\n"
+    gdb_test "continue" "return -5.0;" "continue to return of -5.0"
+    send_gdb "return 5.0\n"
     expect {
        -re "Make .* return now.*y or n. $" {
-           send "y\n"
+           send_gdb "y\n"
            exp_continue
        }
-    -re ".*tmp3 = func3.*$prompt $" { }
-    -re "$prompt $" { fail "did not return (double test)" }
-    timeout { fail "(timeout) did not return (double test)" }
+       -re ".*tmp3 = func3.*$prompt $" { }
+       -re "$prompt $" { fail "did not return (double test)" }
+       timeout { fail "(timeout) did not return (double test)" }
     }
 
     gdb_test "next" "printf.*" "next over call to func3"
@@ -110,7 +110,7 @@ proc return_tests { } {
     # is not xfailed.
 
     setup_xfail "i*86-*-*" "sparc-*-solaris2.3*" "sparc-*-solaris2.4*"
-    gdb_test "p tmp3" ".* = 5" "correct value returned double test (known problem with i*86 and sparc solaris"
+    gdb_test "p tmp3" ".* = 5.*" "correct value returned double test (known problem with i*86 and sparc solaris"
 }
 
 
@@ -121,4 +121,5 @@ gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
 
+set timeout 30
 return_tests
index 5d3cf8f70b24ded77fd0a988d4978ad406428082..e5a4fe8797e00c2a83a71418eb0bfc7a6df1869e 100644 (file)
@@ -26,15 +26,18 @@ if $tracelevel then {
 set prms_id 0
 set bug_id 0
 
-set binfile "scope"
-set srcfile $binfile.c
-
-if ![file exists $objdir/$subdir/$binfile] then {
-    perror "$objdir/$subdir/$binfile does not exist."
-    return 0
+set testfile "scope"
+set binfile ${objdir}/${subdir}/${testfile}
+if  { [gdb_compile "${srcdir}/${subdir}/scope0.c ${srcdir}/${subdir}/scope1.c" "${binfile}" executable {debug}] != "" } {
+    perror "Couldn't compile scope0.c to object"
+    return -1
 }
 
-source gdb.base/scope0.ci
+# Create and source the file that provides information about the compiler
+# used to compile the test case.
+if [get_compiler_info ${binfile}] {
+    return -1;
+}
 
 # Test locating various things when stopped just inside main, after
 # running init().  To prevent cascading of errors, we report the
@@ -50,20 +53,20 @@ proc test_at_main {} {
 
     # skip past init.  There may be a call to __main at the start of
     # main, so the first next may only get us to the init call.
-    send "next\n"
+    send_gdb "next\n"
     expect {
        -re "$decimal.*foo \\(\\);\r\n$prompt $" {
            pass "next over init() in main"
        }
        -re "$decimal.*init \\(\\);\r\n$prompt $"\
-               { send "next\n" ; exp_continue }
+               { send_gdb "next\n" ; exp_continue }
        -re "$prompt $" { fail "next over init() in main" ; return }
        timeout { fail "(timeout) next over init() in main" ; return }
     }
 
     # Print scope0.c::filelocal, which is 1
 
-    send "print filelocal\n"
+    send_gdb "print filelocal\n"
     expect {
        -re "\\\$$decimal = 1\r\n$prompt $" { pass "print filelocal" }
        -re "$prompt $" { fail "print filelocal" ; return }
@@ -72,13 +75,13 @@ proc test_at_main {} {
        }
     }
 
-    send "print 'scope0.c'::filelocal\n"
+    send_gdb "print 'scope0.c'::filelocal\n"
     expect {
        -re "\\\$$decimal = 1\r\n$prompt $" {
            pass "print 'scope0.c'::filelocal at main"
        }
        -re "No symbol \"scope0.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope0.c'::filelocal\n"
+           send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal\n"
            exp_continue
        }
        -re "$prompt $" { fail "print 'scope0.c'::filelocal at main" ; return }
@@ -89,7 +92,7 @@ proc test_at_main {} {
 
     # Print scope0.c::filelocal_bss, which is 101
 
-    send "print filelocal_bss\n"
+    send_gdb "print filelocal_bss\n"
     expect {
        -re "\\\$$decimal = 101\r\n$prompt $" {
            pass "print filelocal_bss"
@@ -100,13 +103,13 @@ proc test_at_main {} {
        }
     }
 
-    send "print 'scope0.c'::filelocal_bss\n"
+    send_gdb "print 'scope0.c'::filelocal_bss\n"
     expect {
        -re "\\\$$decimal = 101\r\n$prompt $" {
            pass "print 'scope0.c'::filelocal_bss in test_at_main"
        }
        -re "No symbol \"scope0.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope0.c'::filelocal_bss\n"
+           send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal_bss\n"
            exp_continue
        }
        -re "$prompt $" { 
@@ -123,7 +126,7 @@ proc test_at_main {} {
     # No clue why the powerpc fails this test.
     setup_xfail "powerpc-*-*"
     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    send "print filelocal_ro\n"
+    send_gdb "print filelocal_ro\n"
     expect {
        -re "\\\$$decimal = 201\r\n$prompt $" {
            pass "print filelocal_ro in test_at_main"
@@ -140,13 +143,13 @@ proc test_at_main {} {
 
     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
     setup_xfail "powerpc-*-*"
-    send "print 'scope0.c'::filelocal_ro\n"
+    send_gdb "print 'scope0.c'::filelocal_ro\n"
     expect {
        -re "\\\$$decimal = 201\r\n$prompt $" {
            pass "print 'scope0.c'::filelocal_ro"
        }
        -re "No symbol \"scope0.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope0.c'::filelocal_ro\n"
+           send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal_ro\n"
            exp_continue
        }
        -re "$prompt $" { fail "print 'scope0.c'::filelocal_ro" ; return }
@@ -158,13 +161,13 @@ proc test_at_main {} {
     # Print scope1.c::filelocal, which is 2
 
     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    send "print 'scope1.c'::filelocal\n"
+    send_gdb "print 'scope1.c'::filelocal\n"
     expect {
        -re "\\\$$decimal = 2\r\n$prompt $" {
            pass "print 'scope1.c'::filelocal"
        }
        -re "No symbol \"scope1.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope1.c'::filelocal\n"
+           send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal\n"
            exp_continue
        }
        -re "$prompt $" { fail "print 'scope1.c'::filelocal" ; return }
@@ -176,13 +179,13 @@ proc test_at_main {} {
     # Print scope1.c::filelocal_bss, which is 102
 
     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    send "print 'scope1.c'::filelocal_bss\n"
+    send_gdb "print 'scope1.c'::filelocal_bss\n"
     expect {
        -re "\\\$$decimal = 102\r\n$prompt $" {
            pass "print 'scope1.c'::filelocal_bss"
        }
        -re "No symbol \"scope1.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope1.c'::filelocal_bss\n"
+           send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal_bss\n"
            exp_continue
        }
        -re "$prompt $" { fail "print 'scope1.c'::filelocal_bss" ; return }
@@ -194,13 +197,13 @@ proc test_at_main {} {
     # Print scope1.c::filelocal_ro, which is 202
 
     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    send "print 'scope1.c'::filelocal_ro\n"
+    send_gdb "print 'scope1.c'::filelocal_ro\n"
     expect {
        -re "\\\$$decimal = 202\r\n$prompt $" {
            pass "print 'scope1.c'::filelocal_ro"
        }
        -re "No symbol \"scope1.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope1.c'::filelocal_ro\n"
+           send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal_ro\n"
            exp_continue
        }
        -re "$prompt " {fail "print 'scope1.c'::filelocal_ro" ; return }
@@ -211,7 +214,8 @@ proc test_at_main {} {
 
     # Print scope1.c::foo::funclocal, which is 3
 
-    send "print foo::funclocal\n"
+    if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
+    send_gdb "print foo::funclocal\n"
     expect {
        -re "\\\$$decimal = 3\r\n$prompt $" { pass "print foo::funclocal" }
        -re "$prompt $" { fail "print foo::funclocal" ; return }
@@ -221,13 +225,13 @@ proc test_at_main {} {
     }
 
     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    send "print 'scope1.c'::foo::funclocal\n"
+    send_gdb "print 'scope1.c'::foo::funclocal\n"
     expect {
        -re "\\\$$decimal = 3\r\n$prompt $" {
            pass "print 'scope1.c'::foo::funclocal"
        }
        -re "No symbol \"scope1.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope1.c'::foo::funclocal\n"
+           send_gdb "print '$srcdir/$subdir/scope1.c'::foo::funclocal\n"
            exp_continue
        }
        -re "$prompt $" { fail "print 'scope1.c'::foo::funclocal" ; return }
@@ -238,7 +242,7 @@ proc test_at_main {} {
 
     # Print scope1.c::foo::funclocal_ro, which is 203
 
-    send "print foo::funclocal_ro\n"
+    send_gdb "print foo::funclocal_ro\n"
     expect {
        -re "\\\$$decimal = 203\r\n$prompt $" {
            pass "print foo::funclocal_ro"
@@ -250,12 +254,12 @@ proc test_at_main {} {
     }
 
     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    send "print 'scope1.c'::foo::funclocal_ro\n"
+    send_gdb "print 'scope1.c'::foo::funclocal_ro\n"
     expect {
        -re "\\\$$decimal = 203\r\n$prompt $" {
            pass "print 'scope1.c'::foo::funclocal_ro" }
        -re "No symbol \"scope1.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro\n"
+           send_gdb "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro\n"
            exp_continue
        }
        -re "$prompt $" { fail "print 'scope1.c'::foo::funclocal_ro" ; return }
@@ -266,7 +270,7 @@ proc test_at_main {} {
 
     # Print scope1.c::bar::funclocal, which is 4
 
-    send "print bar::funclocal\n"
+    send_gdb "print bar::funclocal\n"
     expect {
        -re "\\\$$decimal = 4\r\n$prompt $" { pass "print bar::funclocal" }
        -re "$prompt $" { fail "print bar::funclocal" ; return }
@@ -276,18 +280,18 @@ proc test_at_main {} {
     }
 
     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    send "print 'scope1.c'::bar::funclocal\n"
+    send_gdb "print 'scope1.c'::bar::funclocal\n"
     expect {
        -re "\\\$$decimal = 4\r\n$prompt $" {
            pass "print 'scope1.c'::bar::funclocal"
        }
        -re "No symbol \"scope1.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope1.c'::bar::funclocal\n"
+           send_gdb "print '$srcdir/$subdir/scope1.c'::bar::funclocal\n"
            exp_continue
        }
        -re "$prompt $" { fail "print 'scope1.c'::bar::funclocal" ; return }
        timeout {
-           fail "print 'scope1.c'::bar::funclocal" ; return
+           fail "(timeout) print 'scope1.c'::bar::funclocal" ; return
        }
     }
 }
@@ -300,7 +304,7 @@ proc test_at_foo {} {
     global subdir
     global gcc_compiled
 
-    send "next\n"
+    send_gdb "next\n"
     expect {
        -re ".*bar \\(\\);\r\n$prompt $" {}
        -re "$prompt $" { fail "continue to foo()" ; return }
@@ -309,13 +313,13 @@ proc test_at_foo {} {
 
     # Print scope0.c::filelocal, which is 1
 
-    send "print 'scope0.c'::filelocal\n"
+    send_gdb "print 'scope0.c'::filelocal\n"
     expect {
        -re "\\\$$decimal = 1\r\n$prompt $" {
            pass "print 'scope0.c'::filelocal at foo"
        }
        -re "No symbol \"scope0.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope0.c'::filelocal\n"
+           send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal\n"
            exp_continue
        }
        -re "$prompt $" { fail "print 'scope0.c'::filelocal at foo" ; return }
@@ -326,13 +330,13 @@ proc test_at_foo {} {
 
     # Print scope0.c::filelocal_bss, which is 101
 
-    send "print 'scope0.c'::filelocal_bss\n"
+    send_gdb "print 'scope0.c'::filelocal_bss\n"
     expect {
        -re "\\\$$decimal = 101\r\n$prompt $" {
            pass "print 'scope0.c'::filelocal_bss in test_at_foo"
        }
        -re "No symbol \"scope0.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope0.c'::filelocal_bss\n"
+           send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal_bss\n"
            exp_continue
        }
        -re "$prompt $" {
@@ -349,11 +353,11 @@ proc test_at_foo {} {
 
     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
     setup_xfail "powerpc-*-*"
-    send "print 'scope0.c'::filelocal_ro\n"
+    send_gdb "print 'scope0.c'::filelocal_ro\n"
     expect {
        -re "\\\$$decimal = 201\r\n$prompt $" { pass "print 'scope0.c'::filelocal_ro" }
        -re "No symbol \"scope0.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope0.c'::filelocal_ro\n"
+           send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal_ro\n"
            exp_continue
        }
        -re "$prompt $" { fail "print 'scope0.c'::filelocal_ro" ; return }
@@ -367,13 +371,13 @@ proc test_at_foo {} {
     # Print scope1.c::filelocal, which is 2
 
     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    send "print 'scope1.c'::filelocal\n"
+    send_gdb "print 'scope1.c'::filelocal\n"
     expect {
        -re "\\\$$decimal = 2\r\n$prompt $" {
            pass "print 'scope1.c'::filelocal at foo"
        }
        -re "No symbol \"scope1.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope1.c'::filelocal\n"
+           send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal\n"
            exp_continue
        }
        -re "$prompt $" { fail "print 'scope1.c'::filelocal at foo" ; return }
@@ -386,13 +390,13 @@ proc test_at_foo {} {
        "print filelocal_bss at foo"
 
     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    send "print 'scope1.c'::filelocal_bss\n"
+    send_gdb "print 'scope1.c'::filelocal_bss\n"
     expect {
        -re "\\\$$decimal = 102\r\n$prompt $" {
            pass "print 'scope1.c'::filelocal_bss at foo"
        }
        -re "No symbol \"scope1.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope1.c'::filelocal_bss\n"
+           send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal_bss\n"
            exp_continue
        }
        -re "$prompt $" { fail "print 'scope1.c'::filelocal_bss at foo" }
@@ -405,11 +409,11 @@ proc test_at_foo {} {
        "print filelocal_ro at foo"
 
     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    send "print 'scope1.c'::filelocal_ro\n"
+    send_gdb "print 'scope1.c'::filelocal_ro\n"
     expect {
        -re "\\\$$decimal = 202\r\n$prompt $" { pass "print 'scope1.c'::filelocal_ro at foo" }
        -re "No symbol \"scope1.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope1.c'::filelocal_ro\n"
+           send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal_ro\n"
            exp_continue
        }
        -re "$prompt $" { fail "print 'scope1.c'::filelocal_ro at foo" }
@@ -422,17 +426,19 @@ proc test_at_foo {} {
 
     gdb_test "print funclocal" "\\\$$decimal = 3" "print funclocal at foo"
 
+    if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
     gdb_test "print foo::funclocal" "\\\$$decimal = 3" \
        "print foo::funclocal at foo"
 
     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    send "print 'scope1.c'::foo::funclocal\n"
+    if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
+    send_gdb "print 'scope1.c'::foo::funclocal\n"
     expect {
        -re "\\\$$decimal = 3\r\n$prompt $" {
            pass "print 'scope1.c'::foo::funclocal at foo"
        }
        -re "No symbol \"scope1.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope1.c'::foo::funclocal\n"
+           send_gdb "print '$srcdir/$subdir/scope1.c'::foo::funclocal\n"
            exp_continue
        }
        -re "$prompt $" { fail "print 'scope1.c'::foo::funclocal at foo" }
@@ -446,17 +452,19 @@ proc test_at_foo {} {
     gdb_test "print funclocal_bss" "\\\$$decimal = 103" \
        "print funclocal_bss at foo"
 
+    if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
     gdb_test "print foo::funclocal_bss" "\\\$$decimal = 103" \
        "print foo::funclocal_bss at foo"
 
     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    send "print 'scope1.c'::foo::funclocal_bss\n"
+    if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
+    send_gdb "print 'scope1.c'::foo::funclocal_bss\n"
     expect {
        -re "\\\$$decimal = 103\r\n$prompt $" {
            pass "print 'scope1.c'::foo::funclocal_bss at foo"
        }
        -re "No symbol \"scope1.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss\n"
+           send_gdb "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss\n"
            exp_continue
        }
        -re "$prompt $" {
@@ -472,17 +480,19 @@ proc test_at_foo {} {
     gdb_test "print funclocal_ro" "\\\$$decimal = 203" \
        "print funclocal_ro at foo"
 
+    if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
     gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" \
        "print foo::funclocal_ro at foo"
 
     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    send "print 'scope1.c'::foo::funclocal_ro\n"
+    if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
+    send_gdb "print 'scope1.c'::foo::funclocal_ro\n"
     expect {
        -re "\\\$$decimal = 203\r\n$prompt $" {
            pass "print 'scope1.c'::foo::funclocal_ro at foo"
        }
        -re "No symbol \"scope1.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro\n"
+           send_gdb "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro\n"
            exp_continue
        }
        -re "$prompt $" { fail "print 'scope1.c'::foo::funclocal_ro at foo" }
@@ -493,17 +503,19 @@ proc test_at_foo {} {
 
     # Print scope1.c::bar::funclocal, which is 4
 
+    if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
     gdb_test "print bar::funclocal" "\\\$$decimal = 4" \
        "print bar::funclocal at foo"
 
     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    send "print 'scope1.c'::bar::funclocal\n"
+    if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
+    send_gdb "print 'scope1.c'::bar::funclocal\n"
     expect {
        -re "\\\$$decimal = 4\r\n$prompt $" {
            pass "print 'scope1.c'::bar::funclocal at foo"
        }
        -re "No symbol \"scope1.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope1.c'::bar::funclocal\n"
+           send_gdb "print '$srcdir/$subdir/scope1.c'::bar::funclocal\n"
            exp_continue
        }
        -re "$prompt $" { fail "print 'scope1.c'::bar::funclocal at foo" }
@@ -521,24 +533,26 @@ proc test_at_bar {} {
     global subdir
     global gcc_compiled
 
-    send "next\n"
+    send_gdb "next\n"
     expect {
        -re ".*$prompt $" {}
-       timeout { fail "next in bar()" ; return }
+       timeout { fail "(timeout) next in bar()" ; return }
     }
 
     # Print scope0.c::filelocal, which is 1
 
-    send "print 'scope0.c'::filelocal\n"
+    send_gdb "print 'scope0.c'::filelocal\n"
     expect {
        -re "\\\$$decimal = 1\r\n$prompt $" {
            pass "print 'scope0.c'::filelocal at bar"
        }
        -re "No symbol \"scope0.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope0.c'::filelocal\n"
+           send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal\n"
            exp_continue
        }
-       -re "$prompt $" { fail "print 'scope0.c'::filelocal at bar" ; return }
+       -re "$prompt $" {
+           fail "print 'scope0.c'::filelocal at bar" ; return
+       }
        timeout {
            fail "(timeout) print 'scope0.c'::filelocal at bar" ; return
        }
@@ -546,13 +560,13 @@ proc test_at_bar {} {
 
    # Print scope0.c::filelocal_bss, which is 101
 
-    send "print 'scope0.c'::filelocal_bss\n"
+    send_gdb "print 'scope0.c'::filelocal_bss\n"
     expect {
        -re "\\\$$decimal = 101\r\n$prompt $" {
            pass "print 'scope0.c'::filelocal_bss in test_at_bar"
        }
        -re "No symbol \"scope0.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope0.c'::filelocal_bss\n"
+           send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal_bss\n"
            exp_continue
        }
        -re "$prompt $" {
@@ -569,72 +583,92 @@ proc test_at_bar {} {
 
     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
     setup_xfail "powerpc-*-*"
-    send "print 'scope0.c'::filelocal_ro\n"
+    send_gdb "print 'scope0.c'::filelocal_ro\n"
     expect {
-       -re "\\\$$decimal = 201\r\n$prompt $" { pass "print 'scope0.c'::filelocal_ro" }
+       -re "\\\$$decimal = 201\r\n$prompt $" {
+           pass "print 'scope0.c'::filelocal_ro at bar"
+       }
        -re "No symbol \"scope0.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope0.c'::filelocal_ro\n"
+           send_gdb "print '$srcdir/$subdir/scope0.c'::filelocal_ro\n"
            exp_continue
        }
-       -re "$prompt $" { fail "print 'scope0.c'::filelocal_ro" ; return }
+       -re "$prompt $" {
+           fail "print 'scope0.c'::filelocal_ro at bar" ; return
+       }
        timeout {
-           fail "(timeout) print 'scope0.c'::filelocal_ro" ; return
+           fail "(timeout) print 'scope0.c'::filelocal_ro at bar" ; return
        }
     }
 
     # Print scope1.c::filelocal, which is 2
 
-    send "print filelocal\n"
+    send_gdb "print filelocal\n"
     expect {
-       -re "\\\$$decimal = 2\r\n$prompt $" { pass "print filelocal" }
-       -re "$prompt $" { fail "print filelocal" ; return }
+       -re "\\\$$decimal = 2\r\n$prompt $" {
+           pass "print filelocal at bar"
+       }
+       -re "$prompt $" {
+           fail "print filelocal at bar" ; return
+       }
        timeout {
-           fail "(timeout) print filelocal" ; return
+           fail "(timeout) print filelocal at bar" ; return
        }
     }
 
     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    send "print 'scope1.c'::filelocal\n"
+    send_gdb "print 'scope1.c'::filelocal\n"
     expect {
-       -re "\\\$$decimal = 2\r\n$prompt $" { pass "print 'scope1.c'::filelocal" }
+       -re "\\\$$decimal = 2\r\n$prompt $" {
+           pass "print 'scope1.c'::filelocal at bar"
+       }
        -re "No symbol \"scope1.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope1.c'::filelocal\n"
+           send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal\n"
            exp_continue
        }
-       -re "$prompt $" { fail "print 'scope1.c'::filelocal" ; return }
+       -re "$prompt $" {
+           fail "print 'scope1.c'::filelocal at bar" ; return
+       }
        timeout {
-           fail "(timeout) print 'scope1.c'::filelocal" ; return
+           fail "(timeout) print 'scope1.c'::filelocal at bar" ; return
        }
     }
 
     # Print scope1.c::filelocal_bss, which is 102
 
-    send "print filelocal_bss\n"
+    send_gdb "print filelocal_bss\n"
     expect {
-       -re "\\\$$decimal = 102\r\n$prompt $" { pass "print filelocal_bss" }
-       -re "$prompt $" { fail "print filelocal_bss" ; return }
+       -re "\\\$$decimal = 102\r\n$prompt $" {
+           pass "print filelocal_bss at bar"
+       }
+       -re "$prompt $" {
+           fail "print filelocal_bss at bar" ; return
+       }
        timeout {
-           fail "(timeout) print filelocal_bss" ; return
+           fail "(timeout) print filelocal_bss at bar" ; return
        }
     }
 
     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    send "print 'scope1.c'::filelocal_bss\n"
+    send_gdb "print 'scope1.c'::filelocal_bss\n"
     expect {
-       -re "\\\$$decimal = 102\r\n$prompt $" { pass "print 'scope1.c'::filelocal_bss" }
+       -re "\\\$$decimal = 102\r\n$prompt $" {
+           pass "print 'scope1.c'::filelocal_bss at bar"
+       }
        -re "No symbol \"scope1.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope1.c'::filelocal_bss\n"
+           send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal_bss\n"
            exp_continue
        }
-       -re "$prompt $" { fail "print 'scope1.c'::filelocal_bss" ; return }
+       -re "$prompt $" {
+           fail "print 'scope1.c'::filelocal_bss at bar" ; return
+       }
        timeout {
-           fail "(timeout) print 'scope1.c'::filelocal_bss" ; return
+           fail "(timeout) print 'scope1.c'::filelocal_bss at bar" ; return
        }
     }
 
     # Print scope1.c::filelocal_ro, which is 202
 
-    send "print filelocal_ro\n"
+    send_gdb "print filelocal_ro\n"
     expect {
        -re "\\\$$decimal = 202\r\n$prompt $" {
            pass "print filelocal_ro in test_at_bar"
@@ -650,159 +684,212 @@ proc test_at_bar {} {
     }
 
     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    send "print 'scope1.c'::filelocal_ro\n"
+    send_gdb "print 'scope1.c'::filelocal_ro\n"
     expect {
-       -re "\\\$$decimal = 202\r\n$prompt $" { pass "print 'scope1.c'::filelocal_ro" }
+       -re "\\\$$decimal = 202\r\n$prompt $" {
+           pass "print 'scope1.c'::filelocal_ro at bar"
+       }
        -re "No symbol \"scope1.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope1.c'::filelocal_ro\n"
+           send_gdb "print '$srcdir/$subdir/scope1.c'::filelocal_ro\n"
            exp_continue
        }
-       -re "$prompt $" { fail "print 'scope1.c'::filelocal_ro" ; return }
+       -re "$prompt $" {
+           fail "print 'scope1.c'::filelocal_ro at bar" ; return
+       }
        timeout {
-           fail "(timeout) print 'scope1.c'::filelocal_ro" ; return
+           fail "(timeout) print 'scope1.c'::filelocal_ro at bar" ; return
        }
     }
 
     # Print scope1.c::foo::funclocal, which is 3
 
-    send "print foo::funclocal\n"
+    if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
+    send_gdb "print foo::funclocal\n"
     expect {
-       -re "\\\$$decimal = 3\r\n$prompt $" { pass "print foo::funclocal" }
-       -re "$prompt $" { fail "print foo::funclocal" ; return }
+       -re "\\\$$decimal = 3\r\n$prompt $" {
+           pass "print foo::funclocal at bar"
+       }
+       -re "$prompt $" {
+           fail "print foo::funclocal at bar" ; return
+       }
        timeout {
-           fail "(timeout) print foo::funclocal" ; return
+           fail "(timeout) print foo::funclocal at bar" ; return
        }
     }
 
     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    send "print 'scope1.c'::foo::funclocal\n"
+    send_gdb "print 'scope1.c'::foo::funclocal\n"
     expect {
-       -re "\\\$$decimal = 3\r\n$prompt $" { pass "print 'scope1.c'::foo::funclocal" }
+       -re "\\\$$decimal = 3\r\n$prompt $" {
+           pass "print 'scope1.c'::foo::funclocal at bar"
+       }
        -re "No symbol \"scope1.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope1.c'::foo::funclocal\n"
+           send_gdb "print '$srcdir/$subdir/scope1.c'::foo::funclocal\n"
            exp_continue
        }
-       -re "$prompt $" { fail "print 'scope1.c'::foo::funclocal" ; return }
+       -re "$prompt $" {
+           fail "print 'scope1.c'::foo::funclocal at bar" ; return
+       }
        timeout {
-           fail "(timeout) print 'scope1.c'::foo::funclocal" ; return
+           fail "(timeout) print 'scope1.c'::foo::funclocal at bar" ; return
        }
     }
 
     # Print scope1.c::foo::funclocal_bss, which is 103
 
-    send "print foo::funclocal_bss\n"
+    send_gdb "print foo::funclocal_bss\n"
     expect {
-       -re "\\\$$decimal = 103\r\n$prompt $" { pass "print foo::funclocal_bss" }
-       -re "$prompt $" { fail "print foo::funclocal_bss" ; return }
+       -re "\\\$$decimal = 103\r\n$prompt $" {
+           pass "print foo::funclocal_bss at bar"
+       }
+       -re "$prompt $" {
+           fail "print foo::funclocal_bss at bar" ; return
+       }
        timeout {
-           fail "(timeout) print foo::funclocal_bss" ; return
+           fail "(timeout) print foo::funclocal_bss at bar" ; return
        }
     }
 
     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    send "print 'scope1.c'::foo::funclocal_bss\n"
+    send_gdb "print 'scope1.c'::foo::funclocal_bss\n"
     expect {
-       -re "\\\$$decimal = 103\r\n$prompt $" { pass "print 'scope1.c'::foo::funclocal_bss" }
+       -re "\\\$$decimal = 103\r\n$prompt $" {
+           pass "print 'scope1.c'::foo::funclocal_bss at bar"
+       }
        -re "No symbol \"scope1.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss\n"
+           send_gdb "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss\n"
            exp_continue
        }
-       -re "$prompt $" { fail "print 'scope1.c'::foo::funclocal_bss" ; return }
+       -re "$prompt $" {
+           fail "print 'scope1.c'::foo::funclocal_bss at bar" ; return
+       }
        timeout {
-           fail "(timeout) print 'scope1.c'::foo::funclocal_bss" ; return
+           fail "(timeout) print 'scope1.c'::foo::funclocal_bss at bar" ; return
        }
     }
 
     # Print scope1.c::foo::funclocal_ro, which is 203
 
-    send "print foo::funclocal_ro\n"
+    send_gdb "print foo::funclocal_ro\n"
     expect {
-       -re "\\\$$decimal = 203\r\n$prompt $" { pass "print foo::funclocal_ro" }
-       -re "$prompt $" { fail "print foo::funclocal_ro" ; return }
+       -re "\\\$$decimal = 203\r\n$prompt $" {
+           pass "print foo::funclocal_ro at bar"
+       }
+       -re "$prompt $" {
+           fail "print foo::funclocal_ro at bar" ; return
+       }
        timeout {
-           fail "(timeout) print foo::funclocal_ro" ; return
+           fail "(timeout) print foo::funclocal_ro at bar" ; return
        }
     }
 
     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    send "print 'scope1.c'::foo::funclocal_ro\n"
+    send_gdb "print 'scope1.c'::foo::funclocal_ro\n"
     expect {
-       -re "\\\$$decimal = 203\r\n$prompt $" { pass "print 'scope1.c'::foo::funclocal_ro" }
+       -re "\\\$$decimal = 203\r\n$prompt $" {
+           pass "print 'scope1.c'::foo::funclocal_ro at bar"
+       }
        -re "No symbol \"scope1.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro\n"
+           send_gdb "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro\n"
            exp_continue
        }
-       -re "$prompt $" { fail "print 'scope1.c'::foo::funclocal_ro" ; return }
+       -re "$prompt $" {
+           fail "print 'scope1.c'::foo::funclocal_ro at bar" ; return
+       }
        timeout {
-           fail "(timeout) print 'scope1.c'::foo::funclocal_ro" ; return
+           fail "(timeout) print 'scope1.c'::foo::funclocal_ro at bar" ; return
        }
     }
 
     # Print scope1.c::bar::funclocal, which is 4
 
-    send "print funclocal\n"
+    send_gdb "print funclocal\n"
     expect {
-       -re "\\\$$decimal = 4\r\n$prompt $" { pass "print funclocal" }
-       -re "$prompt $" { fail "print funclocal" ; return }
+       -re "\\\$$decimal = 4\r\n$prompt $" {
+           pass "print funclocal at bar"
+       }
+       -re "$prompt $" {
+           fail "print funclocal at bar" ; return
+       }
        timeout {
-           fail "(timeout) print funclocal" ; return
+           fail "(timeout) print funclocal at bar" ; return
        }
     }
 
-    send "print bar::funclocal\n"
+    send_gdb "print bar::funclocal\n"
     expect {
-       -re "\\\$$decimal = 4\r\n$prompt $" { pass "print bar::funclocal" }
-       -re "$prompt $" { fail "print bar::funclocal" ; return }
+       -re "\\\$$decimal = 4\r\n$prompt $" {
+           pass "print bar::funclocal at bar"
+       }
+       -re "$prompt $" {
+           fail "print bar::funclocal at bar" ; return
+       }
        timeout {
-           fail "(timeout) print bar::funclocal" ; return
+           fail "(timeout) print bar::funclocal at bar" ; return
        }
     }
 
     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    send "print 'scope1.c'::bar::funclocal\n"
+    send_gdb "print 'scope1.c'::bar::funclocal\n"
     expect {
-       -re "\\\$$decimal = 4\r\n$prompt $" { pass "print 'scope1.c'::bar::funclocal" }
+       -re "\\\$$decimal = 4\r\n$prompt $" {
+           pass "print 'scope1.c'::bar::funclocal at bar"
+       }
        -re "No symbol \"scope1.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope1.c'::bar::funclocal\n"
+           send_gdb "print '$srcdir/$subdir/scope1.c'::bar::funclocal\n"
            exp_continue
        }
-       -re "$prompt $" { fail "print 'scope1.c'::bar::funclocal" ; return }
+       -re "$prompt $" {
+           fail "print 'scope1.c'::bar::funclocal at bar" ; return
+       }
        timeout {
-           fail "(timeout) print 'scope1.c'::bar::funclocal" ; return
+           fail "(timeout) print 'scope1.c'::bar::funclocal at bar" ; return
        }
     }
 
     # Print scope1.c::bar::funclocal_bss, which is 104
 
-    send "print funclocal_bss\n"
+    send_gdb "print funclocal_bss\n"
     expect {
-       -re "\\\$$decimal = 104\r\n$prompt $" { pass "print funclocal_bss" }
-       -re "$prompt $" { fail "print funclocal_bss" ; return }
+       -re "\\\$$decimal = 104\r\n$prompt $" {
+           pass "print funclocal_bss at bar"
+       }
+       -re "$prompt $" {
+           fail "print funclocal_bss at bar" ; return
+       }
        timeout {
-           fail "(timeout) print funclocal_bss" ; return
+           fail "(timeout) print funclocal_bss at bar" ; return
        }
     }
 
-    send "print bar::funclocal_bss\n"
+    send_gdb "print bar::funclocal_bss\n"
     expect {
-       -re "\\\$$decimal = 104\r\n$prompt $" { pass "print bar::funclocal_bss" }
-       -re "$prompt $" { fail "print bar::funclocal_bss" ; return }
+       -re "\\\$$decimal = 104\r\n$prompt $" {
+           pass "print bar::funclocal_bss at bar"
+       }
+       -re "$prompt $" {
+           fail "print bar::funclocal_bss at bar" ; return
+       }
        timeout {
-           fail "(timeout) print bar::funclocal_bss" ; return
+           fail "(timeout) print bar::funclocal_bss at bar" ; return
        }
     }
 
     if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    send "print 'scope1.c'::bar::funclocal_bss\n"
+    send_gdb "print 'scope1.c'::bar::funclocal_bss\n"
     expect {
-       -re "\\\$$decimal = 104\r\n$prompt $" { pass "print 'scope1.c'::bar::funclocal_bss" }
+       -re "\\\$$decimal = 104\r\n$prompt $" {
+           pass "print 'scope1.c'::bar::funclocal_bss at bar"
+       }
        -re "No symbol \"scope1.c\" in current context.*$prompt $" {
-           send "print '$srcdir/$subdir/scope1.c'::bar::funclocal_bss\n"
+           send_gdb "print '$srcdir/$subdir/scope1.c'::bar::funclocal_bss\n"
            exp_continue
        }
-       -re "$prompt $" { fail "print 'scope1.c'::bar::funclocal_bss" ; return }
+       -re "$prompt $" {
+           fail "print 'scope1.c'::bar::funclocal_bss at bar" ; return
+       }
        timeout {
-           fail "(timeout) print 'scope1.c'::bar::funclocal_bss" ; return
+           fail "(timeout) print 'scope1.c'::bar::funclocal_bss at bar" ; return
        }
     }
 }
@@ -818,15 +905,15 @@ proc test_at_autovars {} {
 
     # Test symbol table lookup with 100 local (auto) variables.
 
-    send "break marker1\n" ; expect -re ".*$prompt $"
+    send_gdb "break marker1\n" ; expect -re ".*$prompt $"
 
-    send "cont\n"
+    send_gdb "cont\n"
     expect {
        -re "Break.* marker1 \\(\\) at .*:$decimal.*$prompt $" {
-           send "up\n"
+           send_gdb "up\n"
            expect {
                -re ".*$prompt $" {}
-               timeout { fail "up from marker1" ; return }
+               timeout { fail "(timeout) up from marker1" ; return }
            }
        }
        -re "$prompt $" { fail "continue to marker1" ; return }
@@ -835,7 +922,7 @@ proc test_at_autovars {} {
 
     set count 0
     while {$count < 100} {
-       send "print i$count\n"
+       send_gdb "print i$count\n"
        expect {
            -re ".* = $count\r\n$prompt $" {}
            -re "$prompt $" {
@@ -860,17 +947,17 @@ proc test_at_localscopes {} {
     global hex
     global srcfile
 
-    send "break marker2\n" ; expect -re ".*$prompt $"
-    send "break marker3\n" ; expect -re ".*$prompt $"
-    send "break marker4\n" ; expect -re ".*$prompt $"
+    send_gdb "break marker2\n" ; expect -re ".*$prompt $"
+    send_gdb "break marker3\n" ; expect -re ".*$prompt $"
+    send_gdb "break marker4\n" ; expect -re ".*$prompt $"
 
-    send "cont\n"
+    send_gdb "cont\n"
     expect {
        -re "Break.* marker2 \\(\\) at .*:$decimal.*$prompt $" {
-           send "up\n"
+           send_gdb "up\n"
            expect {
                -re ".*$prompt $" {}
-               timeout { fail "up from marker2" ; return }
+               timeout { fail "(timeout) up from marker2" ; return }
            }
        }
        -re "$prompt $" { fail "continue to marker2" ; return }
@@ -917,10 +1004,11 @@ proc test_at_localscopes {} {
 gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
-gdb_load $objdir/$subdir/$binfile
+gdb_load ${binfile}
 
 if [istarget "*-*-vxworks*"] {
     set timeout 120
+    verbose "Timeout is now $timeout seconds" 2
 }
 
 # Test that variables in various segments print out correctly before
@@ -940,8 +1028,7 @@ gdb_test "print 'scope0.c'::filelocal_ro" "= 201"
 # so we actually read memory from the board.  Problem is crt0.o
 # is responsible for clearing bss and that hasnt' happened yet.
 setup_xfail "hppa*-*-*pro*"
-if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-send "print 'scope0.c'::filelocal_bss\n"
+send_gdb "print 'scope0.c'::filelocal_bss\n"
 expect {
     -re " = 0\r\n$prompt $" {
        pass "print 'scope0.c'::filelocal_bss before run"
@@ -958,9 +1045,6 @@ expect {
     }
 }
 
-# AIX--sections get mapped to the same address so we can't get the right one.
-setup_xfail "rs6000-*-*"
-
 gdb_test "print 'scope0.c'::filelocal" "= 1" \
     "print 'scope0.c'::filelocal before run"
 
@@ -970,7 +1054,7 @@ if [istarget "mips-idt-*"] then {
     gdb_exit
     gdb_start
     gdb_reinitialize_dir $srcdir/$subdir
-    gdb_load $objdir/$subdir/$binfile
+    gdb_load ${binfile}
 }
 if [runto foo] then { test_at_foo }
 if [istarget "mips-idt-*"] then {
@@ -978,7 +1062,7 @@ if [istarget "mips-idt-*"] then {
     gdb_exit
     gdb_start
     gdb_reinitialize_dir $srcdir/$subdir
-    gdb_load $objdir/$subdir/$binfile
+    gdb_load ${binfile}
 }
 if [runto bar] then { test_at_bar }
 if [istarget "mips-idt-*"] then {
@@ -986,7 +1070,7 @@ if [istarget "mips-idt-*"] then {
     gdb_exit
     gdb_start
     gdb_reinitialize_dir $srcdir/$subdir
-    gdb_load $objdir/$subdir/$binfile
+    gdb_load ${binfile}
 }
 if [runto localscopes] then { test_at_localscopes }
 if [istarget "mips-idt-*"] then {
@@ -994,10 +1078,11 @@ if [istarget "mips-idt-*"] then {
     gdb_exit
     gdb_start
     gdb_reinitialize_dir $srcdir/$subdir
-    gdb_load $objdir/$subdir/$binfile
+    gdb_load ${binfile}
 }
 if [runto autovars] then { test_at_autovars }
 
 if [istarget "*-*-vxworks*"] {
     set timeout 120
+    verbose "Timeout is now $timeout seconds" 2
 }
diff --git a/gdb/testsuite/gdb.base/setshow.exp b/gdb/testsuite/gdb.base/setshow.exp
new file mode 100644 (file)
index 0000000..c0ce98f
--- /dev/null
@@ -0,0 +1,231 @@
+# Copyright (C) 1992, 1994 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 Michael Snyder (msnyder@cygnus.com)
+
+if $tracelevel then {
+       strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile "setshow"
+set srcfile ${srcdir}/${subdir}/${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if { [gdb_compile ${srcfile} ${binfile} executable {debug}] != "" } {
+    perror "Couldn't compile ${srcfile}"
+    return -1
+}
+
+# Start with a fresh gdb
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+#
+# Test gdb set and show commands.
+# Add tests here for show and set that don't fit neatly elsewhere.
+# FIXME: many rudimentary tests for set and show commands have been
+#        added below, but most do nothing more than check that a 
+#        variable has been set successfully, ie. they do not test
+#        whether setting the variable has had the desired effect.
+#
+
+#test default annotation_level is 0
+gdb_test "show annotate" "Annotation_level is 0..*"  "default annotation_level is zero"
+
+#test set annotate 2
+send_gdb "set annotate 2\n"
+expect {
+       -re ".*\032\032pre-prompt.*$prompt .*\032\032prompt.*$" \
+                               { pass "set annotate 2" }
+       -re ".*$prompt $"       { fail "set annotate 2" }
+       timeout                 { fail "(timeout) set annotate 2" }
+    }
+
+send_gdb "show annotate\n"
+expect {
+       -re ".*\032\032post-prompt.*Annotation_level is 2..*\032\032pre-prompt.*$prompt .*\032\032prompt.*$" \
+                               { pass "show annotate (2)" }
+       -re ".*$prompt $"       { fail "show annotate (2)" }
+       timeout                 { fail "(timeout) show annotate (2)" }
+    }
+
+#test annotation_level 2
+send_gdb "info line 1\n"
+expect {
+       -re ".*\032\032post-prompt.*Line 1 of .* is at address .* but contains no code.*:1:0:beg:0x.*\032\032pre-prompt.*$prompt .*\032\032prompt.*$" \
+                               { pass "annotation_level 2" }
+       -re ".*$prompt $"       { fail "annotation_level 2" }
+       timeout                 { fail "(timeout) annotation_level 2" }
+    }
+
+#test set annotate 1
+gdb_test "set annotate 1" ".*post-prompt.*"  "set annotate 1" 
+gdb_test "show annotate" "Annotation_level is 1..*"  "show annotate (1)" 
+#test annotation_level 1
+gdb_test "info line 1" "Line 1 of .* is at address .* but contains no code.*:1:0:beg:0x.*"  "annotation_level 1" 
+#test set annotate 0
+gdb_test "set annotate 0" "" "set annotate 0" 
+gdb_test "show annotate" "Annotation_level is 0..*"  "show annotate (0)" 
+#test annotation_level 0
+gdb_test "info line 1" "Line 1 of .* is at address .* but contains no code.*"  "annotation_level 0" 
+#test set args
+gdb_test "set args foo bar blup baz bubble" "" "set args" 
+#test show args
+gdb_test "show args" "Arguments to give program being debugged when it is started is \"foo bar blup baz bubble\"..*" "show args" 
+#test passing args
+gdb_test "run" "Starting program:.*foo bar blup baz bubble.*" "passing args" 
+#test set check range on
+gdb_test "set check range on" "" "set check range on" 
+#test show check range on
+gdb_test "show check range" "Range checking is \"on\"\..*" "show check range (on)" 
+#test set check range auto
+gdb_test "set check range auto" "" "set check range auto" 
+#test show check range auto
+gdb_test "show check range" "Range checking is \"auto; currently .*" "show check range (auto)" 
+#test set check type on
+gdb_test "set check type on" "" "set check type on" 
+#test show check type on
+gdb_test "show check type" "Type checking is \"on\"..*" "show check type (on)" 
+#test set check type auto
+gdb_test "set check type auto" "" "set check type auto" 
+#test show check type
+gdb_test "show check type" "Type checking is \"auto; currently .*" "show check type (auto)" 
+#test set complaints 100
+gdb_test "set complaints 100" "" "set complaints 100" 
+#test show complaints 100
+gdb_test "show complaints" "Max number of complaints about incorrect symbols is 100..*" "show complaints (100)" 
+#test set complaints 0
+gdb_test "set complaints 0" "" "set complaints 0" 
+#test show complaints 0
+gdb_test "show complaints" "Max number of complaints about incorrect symbols is 0..*" "show complaints (0)" 
+#test set confirm off
+gdb_test "set confirm off" "" "set confirm off" 
+#test show confirm off
+gdb_test "show confirm" "Whether to confirm potentially dangerous operations is off..*" "show confirm (off)" 
+#test set confirm on
+gdb_test "set confirm on" "" "set confirm on" 
+#test show confirm on
+gdb_test "show confirm" "Whether to confirm potentially dangerous operations is on..*" "show confirm (on)" 
+#test set editing off
+gdb_test "set editing off" "" "set editing off" 
+#test show editing off
+gdb_test "show editing" "Editing of command lines as they are typed is off..*" "show editing (off)" 
+#test set editing on
+#gdb_test "set editing on" "" "set editing on" 
+#test show editing on
+#gdb_test "show editing" "Editing of command lines as they are typed is on..*" "show editing (on)" 
+#test set environment FOOBARBAZ
+gdb_test "set environment FOOBARBAZ = grbxgrbxgrbx" ""    "set environment FOOBARBAZ" 
+#test show environment FOOBARBAZ
+gdb_test "show environment FOOBARBAZ" "FOOBARBAZ = grbxgrbxgrbx.*"  "show environment FOOBARBAZ" 
+#test set height 100
+gdb_test "set height 100" "" "set height 100" 
+#test show height 100
+gdb_test "show height" "Number of lines gdb thinks are in a page is 100..*" "show height" 
+#test set history expansion on
+gdb_test "set history expansion on" "" "set history expansion on" 
+#test show history expansion on
+gdb_test "show history expansion on" "History expansion on command input is on.*" "show history expansion" 
+#test set history filename foobar.baz
+gdb_test "set history filename foobar.baz" ""    "set history filename foobar.baz" 
+#test show history filename foobar.baz
+gdb_test "show history filename" "The filename in which to record the command history is \"foobar.baz\"..*"  "show history filename (foobar.baz)" 
+#test set history save on
+gdb_test "set history save on" "" "set history save on" 
+#test show history save on
+gdb_test "show history save" "Saving of the history record on exit is on..*"  "show history save (on)" 
+#test set history size 100
+gdb_test "set history size 100" "" "set history size 100" 
+#test show history size 100
+gdb_test "show history size" "The size of the command history is 100..*" "show history size (100)" 
+#test set language asm
+gdb_test "set language asm" "" "set language asm" 
+#test show language asm
+gdb_test "show language" "The current source language is \"asm\"..*" "show language (asm)" 
+#test set language auto
+gdb_test "set language auto" "" "set language auto" 
+#test show language
+gdb_test "show language" "The current source language is \"auto\"..*" "show language (auto)" 
+#test set listsize 100
+gdb_test "set listsize 100" "" "set listsize 100" 
+#test show listsize 100
+gdb_test "show listsize" "Number of source lines gdb will list by default is 100..*" "show listsize (100)" 
+
+#test set prompt (FooBarBaz) 
+set newprompt "\\(FooBarBaz\\)"
+send_gdb "set prompt (FooBarBaz) \n"
+expect {
+       -re "$newprompt $"      { pass "set prompt (FooBarBaz) " }
+       timeout                 { fail "(timeout) set prompt (FooBarBaz) " }
+       }
+
+#test show prompt (FooBarBaz) 
+send_gdb "show prompt\n"
+expect {
+       -re "Gdb's prompt is \"$newprompt \"..* $" \
+                               { pass "show prompt (FooBarBaz) " }
+       timeout                 { fail "(timeout) show prompt (FooBarBaz) " }
+       }
+
+#test set prompt (gdb) 
+send_gdb "set prompt (gdb) \n"
+expect {
+       -re "$prompt $"         { pass "set prompt (gdb) " }
+       timeout                 { fail "(timeout) set prompt (gdb) " }
+       }
+
+#test set radix 11
+gdb_test "set radix 11" "Unsupported output radix ``decimal 11''; output radix unchanged..*"  "set radix 11" 
+#test set radix 16
+gdb_test "set radix 16" "Input and output radices now set to decimal 16, hex 10, octal 20..*"  "set radix 16" 
+#test show radix 16
+gdb_test "show radix" "Input and output radices set to decimal 16, hex 10, octal 20..*"  "show radix (16)" 
+#test set radix 10
+gdb_test "set radix" "Input and output radices now set to decimal 10, hex a, octal 12..*"  "set radix 10" 
+#test show radix 10
+gdb_test "show radix" "Input and output radices set to decimal 10, hex a, octal 12..*" "show radix (10)" 
+#test set width 90
+gdb_test "set width 90" "" "set width 90"
+#test show width 90
+gdb_test "show width" "Number of characters gdb thinks are in a line is 90..*" "show width (90)" 
+#test set write on
+# This is only supported on targets which use exec.o.
+gdb_test "set write on" ""  "set write on" 
+#test show write on
+# This is only supported on targets which use exec.o.
+gdb_test "show write" "Writing into executable and core files is on..*" "show write (on)" 
+#test set symbol-reloading on
+gdb_test "set symbol-reloading on" "" "set symbol-reloading on" 
+#test show symbol-reloading on
+gdb_test "show symbol-reloading" "Dynamic symbol table reloading multiple times in one run is on..*" "show symbol-reloading (on)" 
+#test show user
+gdb_test "show user" "" "show user" 
+#test set verbose on
+gdb_test "set verbose on" "" "set verbose on" 
+#test show verbose on
+gdb_test "show verbose" "Verbose printing of informational messages is on..*" "show verbose (on)" 
+#test set verbose off
+gdb_test "set verbose off" "" "set verbose off" 
+#test show verbose off
+gdb_test "show verbose" "Verbosity is off..*" "show verbose (off)" 
index 3a8400eec673d2d5e790e8e10b28da1db6930969..2feef72f4bd6b50386a97cc82af9ca8b123c5258 100644 (file)
@@ -31,17 +31,17 @@ set prms_id 0
 set bug_id 0
 
 set testfile "setvar"
-set srcfile ${srcdir}/$subdir/${testfile}.c
+set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
-if  { [compile "${srcfile} -g -o ${binfile}"] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     perror "Couldn't compile ${srcfile}"
     return -1
 }
 
-execute_anywhere "rm -f ${binfile}.ci"
-if  { [compile "-E ${srcdir}/${subdir}/compiler.c > ${binfile}.ci"] != "" } {
-    perror "Couldn't make ${testfile}.ci file"
-    return -1
+# Create and source the file that provides information about the compiler
+# used to compile the test case.
+if [get_compiler_info ${binfile}] {
+    return -1;
 }
 
 gdb_exit
@@ -49,12 +49,10 @@ gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load $binfile
 
-source ${binfile}.ci
-
 #
 # set it up at a breakpoint so we canplay with the variable values
 #
-send "set print sevenbit-strings\n" ; expect -re "$prompt $"
+send_gdb "set print sevenbit-strings\n" ; expect -re "$prompt $"
 
 if ![runto_main] then {
     perror "couldn't run to breakpoint"
@@ -66,7 +64,7 @@ if ![runto_main] then {
 
 set ulong_minus_1 4294967295
 set ulong_minus_456 4294966840
-send "print sizeof (unsigned long)\n"
+send_gdb "print sizeof (unsigned long)\n"
 expect {
     -re ".\[0-9\]* = 4.*$prompt $" {}
     -re ".\[0-9\]* = 8.*$prompt $" {
@@ -79,1390 +77,210 @@ expect {
     default    { fail "(timeout) getting sizeof unsigned long" }
 }
 
+proc test_set { args } {
+    global prompt
+
+    set length [expr [llength $args] - 3];
+    set print_cmd "[lindex $args $length]";
+    set print_result "[lindex $args [expr $length + 1]]";
+    set message "[lindex $args [expr $length + 2]]";
+
+    # Set up the variables.
+    for {set x 0;} {$x < $length} {incr x;} {
+       if { "[lindex $args $x]" != "" } {
+           verbose "doing [lindex $args $x]"
+           gdb_test "[lindex $args $x]" "" "$message (setting variable)"
+       }
+    }
+    verbose "expecting $print_result from '$print_cmd'"
+    # Now run the test.
+    gdb_test "$print_cmd" "$print_result" "$message";
+}
+
 #
 # test "set variable" for type "char"
 #
 # Because bare char types can be either signed or unsigned, we just test the
 # range of values that are common to both (0-127).
 #    
-send "set variable v_char=0\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_char\n"
-       expect {
-           -re ".\[0-9\]* = 0 \'.000\'.*$prompt $"       { pass "set variable char=0" }
-           -re "$prompt $"                      { fail "set variable char=0" }
-           timeout                              { fail "(timeout) set variable char=0" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable char=0" }
-    timeout                                      { fail "(timeout) set variable char=0" }
-}                         
-
-
-send "set variable v_char=1\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_char\n"
-       expect {
-           -re ".\[0-9\]* = 1 \'.001\'.*$prompt $"       { pass "set variable char=1" }
-           -re "$prompt $"                      { fail "set variable char=1" }
-           timeout                              { fail "(timeout) set variable char=1" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable char=1" }
-    timeout                                      { fail "(timeout) set variable char=1" }
-}                         
-
-
-send "set variable v_char=27\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_char\n"
-       expect {
-           -re ".\[0-9\]* = 27 \'.e\'.*$prompt $"       { pass "set variable char=27 (Esc)" }
-           -re "$prompt $"                      { fail "set variable char=27 (Esc)" }
-           timeout                              { fail "(timeout) set variable char=27 (Esc)" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable char=27 (Esc)" }
-    timeout                                      { fail "(timeout) set variable char=27 (Esc)" }
-}                         
-
-
-send "set variable v_char=32\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_char\n"
-       expect {
-           -re ".\[0-9\]* = 32 \' \'.*$prompt $"       { pass "set variable char=32 (SPC)" }
-           -re "$prompt $"                      { fail "set variable char=32 (SPC)" }
-           timeout                              { fail "(timeout) set variable char=32 (SPC)" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable char=32 (SPC)" }
-    timeout                                      { fail "(timeout) set variable char=32 (SPC)" }
-}                         
-
-
-send "set variable v_char=65\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_char\n"
-       expect {
-           -re ".\[0-9\]* = 65 \'A\'.*$prompt $"       { pass "set variable char=65 ('A')" }
-           -re "$prompt $"                      { fail "set variable char=65 ('A')" }
-           timeout                              { fail "(timeout) set variable char=65 ('A')" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable char=65 ('A')" }
-    timeout                                      { fail "(timeout) set variable char=65 ('A')" }
-}                         
-
-
-send "set variable v_char=97\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_char\n"
-       expect {
-           -re ".\[0-9\]* = 97 \'a\'.*$prompt $"       { pass "set variable char=97 ('a')" }
-           -re "$prompt $"                      { fail "set variable char=97 ('a')" }
-           timeout                              { fail "(timeout) set variable char=97 ('a')" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable char=97 ('a')" }
-    timeout                                      { fail "(timeout) set variable char=97 ('a')" }
-}                         
-
-
-send "set variable v_char=126\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_char\n"
-       expect {
-           -re ".\[0-9\]* = 126 \'~\'.*$prompt $"       { pass "set variable char=126 ('~')" }
-           -re "$prompt $"                      { fail "set variable char=126 ('~')" }
-           timeout                              { fail "(timeout) set variable char=126 ('~')" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable char=126 ('~')" }
-    timeout                                      { fail "(timeout) set variable char=126 ('~')" }
-}                         
-
-
-send "set variable v_char=127\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_char\n"
-       expect {
-           -re ".\[0-9\]* = 127 \'.177\'.*$prompt $"       { pass "set variable char=127 (8-bit)" }
-           -re "$prompt $"                      { fail "set variable char=127 (8-bit)" }
-           timeout                              { fail "(timeout) set variable char=127 (8-bit)" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable char=127 (8-bit)" }
-    timeout                                      { fail "(timeout) set variable char=127 (8-bit)" }
-}                         
-
 
+test_set "set variable v_char=0" "print v_char" ".\[0-9\]* = 0 \'.000\'"        "set variable char=0" 
+test_set "set variable v_char=1" "print v_char" ".\[0-9\]* = 1 \'.001\'"        "set variable char=1" 
+test_set "set variable v_char=27" "print v_char" ".\[0-9\]* = 27 \'.e\'"        "set variable char=27 (Esc)" 
+test_set "set variable v_char=32" "print v_char" ".\[0-9\]* = 32 \' \'"        "set variable char=32 (SPC)" 
+test_set "set variable v_char=65" "print v_char" ".\[0-9\]* = 65 \'A\'"        "set variable char=65 ('A')" 
+test_set "set variable v_char=97" "print v_char" ".\[0-9\]* = 97 \'a\'"        "set variable char=97 ('a')" 
+test_set "set variable v_char=126" "print v_char" ".\[0-9\]* = 126 \'~\'"        "set variable char=126 ('~')" 
+test_set "set variable v_char=127" "print v_char" ".\[0-9\]* = 127 \'.177\'"        "set variable char=127 (8-bit)" 
 #
 # test "set variable" for type "signed char"
 #    
-send "set variable v_char=0\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_signed_char\n"
-       expect {
-           -re ".\[0-9\]* = 0 \'.000\'.*$prompt $"       { pass "set variable signed char=0" }
-           -re "$prompt $"                      { fail "set variable signed char=0" }
-           timeout                              { fail "(timeout) set variable signed char=0" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable signed char=0" }
-    timeout                                      { fail "(timeout) set variable signed char=0" }
-}                         
-
-
-send "set variable v_signed_char=1\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_signed_char\n"
-       expect {
-           -re ".\[0-9\]* = 1 \'.001\'.*$prompt $"       { pass "set variable signed char=1" }
-           -re "$prompt $"                      { fail "set variable signed char=1" }
-           timeout                              { fail "(timeout) set variable signed char=1" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable signed char=1" }
-    timeout                                      { fail "(timeout) set variable signed char=1" }
-}                         
-
-
-send "set variable v_signed_char=27\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_signed_char\n"
-       expect {
-           -re ".\[0-9\]* = 27 \'.e\'.*$prompt $"       { pass "set variable signed char=27 (Esc)" }
-           -re "$prompt $"                      { fail "set variable signed char=27 (Esc)" }
-           timeout                              { fail "(timeout) set variable signed char=27 (Esc)" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable signed char=27 (Esc)" }
-    timeout                                      { fail "(timeout) set variable signed char=27 (Esc)" }
-}                         
-
-
-send "set variable v_signed_char=32\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_signed_char\n"
-       expect {
-           -re ".\[0-9\]* = 32 \' \'.*$prompt $"       { pass "set variable signed char=32 (SPC)" }
-           -re "$prompt $"                      { fail "set variable signed char=32 (SPC)" }
-           timeout                              { fail "(timeout) set variable signed char=32 (SPC)" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable signed char=32 (SPC)" }
-    timeout                                      { fail "(timeout) set variable signed char=32 (SPC)" }
-}                         
-
-
-send "set variable v_signed_char=65\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_signed_char\n"
-       expect {
-           -re ".\[0-9\]* = 65 \'A\'.*$prompt $"       { pass "set variable signed char=65 ('A')" }
-           -re "$prompt $"                      { fail "set variable signed char=65 ('A')" }
-           timeout                              { fail "(timeout) set variable signed char=65 ('A')" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable signed char=65 ('A')" }
-    timeout                                      { fail "(timeout) set variable signed char=65 ('A')" }
-}                         
-
-
-send "set variable v_signed_char=97\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_signed_char\n"
-       expect {
-           -re ".\[0-9\]* = 97 \'a\'.*$prompt $"       { pass "set variable signed char=97 ('a')" }
-           -re "$prompt $"                      { fail "set variable signed char=97 ('a')" }
-           timeout                              { fail "(timeout) set variable signed char=97 ('a')" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable signed char=97 ('a')" }
-    timeout                                      { fail "(timeout) set variable signed char=97 ('a')" }
-}                         
-
-
-send "set variable v_signed_char=126\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_signed_char\n"
-       expect {
-           -re ".\[0-9\]* = 126 \'~\'.*$prompt $"       { pass "set variable signed char=126 ('~')" }
-           -re "$prompt $"                      { fail "set variable signed char=126 ('~')" }
-           timeout                              { fail "(timeout) set variable signed char=126 ('~')" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable signed char=126 ('~')" }
-    timeout                                      { fail "(timeout) set variable signed char=126 ('~')" }
-}                         
-
-
-send "set variable v_signed_char=127\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_signed_char\n"
-       expect {
-           -re ".\[0-9\]* = 127 \'.177\'.*$prompt $"       { pass "set variable signed char=127 (8-bit)" }
-           -re "$prompt $"                      { fail "set variable signed char=127 (8-bit)" }
-           timeout                              { fail "(timeout) set variable signed char=127 (8-bit)" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable signed char=127 (8-bit)" }
-    timeout                                      { fail "(timeout) set variable signed char=127 (8-bit)" }
-}                         
-
-
+test_set "set variable v_char=0" "print v_signed_char" ".\[0-9\]* = 0 \'.000\'"        "set variable signed char=0" 
+test_set "set variable v_signed_char=1" "print v_signed_char" ".\[0-9\]* = 1 \'.001\'"        "set variable signed char=1" 
+test_set "set variable v_signed_char=27" "print v_signed_char" ".\[0-9\]* = 27 \'.e\'"        "set variable signed char=27 (Esc)" 
+test_set "set variable v_signed_char=32" "print v_signed_char" ".\[0-9\]* = 32 \' \'"        "set variable signed char=32 (SPC)" 
+test_set "set variable v_signed_char=65" "print v_signed_char" ".\[0-9\]* = 65 \'A\'"        "set variable signed char=65 ('A')" 
+test_set "set variable v_signed_char=97" "print v_signed_char" ".\[0-9\]* = 97 \'a\'"        "set variable signed char=97 ('a')" 
+test_set "set variable v_signed_char=126" "print v_signed_char" ".\[0-9\]* = 126 \'~\'"        "set variable signed char=126 ('~')" 
+test_set "set variable v_signed_char=127" "print v_signed_char" ".\[0-9\]* = 127 \'.177\'"        "set variable signed char=127 (8-bit)" 
 gdb_test "set variable v_signed_char=-1" ""
 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix4*" }
 gdb_test "print v_signed_char" ".\[0-9\]* = -1 \'.377\'" \
     "set variable signed char=-1 (-1)"
-
 gdb_test "set variable v_signed_char=0xFF" ""
 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix4*" }
 gdb_test "print v_signed_char" ".\[0-9\]* = -1 \'.377\'" \
     "set variable signed char=0xFF (0xFF)"
-
-
 #
 # test "set variable" for type "unsigned char"
 #
-send "set variable v_unsigned_char=0\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_unsigned_char\n"
-       expect {
-           -re ".\[0-9\]* = 0 \'.000\'.*$prompt $"       { pass "set variable unsigned char=0" }
-           -re "$prompt $"                      { fail "set variable unsigned char=0" }
-           timeout                              { fail "(timeout) set variable unsigned char=0" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable unsigned char=0" }
-    timeout                                      { fail "(timeout) set variable unsigned char=0" }
-}                         
-
-
-send "set variable v_unsigned_char=1\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_unsigned_char\n"
-       expect {
-           -re ".\[0-9\]* = 1 \'.001\'.*$prompt $"       { pass "set variable unsigned char=1" }
-           -re "$prompt $"                      { fail "set variable unsigned char=1" }
-           timeout                              { fail "(timeout) set variable unsigned char=1" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable unsigned char=1" }
-    timeout                                      { fail "(timeout) set variable unsigned char=1" }
-}                         
-
-
-send "set variable v_unsigned_char=27\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_unsigned_char\n"
-       expect {
-           -re ".\[0-9\]* = 27 \'.e\'.*$prompt $"       { pass "set variable unsigned char=27 (Esc)" }
-           -re "$prompt $"                      { fail "set variable unsigned char=27 (Esc)" }
-           timeout                              { fail "(timeout) set variable unsigned char=27 (Esc)" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable unsigned char=27 (Esc)" }
-    timeout                                      { fail "(timeout) set variable unsigned char=27 (Esc)" }
-}                         
-
-
-send "set variable v_unsigned_char=32\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_unsigned_char\n"
-       expect {
-           -re ".\[0-9\]* = 32 \' \'.*$prompt $"       { pass "set variable unsigned char=32 (SPC)" }
-           -re "$prompt $"                      { fail "set variable unsigned char=32 (SPC)" }
-           timeout                              { fail "(timeout) set variable unsigned char=32 (SPC)" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable unsigned char=32 (SPC)" }
-    timeout                                      { fail "(timeout) set variable unsigned char=32 (SPC)" }
-}                         
-
-
-send "set variable v_unsigned_char=65\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_unsigned_char\n"
-       expect {
-           -re ".\[0-9\]* = 65 \'A\'.*$prompt $"       { pass "set variable unsigned char=65 ('A')" }
-           -re "$prompt $"                      { fail "set variable unsigned char=65 ('A')" }
-           timeout                              { fail "(timeout) set variable unsigned char=65 ('A')" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable unsigned char=65 ('A')" }
-    timeout                                      { fail "(timeout) set variable unsigned char=65 ('A')" }
-}                         
-
-
-send "set variable v_unsigned_char=97\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_unsigned_char\n"
-       expect {
-           -re ".\[0-9\]* = 97 \'a\'.*$prompt $"       { pass "set variable unsigned char=97 ('a')" }
-           -re "$prompt $"                      { fail "set variable unsigned char=97 ('a')" }
-           timeout                              { fail "(timeout) set variable unsigned char=97 ('a')" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable unsigned char=97 ('a')" }
-    timeout                                      { fail "(timeout) set variable unsigned char=97 ('a')" }
-}                         
-
-
-send "set variable v_unsigned_char=126\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_unsigned_char\n"
-       expect {
-           -re ".\[0-9\]* = 126 \'~\'.*$prompt $"       { pass "set variable unsigned char=126 ('~')" }
-           -re "$prompt $"                      { fail "set variable unsigned char=126 ('~')" }
-           timeout                              { fail "(timeout) set variable unsigned char=126 ('~')" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable unsigned char=126 ('~')" }
-    timeout                                      { fail "(timeout) set variable unsigned char=126 ('~')" }
-}                         
-
-
-send "set variable v_unsigned_char=~0\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_unsigned_char\n"
-       expect {
-           -re ".\[0-9\]* = 255 \'.377\'.*$prompt $"       { pass "set variable unsigned char=255 (8-bit)" }
-           -re "$prompt $"                      { fail "set variable unsigned char=255 (8-bit)" }
-           timeout                              { fail "(timeout) set variable unsigned char=255 (8-bit)" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable unsigned char=255 (8-bit)" }
-    timeout                                      { fail "(timeout) set variable unsigned char=255 (8-bit)" }
-}                         
-
-
+test_set "set variable v_unsigned_char=0" "print v_unsigned_char" ".\[0-9\]* = 0 \'.000\'"        "set variable unsigned char=0" 
+test_set "set variable v_unsigned_char=1" "print v_unsigned_char" ".\[0-9\]* = 1 \'.001\'"        "set variable unsigned char=1" 
+test_set "set variable v_unsigned_char=27" "print v_unsigned_char" ".\[0-9\]* = 27 \'.e\'"        "set variable unsigned char=27 (Esc)" 
+test_set "set variable v_unsigned_char=32" "print v_unsigned_char" ".\[0-9\]* = 32 \' \'"        "set variable unsigned char=32 (SPC)" 
+test_set "set variable v_unsigned_char=65" "print v_unsigned_char" ".\[0-9\]* = 65 \'A\'"        "set variable unsigned char=65 ('A')" 
+test_set "set variable v_unsigned_char=97" "print v_unsigned_char" ".\[0-9\]* = 97 \'a\'"        "set variable unsigned char=97 ('a')" 
+test_set "set variable v_unsigned_char=126" "print v_unsigned_char" ".\[0-9\]* = 126 \'~\'"        "set variable unsigned char=126 ('~')" 
+test_set "set variable v_unsigned_char=~0" "print v_unsigned_char" ".\[0-9\]* = 255 \'.377\'"        "set variable unsigned char=255 (8-bit)" 
 #
 # test "set variable" for type "short"
 #
-send "set variable v_short=0\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_short\n"
-       expect {
-           -re ".\[0-9\]* = 0.*$prompt $"       { pass "set variable short=0" }
-           -re "$prompt $"                      { fail "set variable short=0" }
-           timeout                              { fail "(timeout) set variable short=0" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable short=0" }
-    timeout                                      { fail "(timeout) set variable short=0" }
-}                         
-
-
-send "set variable v_short=1\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_short\n"
-       expect {
-           -re ".\[0-9\]* = 1.*$prompt $"       { pass "set variable short=1" }
-           -re "$prompt $"                      { fail "set variable short=1" }
-           timeout                              { fail "(timeout) set variable short=1" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable short=1" }
-    timeout                                      { fail "(timeout) set variable short=1" }
-}                         
-
-
-send "set variable v_short=-1\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_short\n"
-       expect {
-           -re ".\[0-9\]* = -1.*$prompt $"       { pass "set variable short=-1 (minus)" }
-           -re "$prompt $"                      { fail "set variable short=-1 (minus)" }
-           timeout                              { fail "(timeout) set variable signed short=-1 (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable short=-1 (minus)" }
-    timeout                                      { fail "(timeout) set variable short=-1 (minus)" }
-}                         
-
-
+test_set "set variable v_short=0" "print v_short" ".\[0-9\]* = 0"        "set variable short=0" 
+test_set "set variable v_short=1" "print v_short" ".\[0-9\]* = 1"        "set variable short=1" 
+test_set "set variable v_short=-1" "print v_short" ".\[0-9\]* = -1"        "set variable short=-1 (minus)" 
 #
 # test "set variable" for type "signed short"
 #
-send "set variable v_signed_short=0\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_signed_short\n"
-       expect {
-           -re ".\[0-9\]* = 0.*$prompt $"       { pass "set variable signed short=0" }
-           -re "$prompt $"                      { fail "set variable signed short=0" }
-           timeout                              { fail "(timeout) set variable signed short=0" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable signed short=0" }
-    timeout                                      { fail "(timeout) set variable signed short=0" }
-}                         
-
-
-send "set variable v_signed_short=1\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_signed_short\n"
-       expect {
-           -re ".\[0-9\]* = 1.*$prompt $"       { pass "set variable signed short=1" }
-           -re "$prompt $"                      { fail "set variable signed short=1" }
-           timeout                              { fail "(timeout) set variable signed short=1" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable signed short=1" }
-    timeout                                      { fail "(timeout) set variable signed short=1" }
-}                         
-
-
-send "set variable v_signed_short=-1\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_signed_short\n"
-       expect {
-           -re ".\[0-9\]* = -1.*$prompt $"       { pass "set variable signed short=-1 (minus)" }
-           -re "$prompt $"                      { fail "set variable signed short=-1 (minus)" }
-           timeout                              { fail "(timeout) set variable signed short=-1 (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable signed short=-1 (minus)" }
-    timeout                                      { fail "(timeout) set variable signed short=-1 (minus)" }
-}                         
-
-
+test_set "set variable v_signed_short=0" "print v_signed_short" ".\[0-9\]* = 0"        "set variable signed short=0" 
+test_set "set variable v_signed_short=1" "print v_signed_short" ".\[0-9\]* = 1"        "set variable signed short=1" 
+test_set "set variable v_signed_short=-1" "print v_signed_short" ".\[0-9\]* = -1"        "set variable signed short=-1 (minus)" 
 #
 # test "set variable" for type "unsigned short"
 #
-send "set variable v_unsigned_short=0\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_unsigned_short\n"
-       expect {
-           -re ".\[0-9\]* = 0.*$prompt $"       { pass "set variable unsigned short=0" }
-           -re "$prompt $"                      { fail "set variable unsigned short=0" }
-           timeout                              { fail "(timeout) set variable unsigned short=0" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable unsigned short=0" }
-    timeout                                      { fail "(timeout) set variable unsigned short=0" }
-}                         
-
-
-send "set variable v_unsigned_short=1\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_unsigned_short\n"
-       expect {
-           -re ".\[0-9\]* = 1.*$prompt $"       { pass "set variable unsigned short=1" }
-           -re "$prompt $"                      { fail "set variable unsigned short=1" }
-           timeout                              { fail "(timeout) set variable unsigned short=1" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable unsigned short=1" }
-    timeout                                      { fail "(timeout) set variable unsigned short=1" }
-}                         
-
-
-send "set variable v_unsigned_short=~0\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_unsigned_short\n"
-       expect {
-           -re ".\[0-9\]* = 65535.*$prompt $"       { pass "set variable unsigned short=~0 (minus)" }
-           -re "$prompt $"                      { fail "set variable unsigned short=~0 (minus)" }
-           timeout                              { fail "(timeout)  set variable unsigned short=~0 (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable unsigned short=~0 (minus)" }
-    timeout                                      { fail "(timeout) set variable unsigned short=~0 (minus)" }
-}                         
-
-
+test_set "set variable v_unsigned_short=0" "print v_unsigned_short" ".\[0-9\]* = 0"        "set variable unsigned short=0" 
+test_set "set variable v_unsigned_short=1" "print v_unsigned_short" ".\[0-9\]* = 1"        "set variable unsigned short=1" 
+test_set "set variable v_unsigned_short=~0" "print v_unsigned_short" ".\[0-9\]* = 65535"        "set variable unsigned short=~0 (minus)" 
 #
 # test "set variable" for type "int"
 #
-send "set variable v_int=0\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_int\n"
-       expect {
-           -re ".\[0-9\]* = 0.*$prompt $"       { pass "set variable int=0" }
-           -re "$prompt $"                      { fail "set variable int=0" }
-           timeout                              { fail "(timeout) set variable int=0" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable int=0" }
-    timeout                                      { fail "(timeout) set variable int=0" }
-}                         
-
-
-send "set variable v_int=1\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_int\n"
-       expect {
-           -re ".\[0-9\]* = 1.*$prompt $"       { pass "set variable int=1" }
-           -re "$prompt $"                      { fail "set variable int=1" }
-           timeout                              { fail "(timeout) set variable int=1" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable int=1" }
-    timeout                                      { fail "(timeout) set variable int=1" }
-}                         
-
-
-send "set variable v_int=-1\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_int\n"
-       expect {
-           -re ".\[0-9\]* = -1.*$prompt $"       { pass "set variable int=-1 (minus)" }
-           -re "$prompt $"                      { fail "set variable int=-1 (minus)" }
-           timeout                              { fail "(timeout) set variable signed int=-1 (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable int=-1 (minus)" }
-    timeout                                      { fail "(timeout) set variable int=-1 (minus)" }
-}                         
-
-
+test_set "set variable v_int=0" "print v_int" ".\[0-9\]* = 0"        "set variable int=0" 
+test_set "set variable v_int=1" "print v_int" ".\[0-9\]* = 1"        "set variable int=1" 
+test_set "set variable v_int=-1" "print v_int" ".\[0-9\]* = -1"        "set variable int=-1 (minus)" 
 #
 # test "set variable" for type "signed int"
 #
-send "set variable v_signed_int=0\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_signed_int\n"
-       expect {
-           -re ".\[0-9\]* = 0.*$prompt $"       { pass "set variable signed int=0" }
-           -re "$prompt $"                      { fail "set variable signed int=0" }
-           timeout                              { fail "(timeout) set variable signed int=0" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable signed int=0" }
-    timeout                                      { fail "(timeout) set variable signed int=0" }
-}                         
-
-
-send "set variable v_signed_int=1\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_signed_int\n"
-       expect {
-           -re ".\[0-9\]* = 1.*$prompt $"       { pass "set variable signed int=1" }
-           -re "$prompt $"                      { fail "set variable signed int=1" }
-           timeout                              { fail "(timeout) set variable signed int=1" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable signed int=1" }
-    timeout                                      { fail "(timeout) set variable signed int=1" }
-}                         
-
-
-send "set variable v_signed_int=-1\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_signed_int\n"
-       expect {
-           -re ".\[0-9\]* = -1.*$prompt $"       { pass "set variable signed int=-1 (minus)" }
-           -re "$prompt $"                      { fail "set variable signed int=-1 (minus)" }
-           timeout                              { fail "(timeout) set variable signed int=-1 (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable signed int=-1 (minus)" }
-    timeout                                      { fail "(timeout) set variable signed int=-1 (minus)" }
-}                         
-
-
+test_set "set variable v_signed_int=0" "print v_signed_int" ".\[0-9\]* = 0"        "set variable signed int=0" 
+test_set "set variable v_signed_int=1" "print v_signed_int" ".\[0-9\]* = 1"        "set variable signed int=1" 
+test_set "set variable v_signed_int=-1" "print v_signed_int" ".\[0-9\]* = -1"        "set variable signed int=-1 (minus)" 
 #
 # test "set variable" for type "unsigned int"
 #
-send "set variable v_unsigned_int=0\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_unsigned_int\n"
-       expect {
-           -re ".\[0-9\]* = 0.*$prompt $"       { pass "set variable unsigned int=0" }
-           -re "$prompt $"                      { fail "set variable unsigned int=0" }
-           timeout                              { fail "(timeout) set variable unsigned int=0" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable unsigned int=0" }
-    timeout                                      { fail "(timeout) set variable unsigned int=0" }
-}                         
-
-
-send "set variable v_unsigned_int=1\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_unsigned_int\n"
-       expect {
-           -re ".\[0-9\]* = 1.*$prompt $"       { pass "set variable unsigned int=1" }
-           -re "$prompt $"                      { fail "set variable unsigned int=1" }
-           timeout                              { fail "(timeout) set variable unsigned int=1" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable unsigned int=1" }
-    timeout                                      { fail "(timeout) set variable unsigned int=1" }
-}                         
-
-
-send "set variable v_unsigned_int=~0\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_unsigned_int\n"
-       expect {
-           -re ".\[0-9\]* = 4294967295.*$prompt $"       { pass "set variable unsigned int=~0 (minus)" }
-           -re "$prompt $"                      { fail "set variable unsigned int=~0 (minus)" }
-           timeout                              { fail "(timeout) set variable unsigned int=~0 (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable unsigned int=~0 (minus)" }
-    timeout                                      { fail "(timeout) set variable unsigned int=~0 (minus)" }
-}                         
-
-
+test_set "set variable v_unsigned_int=0" "print v_unsigned_int" ".\[0-9\]* = 0"        "set variable unsigned int=0" 
+test_set "set variable v_unsigned_int=1" "print v_unsigned_int" ".\[0-9\]* = 1"        "set variable unsigned int=1" 
+test_set "set variable v_unsigned_int=~0" "print v_unsigned_int" ".\[0-9\]* = (4294967295|65535)"        "set variable unsigned int=~0 (minus)" 
+#test_set ".\[0-9\]* = 65535"        "set variable unsigned int=~0 (minus)" 
 #
 # test "set variable" for type "long"
 #
-send "set variable v_long=0\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_long\n"
-       expect {
-           -re ".\[0-9\]* = 0.*$prompt $"       { pass "set variable long=0" }
-           -re "$prompt $"                      { fail "set variable long=0" }
-           timeout                              { fail "(timeout) set variable long=0" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable long=0" }
-    timeout                                      { fail "(timeout) set variable long=0" }
-}                         
-
-
-send "set variable v_long=1\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_long\n"
-       expect {
-           -re ".\[0-9\]* = 1.*$prompt $"       { pass "set variable long=1" }
-           -re "$prompt $"                      { fail "set variable long=1" }
-           timeout                              { fail "(timeout) set variable long=1" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable long=1" }
-    timeout                                      { fail "(timeout) set variable long=1" }
-}                         
-
-
-send "set variable v_long=-1\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_long\n"
-       expect {
-           -re ".\[0-9\]* = -1.*$prompt $"       { pass "set variable long=-1 (minus)" }
-           -re "$prompt $"                      { fail "set variable long=-1 (minus)" }
-           timeout                              { fail "(timeout) set variable signed long=-1 (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable long=-1 (minus)" }
-    timeout                                      { fail "(timeout) set variable long=-1 (minus)" }
-}                         
-
-
+test_set "set variable v_long=0" "print v_long" ".\[0-9\]* = 0"        "set variable long=0" 
+test_set "set variable v_long=1" "print v_long" ".\[0-9\]* = 1"        "set variable long=1" 
+test_set "set variable v_long=-1" "print v_long" ".\[0-9\]* = -1"        "set variable long=-1 (minus)" 
 #
 # test "set variable" for type "signed long"
 #
-send "set variable v_signed_long=0\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_signed_long\n"
-       expect {
-           -re ".\[0-9\]* = 0.*$prompt $"       { pass "set variable signed long=0" }
-           -re "$prompt $"                      { fail "set variable signed long=0" }
-           timeout                              { fail "(timeout) set variable signed long=0" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable signed long=0" }
-    timeout                                      { fail "(timeout) set variable signed long=0" }
-}                         
-
-
-send "set variable v_signed_long=1\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_signed_long\n"
-       expect {
-           -re ".\[0-9\]* = 1.*$prompt $"       { pass "set variable signed long=1" }
-           -re "$prompt $"                      { fail "set variable signed long=1" }
-           timeout                              { fail "(timeout) set variable signed long=1" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable signed long=1" }
-    timeout                                      { fail "(timeout) set variable signed long=1" }
-}                         
-
-
-send "set variable v_signed_long=-1\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_signed_long\n"
-       expect {
-           -re ".\[0-9\]* = -1.*$prompt $"       { pass "set variable signed long=-1 (minus)" }
-           -re "$prompt $"                      { fail "set variable signed long=-1 (minus)" }
-           timeout                              { fail "(timeout) set variable signed long=-1 (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable signed long=-1 (minus)" }
-    timeout                                      { fail "(timeout) set variable signed long=-1 (minus)" }
-}                         
-
-
+test_set "set variable v_signed_long=0" "print v_signed_long" ".\[0-9\]* = 0"        "set variable signed long=0" 
+test_set "set variable v_signed_long=1" "print v_signed_long" ".\[0-9\]* = 1"        "set variable signed long=1" 
+test_set "set variable v_signed_long=-1" "print v_signed_long" ".\[0-9\]* = -1"        "set variable signed long=-1 (minus)" 
 #
 # test "set variable" for type "unsigned long"
 #
-send "set variable v_unsigned_long=0\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_unsigned_long\n"
-       expect {
-           -re ".\[0-9\]* = 0.*$prompt $"       { pass "set variable unsigned long=0" }
-           -re "$prompt $"                      { fail "set variable unsigned long=0" }
-           timeout                              { fail "(timeout) set variable unsigned long=0" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable unsigned long=0" }
-    timeout                                      { fail "(timeout) set variable unsigned long=0" }
-}                         
-
-
-send "set variable v_unsigned_long=1\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_unsigned_long\n"
-       expect {
-           -re ".\[0-9\]* = 1.*$prompt $"       { pass "set variable unsigned long=1" }
-           -re "$prompt $"                      { fail "set variable unsigned long=1" }
-           timeout                              { fail "(timeout) set variable unsigned long=1" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable unsigned long=1" }
-    timeout                                      { fail "(timeout) set variable unsigned long=1" }
-}                         
-
-
-send "set variable v_unsigned_long=~0\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_unsigned_long\n"
-       expect {
-           -re ".\[0-9\]* = $ulong_minus_1.*$prompt $"       { pass "set variable unsigned long=~0 (minus)" }
-           -re "$prompt $"                      { fail "set variable unsigned long=~0 (minus)" }
-           timeout                              { fail "(timeout) set variable unsigned long=~0 (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable unsigned long=~0 (minus)" }
-    timeout                                      { fail "(timeout) set variable unsigned long=~0 (minus)" }
-}                         
-
-
+test_set "set variable v_unsigned_long=0" "print v_unsigned_long" ".\[0-9\]* = 0"        "set variable unsigned long=0" 
+test_set "set variable v_unsigned_long=1" "print v_unsigned_long" ".\[0-9\]* = 1"        "set variable unsigned long=1" 
+test_set "set variable v_unsigned_long=~0" "print v_unsigned_long" ".\[0-9\]* = $ulong_minus_1"        "set variable unsigned long=~0 (minus)" 
 #
 # test "set variable" for type "float"
 #
-send "set variable v_float=0.0\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_float\n"
-       expect {
-           -re ".\[0-9\]* = 0.*$prompt $"       { pass "set variable float=0" }
-           -re "$prompt $"                      { fail "set variable float=0" }
-           timeout                              { fail "(timeout) set variable float=0" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable float=0" }
-    timeout                                      { fail "(timeout) set variable float=0" }
-}                         
-
-
-send "set variable v_float=1.0\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_float\n"
-       expect {
-           -re ".\[0-9\]* = 1.*$prompt $"       { pass "set variable float=1" }
-           -re "$prompt $"                      { fail "set variable float=1" }
-           timeout                              { fail "(timeout) set variable float=1" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable float=1" }
-    timeout                                      { fail "(timeout) set variable float=1" }
-}                         
-
-
-send "set variable v_float=-1.0\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_float\n"
-       expect {
-           -re ".\[0-9\]* = -1.*$prompt $"       { pass "set variable float=-1 (minus)" }
-           -re "$prompt $"                      { fail "set variable float=-1 (minus)" }
-           timeout                              { fail "(timeout) set variable signed float=-1 (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable float=-1 (minus)" }
-    timeout                                      { fail "(timeout) set variable float=-1 (minus)" }
-}                         
-
-
+test_set "set variable v_float=0.0" "print v_float" ".\[0-9\]* = 0"        "set variable float=0" 
+test_set "set variable v_float=1.0" "print v_float" ".\[0-9\]* = 1"        "set variable float=1" 
+test_set "set variable v_float=-1.0" "print v_float" ".\[0-9\]* = -1"        "set variable float=-1 (minus)" 
 #
 # test "set variable" for type "double"
 #
-send "set variable v_double=0.0\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_double\n"
-       expect {
-           -re ".\[0-9\]* = 0.*$prompt $"       { pass "set variable double=0" }
-           -re "$prompt $"                      { fail "set variable double=0" }
-           timeout                              { fail "(timeout) set variable double=0" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable double=0" }
-    timeout                                      { fail "(timeout) set variable double=0" }
-}                         
-
-
-send "set variable v_double=1.0\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_double\n"
-       expect {
-           -re ".\[0-9\]* = 1.*$prompt $"       { pass "set variable double=1" }
-           -re "$prompt $"                      { fail "set variable double=1" }
-           timeout                              { fail "(timeout) set variable double=1" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable double=1" }
-    timeout                                      { fail "(timeout) set variable double=1" }
-}                         
-
-
-send "set variable v_double=-1.0\n"
-expect {
-    -re "set.*$prompt $"\
-       {
-       send "print v_double\n"
-       expect {
-           -re "print.*.\[0-9\]* = -1.*$prompt $"       { pass "set variable double=-1 (minus)" }
-           -re "$prompt $"                      { fail "set variable double=-1 (minus)" }
-           timeout                              { fail "(timeout) set variable double=-1 (minus)" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable double=-1 (minus)" }
-    timeout                                      { fail "(timeout) set variable double=-1 (minus)" }
-}                         
-
-
+test_set "set variable v_double=0.0" "print v_double" ".\[0-9\]* = 0"        "set variable double=0" 
+test_set "set variable v_double=1.0" "print v_double" ".\[0-9\]* = 1"        "set variable double=1" 
+test_set "set variable v_double=-1.0" "print v_double" "print.*.\[0-9\]* = -1"        "set variable double=-1 (minus)" 
 #
 # test "set variable" for "char array[2]"
 #
-send "set variable v_char_array\[0\]='h'\n"
-expect -re "$prompt $"
-send "set variable v_char_array\[1\]='i'\n"
-expect {
-    -re "set.*$prompt $"\
-       {
-       send "print v_char_array\n"
-       expect {
-           -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $"       { pass "set variable char array=\"hi\" (string)" }
-           -re "$prompt $"                      { fail "set variable char array=\"hi\" (string)" }
-           timeout                              { fail "(timeout) set variable char array=\"hi\" (string)" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable char array=\"hi\" (string)" }
-    timeout                                      { fail "(timeout) set variable char array=\"hi\" (string)" }
-}                         
-
-
+test_set "set variable v_char_array\[0\]='h'" "set variable v_char_array\[1\]='i'" "print v_char_array" "print.*.\[0-9\]* =.*\"hi\""        "set variable char array=\"hi\" (string)" 
 #
 # test "set variable" for "signed char array[2]"
 #
-send "set variable v_signed_char_array\[0\]='h'\n"
-expect -re "$prompt $"
-send "set variable v_signed_char_array\[1\]='i'\n"
-expect {
-    -re "set.*$prompt $"\
-       {
-       send "print v_signed_char_array\n"
-       expect {
-           -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $"       { pass "set variable signed char array=\"hi\" (string)" }
-           -re "$prompt $"                      { fail "set variable signed char array=\"hi\" (string)" }
-           timeout                              { fail "(timeout) set variable signed char array=\"hi\" (string)" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable signed char array=\"hi\" (string)" }
-    timeout                                      { fail "(timeout) set variable signed char array=\"hi\" (string)" }
-}                         
-
-
+test_set "set variable v_signed_char_array\[0\]='h'" "set variable v_signed_char_array\[1\]='i'" "print v_signed_char_array" "print.*.\[0-9\]* =.*\"hi\""        "set variable signed char array=\"hi\" (string)" 
 #
 # test "set variable" for "unsigned char array[2]"
 #
-send "set variable v_unsigned_char_array\[0\]='h'\n"
-expect -re "$prompt $"
-send "set variable v_unsigned_char_array\[1\]='i'\n"
-expect {
-    -re "set.*$prompt $"\
-       {
-       send "print v_unsigned_char_array\n"
-       expect {
-           -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $"       { pass "set variable unsigned char array=\"hi\" (string)" }
-           -re "$prompt $"                      { fail "set variable unsigned char array=\"hi\" (string)" }
-           timeout                              { fail "(timeout) set variable unsigned char array=\"hi\" (string)" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable unsigned char array=\"hi\" (string)" }
-    timeout                                      { fail "(timeout) set variable unsigned char array=\"hi\" (string)" }
-}                         
-
-
+test_set "set variable v_unsigned_char_array\[0\]='h'" "set variable v_unsigned_char_array\[1\]='i'" "print v_unsigned_char_array" "print.*.\[0-9\]* =.*\"hi\""        "set variable unsigned char array=\"hi\" (string)" 
 #
 # test "set variable" for "short array[2]"
 #
-send "set variable v_short_array\[0\]=123\n"
-expect -re "$prompt $"
-send "set variable v_short_array\[1\]=-456\n"
-expect {
-    -re "set.*$prompt $"\
-       {
-       send "print v_short_array\n"
-       expect {
-           -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $"       { pass "set variable short array" }
-           -re "$prompt $"                      { fail "set variable short array" }
-           timeout                              { fail "(timeout) set variable short array" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable short array" }
-    timeout                                      { fail "(timeout) set variable short array" }
-}                         
-
-
+test_set "set variable v_short_array\[0\]=123" "set variable v_short_array\[1\]=-456" "print v_short_array" "print.*.\[0-9\]* =.*\{123,.*-456\}"        "set variable short array" 
 #
 # test "set variable" for "signed short array[2]"
 #
-send "set variable v_signed_short_array\[0\]=123\n"
-expect -re "$prompt $"
-send "set variable v_signed_short_array\[1\]=-456\n"
-expect {
-    -re "set.*$prompt $"\
-       {
-       send "print v_signed_short_array\n"
-       expect {
-           -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $"       { pass "set variable signed short array" }
-           -re "$prompt $"                      { fail "set variable signed short array" }
-           timeout                              { fail "(timeout) set variable signed short array" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable signed short array" }
-    timeout                                      { fail "(timeout) set variable signed short array" }
-}                         
-
-
+test_set "set variable v_signed_short_array\[0\]=123" "set variable v_signed_short_array\[1\]=-456" "print v_signed_short_array" "print.*.\[0-9\]* =.*\{123,.*-456\}"        "set variable signed short array" 
 #
 # test "set variable" for "unsigned short array[2]"
 #
-send "set variable v_unsigned_short_array\[0\]=123\n"
-expect -re "$prompt $"
-send "set variable v_unsigned_short_array\[1\]=-456\n"
-expect {
-    -re "set.*$prompt $"\
-       {
-       send "print v_unsigned_short_array\n"
-       expect {
-           -re "print.*.\[0-9\]* =.*\{123,.*65080\}.*$prompt $"       { pass "set variable unsigned short array" }
-           -re "$prompt $"                      { fail "set variable unsigned short array" }
-           timeout                              { fail "(timeout) set variable unsigned short array" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable unsigned short array" }
-    timeout                                      { fail "(timeout) set variable unsigned short array" }
-}                         
-
-
+test_set "set variable v_unsigned_short_array\[0\]=123" "set variable v_unsigned_short_array\[1\]=-456" "print v_unsigned_short_array" "print.*.\[0-9\]* =.*\{123,.*65080\}"        "set variable unsigned short array" 
 #
 # test "set variable" for "int array[2]"
 #
-send "set variable v_int_array\[0\]=123\n"
-expect -re "$prompt $"
-send "set variable v_int_array\[1\]=-456\n"
-expect {
-    -re "set.*$prompt $"\
-       {
-       send "print v_int_array\n"
-       expect {
-           -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $"       { pass "set variable int array" }
-           -re "$prompt $"                      { fail "set variable int array" }
-           timeout                              { fail "(timeout) set variable int array" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable int array" }
-    timeout                                      { fail "(timeout) set variable int array" }
-}                         
-
-
+test_set "set variable v_int_array\[0\]=123" "set variable v_int_array\[1\]=-456" "print v_int_array" "print.*.\[0-9\]* =.*\{123,.*-456\}"        "set variable int array" 
 #
 # test "set variable" for "signed int array[2]"
 #
-send "set variable v_signed_int_array\[0\]=123\n"
-expect -re "$prompt $"
-send "set variable v_signed_int_array\[1\]=-456\n"
-expect {
-    -re "set.*$prompt $"\
-       {
-       send "print v_signed_int_array\n"
-       expect {
-           -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $"       { pass "set variable signed int array" }
-           -re "$prompt $"                      { fail "set variable signed int array" }
-           timeout                              { fail "(timeout) set variable signed int array" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable signed int array" }
-    timeout                                      { fail "(timeout) set variable signed int array" }
-}                         
-
-
-
+test_set "set variable v_signed_int_array\[0\]=123" "set variable v_signed_int_array\[1\]=-456" "print v_signed_int_array" "print.*.\[0-9\]* =.*\{123,.*-456\}"        "set variable signed int array" 
 #
 # test "set variable" for "unsigned int array[2]"
 #
-send "set variable v_unsigned_int_array\[0\]=123\n"
-expect -re "$prompt $"
-send "set variable v_unsigned_int_array\[1\]=-456\n"
-expect {
-    -re "set.*$prompt $"\
-       {
-       send "print v_unsigned_int_array\n"
-       expect {
-           -re "print.*.\[0-9\]* =.*\{123,.*4294966840\}.*$prompt $"       { pass "set variable unsigned int array" }
-           -re "$prompt $"                      { fail "set variable unsigned int array" }
-           timeout                              { fail "(timeout) set variable unsigned int array" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable unsigned int array" }
-    timeout                                      { fail "(timeout) set variable unsigned int array" }
-}                         
-
-
+test_set "set variable v_unsigned_int_array\[0\]=123" "set variable v_unsigned_int_array\[1\]=-456" "print v_unsigned_int_array" "print.*.\[0-9\]* =.*\{123,.*(4294966840|65080)\}"        "set variable unsigned int array" 
 #
 # test "set variable" for "long array[2]"
 #
-send "set variable v_long_array\[0\]=123\n"
-expect -re "$prompt $"
-send "set variable v_long_array\[1\]=-456\n"
-expect {
-    -re "set.*$prompt $"\
-       {
-       send "print v_long_array\n"
-       expect {
-           -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $"       { pass "set variable long array" }
-           -re "$prompt $"                      { fail "set variable long array" }
-           timeout                              { fail "(timeout) set variable long array" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable long array" }
-    timeout                                      { fail "(timeout) set variable long array" }
-}                         
-
-
+test_set "set variable v_long_array\[0\]=123" "set variable v_long_array\[1\]=-456" "print v_long_array" "print.*.\[0-9\]* =.*\{123,.*-456\}"        "set variable long array" 
 #
 # test "set variable" for "signed long array[2]"
 #
-send "set variable v_signed_long_array\[0\]=123\n"
-expect -re "$prompt $"
-send "set variable v_signed_long_array\[1\]=-456\n"
-expect {
-    -re "set.*$prompt $"\
-       {
-       send "print v_signed_long_array\n"
-       expect {
-           -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $"       { pass "set variable signed long array" }
-           -re "$prompt $"                      { fail "set variable signed long array" }
-           timeout                              { fail "(timeout) set variable signed long array" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable signed long array" }
-    timeout                                      { fail "(timeout) set variable signed long array" }
-}                         
-
-
-
+test_set "set variable v_signed_long_array\[0\]=123" "set variable v_signed_long_array\[1\]=-456" "print v_signed_long_array" "print.*.\[0-9\]* =.*\{123,.*-456\}"        "set variable signed long array" 
 #
 # test "set variable" for "unsigned long array[2]"
 #
-send "set variable v_unsigned_long_array\[0\]=123\n"
-expect -re "$prompt $"
-send "set variable v_unsigned_long_array\[1\]=-456\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_unsigned_long_array\n"
-       expect {
-           -re "print.*.\[0-9\]* =.*\{123,.*$ulong_minus_456\}.*$prompt $"       { pass "set variable unsigned long array" }
-           -re "$prompt $"                      { fail "set variable unsigned long array" }
-           timeout                              { fail "(timeout) set variable unsigned long array" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable unsigned long array" }
-    timeout                                      { fail "(timeout) set variable unsigned long array" }
-}                         
-
-
+test_set "set variable v_unsigned_long_array\[0\]=123" "set variable v_unsigned_long_array\[1\]=-456" "print v_unsigned_long_array" "print.*.\[0-9\]* =.*\{123,.*$ulong_minus_456\}"        "set variable unsigned long array" 
 #
 # test "set variable" for "float array[2]"
 #
-send "set variable v_float_array\[0\]=123.0\n"
-expect -re "$prompt $"
-send "set variable v_float_array\[1\]=-456.0\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_float_array\n"
-       expect {
-           -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $"       { pass "set variable float array" }
-           -re "$prompt $"                      { fail "set variable float array" }
-           timeout                              { fail "(timeout) set variable float array" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable float array" }
-    timeout                                      { fail "(timeout) set variable float array" }
-}                         
-
-
+test_set "set variable v_float_array\[0\]=123.0" "set variable v_float_array\[1\]=-456.0" "print v_float_array" "print.*.\[0-9\]* =.*\{123,.*-456\}"        "set variable float array" 
 #
 # test "set variable" for "double array[2]"
 #
-send "set variable v_double_array\[0\]=123.0\n"
-expect -re "$prompt $"
-send "set variable v_double_array\[1\]=-456.0\n"
-expect {
-    -re "$prompt $"\
-       {
-       send "print v_double_array\n"
-       expect {
-           -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $"       { pass "set variable double array" }
-           -re "$prompt $"                      { fail "set variable double array" }
-           timeout                              { fail "(timeout) set variable double array" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable double array" }
-    timeout                                      { fail "(timeout) set variable double array" }
-}                         
-
-
+test_set "set variable v_double_array\[0\]=123.0" "set variable v_double_array\[1\]=-456.0" "print v_double_array" "print.*.\[0-9\]* =.*\{123,.*-456\}"        "set variable double array" 
 #
 # test "set variable" for type "char *"
 #
-send "set v_char_pointer=v_char_array\n"
-expect -re "set.*$prompt $"
-send "set variable *(v_char_pointer)='h'\n"
-expect -re "set.*$prompt $"
-send "set variable *(v_char_pointer+1)='i'\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_char_array\n"
-       expect {
-           -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" {
-               send "print *(v_char_pointer+1)\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 105 \'i\'.*$prompt $"    { pass "set variable char pointer=\"hi\" (string)" }
-                   -re "$prompt $"                              { fail "set variable char pointer=\"hi\" (string)" }
-                   timeout                              { fail "(timeout) set variable char pointer=\"hi\" (string)" }
-
-               }
-           }
-           -re "$prompt $"                              { fail "set variable char pointer=\"hi\" (string)" }
-           timeout                              { fail "(timeout) set variable char pointer=\"hi\" (string)" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable char pointer=\"hi\" (string)" }
-    timeout                                      { fail "(timeout) set variable char pointer=\"hi\" (string)" }
-}                         
-
-
+test_set "set v_char_pointer=v_char_array" "set variable *(v_char_pointer)='h'" "set variable *(v_char_pointer+1)='i'" "print v_char_array" "print.*.\[0-9\]* =.*\"hi\""  "print *(v_char_pointer+1)" "print.*.\[0-9\]* = 105 \'i\'"     "set variable char pointer=\"hi\" (string)" 
 #
 # test "set variable" for type "signed char *"
 #
-send "set v_signed_char_pointer=v_signed_char_array\n"
-expect -re "set.*$prompt $"
-send "set variable *(v_signed_char_pointer)='h'\n"
-expect -re "set.*$prompt $"
-send "set variable *(v_signed_char_pointer+1)='i'\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_char_array\n"
-       expect {
-           -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" {
-               send "print *(v_signed_char_pointer+1)\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 105 \'i\'.*$prompt $"    { pass "set variable signed char pointer=\"hi\" (string)" }
-                   -re "$prompt $"                { fail "set variable signed char pointer=\"hi\" (string)" }
-                   timeout                              { fail "(timeout) set variable signed char pointer=\"hi\" (string)" }
-
-               }
-           }
-           -re "$prompt $"                { fail "set variable signed char pointer=\"hi\" (string)" }
-           timeout                              { fail "(timeout) set variable signed char pointer=\"hi\" (string)" }
-       }
-    }
-    -re "$prompt $"                { fail "set variable signed char pointer=\"hi\" (string)" }
-    timeout                                      { fail "(timeout) set variable signed char pointer=\"hi\" (string)" }
-}                         
-
-
+test_set "set v_signed_char_pointer=v_signed_char_array" "set variable *(v_signed_char_pointer)='h'" "set variable *(v_signed_char_pointer+1)='i'" "print v_signed_char_array" "print.*.\[0-9\]* =.*\"hi\""  "print *(v_signed_char_pointer+1)" "print.*.\[0-9\]* = 105 \'i\'"     "set variable signed char pointer=\"hi\" (string)" 
 #
 # test "set variable" for type "unsigned char *"
 #
-send "set v_unsigned_char_pointer=v_unsigned_char_array\n"
-expect -re "set.*$prompt $"
-send "set variable *(v_unsigned_char_pointer)='h'\n"
-expect -re "set.*$prompt $"
-send "set variable *(v_unsigned_char_pointer+1)='i'\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_char_array\n"
-       expect {
-           -re "print.*.\[0-9\]* =.*\"hi\".*$prompt $" {
-               send "print *(v_unsigned_char_pointer+1)\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 105 \'i\'.*$prompt $"    { pass "set variable unsigned char pointer=\"hi\" (string)" }
-                   -re "$prompt $"                { fail "set variable unsigned char pointer=\"hi\" (string)" }
-                   timeout                              { fail "(timeout) set variable unsigned char pointer=\"hi\" (string)" }
-
-               }
-           }
-           -re "$prompt $"                { fail "set variable unsigned char pointer=\"hi\" (string)" }
-           timeout                              { fail "(timeout) set variable unsigned char pointer=\"hi\" (string)" }
-       }
-    }
-    -re "$prompt $"                { fail "set variable unsigned char pointer=\"hi\" (string)" }
-    timeout                                      { fail "(timeout) set variable unsigned char pointer=\"hi\" (string)" }
-}                         
-
-
+test_set "set v_unsigned_char_pointer=v_unsigned_char_array" "set variable *(v_unsigned_char_pointer)='h'" "set variable *(v_unsigned_char_pointer+1)='i'" "print v_unsigned_char_array" "print.*.\[0-9\]* =.*\"hi\""  "print *(v_unsigned_char_pointer+1)" "print.*.\[0-9\]* = 105 \'i\'"     "set variable unsigned char pointer=\"hi\" (string)" 
 #
 # test "set variable" for type "short *"
 #
-send "set v_short_pointer=v_short_array\n"
-expect -re "set.*$prompt $"
-send "set variable *(v_short_pointer)=123\n"
-expect -re "set.*$prompt $"
-send "set variable *(v_short_pointer+1)=-456\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_short_array\n"
-       expect {
-           -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
-               send "print *(v_short_pointer+1)\n"
-               expect {
-                   -re "print.*.\[0-9\]* = -456.*$prompt $"    { pass "set variable short pointer" }
-                   -re "$prompt $"                      { fail "set variable short pointer" }
-                   timeout                              { fail "(timeout) set variable short pointer" }
-
-               }
-           }
-           -re "$prompt $"                { fail "set variable short pointer" }
-           timeout                              { fail "(timeout) set variable short pointer" }
-       }
-    }
-    -re "$prompt $"                { fail "set variable short pointer" }
-    timeout                                      { fail "(timeout) set variable short pointer" }
-}                         
-
-
+test_set "set v_short_pointer=v_short_array" "set variable *(v_short_pointer)=123" "set variable *(v_short_pointer+1)=-456" "print v_short_array" "print.*.\[0-9\]* =.*\{123,.*-456\}"  "print *(v_short_pointer+1)" "print.*.\[0-9\]* = -456"     "set variable short pointer" 
 #
 # test "set variable" for type "signed short *"
 #
@@ -1472,8 +290,6 @@ gdb_test "set variable *(v_signed_short_pointer+1)=-456" ""
 gdb_test "print v_signed_short_array" ".\[0-9\]* =.*\{123,.*-456\}" \
     "set variable signed short pointer"
 gdb_test "print *(v_signed_short_pointer+1)" ".\[0-9\]*.*=.*-456"
-
-
 #
 # test "set variable" for type "unsigned short *"
 #
@@ -1483,346 +299,48 @@ gdb_test "set variable *(v_unsigned_short_pointer+1)=-456" ""
 gdb_test "print v_unsigned_short_array" ".\[0-9\]* =.*\{123,.*65080\}" \
     "set variable unsigned short pointer"
 gdb_test "print *(v_unsigned_short_pointer+1)" ".\[0-9\]* = 65080"
-
-
 #
 # test "set variable" for type "int *"
 #
-send "set v_int_pointer=v_int_array\n"
-expect -re "set.*$prompt $"
-send "set variable *(v_int_pointer)=123\n"
-expect -re "set.*$prompt $"
-send "set variable *(v_int_pointer+1)=-456\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_int_array\n"
-       expect {
-           -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
-               send "print *(v_int_pointer+1)\n"
-               expect {
-                   -re "print.*.\[0-9\]* = -456.*$prompt $"    { pass "set variable int pointer" }
-                   -re "$prompt $"                { fail "set variable int pointer" }
-                   timeout                              { fail "(timeout) set variable int pointer" }
-
-               }
-           }
-           -re "$prompt $"                { fail "set variable int pointer" }
-           timeout                              { fail "(timeout) set variable int pointer" }
-       }
-    }
-    -re "$prompt $"                { fail "set variable int pointer" }
-     timeout                                      { fail "(timeout) set variable int pointer" }
-}                         
-
-
+test_set "set v_int_pointer=v_int_array" "set variable *(v_int_pointer)=123" "set variable *(v_int_pointer+1)=-456" "print v_int_array" "print.*.\[0-9\]* =.*\{123,.*-456\}"  "print *(v_int_pointer+1)" "print.*.\[0-9\]* = -456"     "set variable int pointer" 
 #
 # test "set variable" for type "signed int *"
 #
-send "set v_signed_int_pointer=v_signed_int_array\n"
-expect -re "set.*$prompt $"
-send "set variable *(v_signed_int_pointer)=123\n"
-expect -re "set.*$prompt $"
-send "set variable *(v_signed_int_pointer+1)=-456\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_int_array\n"
-       expect {
-           -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
-               send "print *(v_signed_int_pointer+1)\n"
-               expect {
-                   -re "print.*.\[0-9\]* = -456.*$prompt $"    { pass "set variable signed int pointer" }
-                   -re "$prompt $"                { fail "set variable signed int pointer" }
-                   timeout                              { fail "(timeout) set variable signed int pointer" }
-
-               }
-           }
-           -re "$prompt $"                { fail "set variable signed int pointer" }
-           timeout                              { fail "(timeout) set variable signed int pointer" }
-       }
-    }
-    -re "$prompt $"                { fail "set variable signed int pointer" }
-       timeout                                      { fail "(timeout) set variable signed int pointer" }
-}                         
-
-
+test_set "set v_signed_int_pointer=v_signed_int_array" "set variable *(v_signed_int_pointer)=123" "set variable *(v_signed_int_pointer+1)=-456" "print v_signed_int_array" "print.*.\[0-9\]* =.*\{123,.*-456\}"  "print *(v_signed_int_pointer+1)" "print.*.\[0-9\]* = -456"     "set variable signed int pointer" 
 #
 # test "set variable" for type "unsigned int *"
 #
-send "set v_unsigned_int_pointer=v_unsigned_int_array\n"
-expect -re "set.*$prompt $"
-send "set variable *(v_unsigned_int_pointer)=123\n"
-expect -re "set.*$prompt $"
-send "set variable *(v_unsigned_int_pointer+1)=-456\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_int_array\n"
-       expect {
-           -re "print.*.\[0-9\]* =.*\{123,.*4294966840\}.*$prompt $" {
-               send "print *(v_unsigned_int_pointer+1)\n"
-               expect {
-                   -re "print.*.\[0-9\]* = 4294966840.*$prompt $"    { pass "set variable unsigned int pointer" }
-                   -re "$prompt $"                { fail "set variable unsigned int pointer" }
-                   timeout                              { fail "(timeout) set variable unsigned int pointer" }
-
-               }
-           }
-           -re "$prompt $"                { fail "set variable unsigned int pointer" }
-           timeout                              { fail "(timeout) set variable unsigned int pointer" }
-       }
-    }
-    -re "$prompt $"                { fail "set variable unsigned int pointer" }
-    timeout                                      { fail "(timeout) set variable unsigned int pointer" }
-}                         
-
-
+test_set "set v_unsigned_int_pointer=v_unsigned_int_array" "set variable *(v_unsigned_int_pointer)=123" "set variable *(v_unsigned_int_pointer+1)=-456" "print v_unsigned_int_array" "print.*.\[0-9\]* =.*\{123,.*(4294966840|65080)\}" "set variable unsigned int pointer"
+test_set "" "print *(v_unsigned_int_pointer+1)" "print.*.\[0-9\]* = (4294966840|65080)"     "print variable unsigned int pointer+1"
 #
 # test "set variable" for type "long *"
 #
-send "set v_long_pointer=v_long_array\n"
-expect -re "set.*$prompt $"
-send "set variable *(v_long_pointer)=123\n"
-expect -re "set.*$prompt $"
-send "set variable *(v_long_pointer+1)=-456\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_long_array\n"
-       expect {
-           -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
-               send "print *(v_long_pointer+1)\n"
-               expect {
-                   -re "print.*.\[0-9\]* = -456.*$prompt $"    { pass "set variable long pointer" }
-                   -re "$prompt $"                { fail "set variable long pointer" }
-                   timeout                              { fail "(timeout) set variable long pointer" }
-
-               }
-           }
-           -re "$prompt $"                { fail "set variable long pointer" }
-           timeout                              { fail "(timeout) set variable long pointer" }
-       }
-    }
-    -re "$prompt $"                { fail "set variable long pointer" }
-     timeout                                      { fail "(timeout) set variable long pointer" }
-}                         
-
-
+test_set "set v_long_pointer=v_long_array" "set variable *(v_long_pointer)=123" "set variable *(v_long_pointer+1)=-456" "print v_long_array" "print.*.\[0-9\]* =.*\{123,.*-456\}"  "print *(v_long_pointer+1)" "print.*.\[0-9\]* = -456"     "set variable long pointer" 
 #
 # test "set variable" for type "signed long *"
 #
-send "set v_signed_long_pointer=v_signed_long_array\n"
-expect -re "set.*$prompt $"
-send "set variable *(v_signed_long_pointer)=123\n"
-expect -re "set.*$prompt $"
-send "set variable *(v_signed_long_pointer+1)=-456\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_signed_long_array\n"
-       expect {
-           -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
-               send "print *(v_signed_long_pointer+1)\n"
-               expect {
-                   -re "print.*.\[0-9\]* = -456.*$prompt $"    { pass "set variable signed long pointer" }
-                   -re "$prompt $"                { fail "set variable signed long pointer" }
-                   timeout                              { fail "(timeout) set variable signed long pointer" }
-
-               }
-           }
-           -re "$prompt $"                { fail "set variable signed long pointer" }
-           timeout                              { fail "(timeout) set variable signed long pointer" }
-       }
-    }
-    -re "$prompt $"                { fail "set variable signed long pointer" }
-       timeout                                      { fail "(timeout) set variable signed long pointer" }
-}                         
-
-
+test_set "set v_signed_long_pointer=v_signed_long_array" "set variable *(v_signed_long_pointer)=123" "set variable *(v_signed_long_pointer+1)=-456" "print v_signed_long_array" "print.*.\[0-9\]* =.*\{123,.*-456\}"  "print *(v_signed_long_pointer+1)" "print.*.\[0-9\]* = -456"     "set variable signed long pointer" 
 #
 # test "set variable" for type "unsigned long *"
 #
-send "set v_unsigned_long_pointer=v_unsigned_long_array\n"
-expect -re "set.*$prompt $"
-send "set variable *(v_unsigned_long_pointer)=123\n"
-expect -re "set.*$prompt $"
-send "set variable *(v_unsigned_long_pointer+1)=-456\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_unsigned_long_array\n"
-       expect {
-           -re "print.*.\[0-9\]* =.*\{123,.*$ulong_minus_456\}.*$prompt $" {
-               send "print *(v_unsigned_long_pointer+1)\n"
-               expect {
-                   -re "print.*.\[0-9\]* = $ulong_minus_456.*$prompt $"    { pass "set variable unsigned long pointer" }
-                   -re "$prompt $"                { fail "set variable unsigned long pointer" }
-                   timeout                              { fail "(timeout) set variable unsigned long pointer" }
-
-               }
-           }
-           -re "$prompt $"                { fail "set variable unsigned long pointer" }
-           timeout                              { fail "(timeout) set variable unsigned long pointer" }
-       }
-    }
-    -re "$prompt $"                { fail "set variable unsigned long pointer" }
-    timeout                                      { fail "(timeout) set variable unsigned long pointer" }
-}                         
-
-
+test_set "set v_unsigned_long_pointer=v_unsigned_long_array" "set variable *(v_unsigned_long_pointer)=123" "set variable *(v_unsigned_long_pointer+1)=-456" "print v_unsigned_long_array" "print.*.\[0-9\]* =.*\{123,.*$ulong_minus_456\}"  "print *(v_unsigned_long_pointer+1)" "print.*.\[0-9\]* = $ulong_minus_456"     "set variable unsigned long pointer" 
 #
 # test "set variable" for type "float *"
 #
-send "set v_float_pointer=v_float_array\n"
-expect -re "set.*$prompt $"
-send "set variable *(v_float_pointer)=123.0\n"
-expect -re "set.*$prompt $"
-send "set variable *(v_float_pointer+1)=-456.0\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_float_array\n"
-       expect {
-           -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
-               send "print *(v_float_pointer+1)\n"
-               expect {
-                   -re "print.*.\[0-9\]* = -456.*$prompt $"    { pass "set variable float pointer" }
-                   -re "$prompt $"                { fail "set variable float pointer" }
-                   timeout                              { fail "(timeout) set variable float pointer" }
-
-               }
-           }
-           -re "$prompt $"                { fail "set variable float pointer" }
-           timeout                              { fail "(timeout) set variable float pointer" }
-       }
-    }
-    -re "$prompt $"                { fail "set variable float pointer" }
-     timeout                                      { fail "(timeout) set variable float pointer" }
-}                         
-
-
+test_set "set v_float_pointer=v_float_array" "set variable *(v_float_pointer)=123.0" "set variable *(v_float_pointer+1)=-456.0" "print v_float_array" "print.*.\[0-9\]* =.*\{123,.*-456\}"  "print *(v_float_pointer+1)" "print.*.\[0-9\]* = -456"     "set variable float pointer" 
 #
 # test "set variable" for type "double *"
 #
-send "set v_double_pointer=v_double_array\n"
-expect -re "set.*$prompt $"
-send "set variable *(v_double_pointer)=123.0\n"
-expect -re "set.*$prompt $"
-send "set variable *(v_double_pointer+1)=-456.0\n"
-expect {
-    -re "set.*$prompt $" {
-       send "print v_double_array\n"
-       expect {
-           -re "print.*.\[0-9\]* =.*\{123,.*-456\}.*$prompt $" {
-               send "print *(v_double_pointer+1)\n"
-               expect {
-                   -re "print.*.\[0-9\]* = -456.*$prompt $"    { pass "set variable double pointer" }
-                   -re "$prompt $"                { fail "set variable double pointer" }
-                   timeout                              { fail "(timeout) set variable double pointer" }
-
-               }
-           }
-           -re "$prompt $"                { fail "set variable double pointer" }
-           timeout                              { fail "(timeout) set variable double pointer" }
-       }
-    }
-    -re "$prompt $"                { fail "set variable double pointer" }
-     timeout                                      { fail "(timeout) set variable double pointer" }
-}                         
-
-
+test_set "set v_double_pointer=v_double_array" "set variable *(v_double_pointer)=123.0" "set variable *(v_double_pointer+1)=-456.0" "print v_double_array" "print.*.\[0-9\]* =.*\{123,.*-456\}"  "print *(v_double_pointer+1)" "print.*.\[0-9\]* = -456"     "set variable double pointer" 
 #
 # test "set variable" for struct members
 #
-send "set variable v_struct1.v_char_member='h'\n"
-expect {
-    -re "set.*$prompt $"\
-       {
-       send "print v_struct1.v_char_member\n"
-       expect {
-           -re "print.*.\[0-9\]* = 104 \'h\'.*$prompt $"       { pass "set variable structure char member" }
-           -re "$prompt $"                      { fail "set variable structure char member" }
-           timeout                              { fail "(timeout) set variable structure char member" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable structure char member" }
-    timeout                                      { fail "(timeout) set variable structure char member" }
-}                         
-
-
-send "set variable v_struct1.v_short_member=1\n"
-expect {
-    -re "set.*$prompt $"\
-       {
-       send "print v_struct1.v_short_member\n"
-       expect {
-           -re "print.*.\[0-9\]* = 1.*$prompt $"       { pass "set variable structure short member" }
-           -re "$prompt $"                      { fail "set variable structure short member" }
-           timeout                              { fail "(timeout) set variable structure short member" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable structure short member" }
-    timeout                                      { fail "(timeout) set variable structure short member" }
-}                         
-
-
-send "set variable v_struct1.v_int_member=2\n"
-expect {
-    -re "set.*$prompt $"\
-       {
-       send "print v_struct1.v_int_member\n"
-       expect {
-           -re "print.*.\[0-9\]* = 2.*$prompt $"       { pass "set variable structure int member" }
-           -re "$prompt $"                      { fail "set variable structure int member" }
-           timeout                              { fail "(timeout) set variable structure int member" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable structure int member" }
-    timeout                                      { fail "(timeout) set variable structure int member" }
-}                         
-
-
-send "set variable v_struct1.v_long_member=3\n"
-expect {
-    -re "set.*$prompt $"\
-       {
-       send "print v_struct1.v_long_member\n"
-       expect {
-           -re "print.*.\[0-9\]* = 3.*$prompt $"       { pass "set variable structure long member" }
-           -re "$prompt $"                      { fail "set variable structure long member" }
-           timeout                              { fail "(timeout) set variable structure long member" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable structure long member" }
-    timeout                                      { fail "(timeout) set variable structure long member" }
-}                         
-
-
-send "set variable v_struct1.v_float_member=4.0\n"
-expect {
-    -re "set.*$prompt $"\
-       {
-       send "print v_struct1.v_float_member\n"
-       expect {
-           -re "print.*.\[0-9\]* = 4.*$prompt $"       { pass "set variable structure float member" }
-           -re "$prompt $"                      { fail "set variable structure float member" }
-           timeout                              { fail "(timeout) set variable structure float member" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable structure float member" }
-    timeout                                      { fail "(timeout) set variable structure float member" }
-}                         
-
-
-send "set variable v_struct1.v_double_member=5.0\n"
-expect {
-    -re "set.*$prompt $"\
-       {
-       send "print v_struct1.v_double_member\n"
-       expect {
-           -re "print.*.\[0-9\]* = 5.*$prompt $"       { pass "set variable structure double member" }
-           -re "$prompt $"                      { fail "set variable structure double member" }
-           timeout                              { fail "(timeout) set variable structure double member" }
-       }
-    }
-    -re "$prompt $"                              { fail "set variable structure double member" }
-    timeout                                      { fail "(timeout) set variable structure double member" }
-}                         
-
+test_set "set variable v_struct1.v_char_member='h'" "print v_struct1.v_char_member" "print.*.\[0-9\]* = 104 \'h\'"        "set variable structure char member" 
+test_set "set variable v_struct1.v_short_member=1" "print v_struct1.v_short_member" "print.*.\[0-9\]* = 1"        "set variable structure short member" 
+test_set "set variable v_struct1.v_int_member=2" "print v_struct1.v_int_member" "print.*.\[0-9\]* = 2"        "set variable structure int member" 
+test_set "set variable v_struct1.v_long_member=3" "print v_struct1.v_long_member" "print.*.\[0-9\]* = 3"        "set variable structure long member" 
+test_set "set variable v_struct1.v_float_member=4.0" "print v_struct1.v_float_member" "print.*.\[0-9\]* = 4"        "set variable structure float member" 
+test_set "set variable v_struct1.v_double_member=5.0" "print v_struct1.v_double_member" "print.*.\[0-9\]* = 5"        "set variable structure double member" 
 
 gdb_test "print v_struct1" \
   "print.*.\[0-9\]* = \{.*v_char_member = 104 \'h\',.*v_short_member = 1,\
index 9e15f5a544a1033c02876166648efafb392082de..80cd3b613c1ed59c9a5b47f5c6b6909907e966ce 100644 (file)
@@ -26,12 +26,14 @@ if $tracelevel then {
 set prms_id 0
 set bug_id 0
 
+gdb_exit
+gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 
 set testfile sigall
-set srcfile ${srcdir}/$subdir/${testfile}.c
+set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
-if  { [compile "${srcfile} -g -o ${binfile}"] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     perror "Couldn't compile ${srcfile}"
     return -1
 }
@@ -51,15 +53,12 @@ proc test_one_sig {nextsig} {
     gdb_test "b handle_$thissig" "Breakpoint \[0-9\]+ .*"
     gdb_test "b gen_$nextsig" "Breakpoint \[0-9\]+ .*"
 
-    if {$thissig == "ALRM"} then {
-       setup_xfail "*-*-irix4*"
-    }
     set need_another_continue 1
     set missed_handler 0
     if $this_sig_supported then {
-       send "continue\n"
+       send_gdb "continue\n"
        if { $thissig == "IO" } {
-           setup_xfail "i*86-*-linuxoldld" "i*86-*-linuxaout"
+           setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
        }
        expect {
            -re "Continuing.*Program received signal SIG$thissig.*$prompt $" {
@@ -87,9 +86,9 @@ proc test_one_sig {nextsig} {
     }
 
     if $need_another_continue then {
-       send "continue\n"
+       send_gdb "continue\n"
        if { $thissig == "URG" } {
-           setup_xfail "i*86-*-linuxoldld" "i*86-*-linuxaout"
+           setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
        }
         # Either Lynx or GDB screws up on SIGPRIO
        if { $thissig == "PRIO" } {
@@ -107,7 +106,7 @@ proc test_one_sig {nextsig} {
     }
 
     if { $missed_handler == "0" } then {
-        send "signal 0\n"
+        send_gdb "signal 0\n"
         expect {
            -re "Breakpoint.*gen_$nextsig.*kill.*$prompt $" {
                pass "advance to $nextsig"
index 48ee6edbaf69595827cb1d94e08be013d3538544..cb3094f1673ef25a23727e15f1d26bf8c6a9bb60 100644 (file)
@@ -13,19 +13,16 @@ set bug_id 0
 set testfile signals
 set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
-if  { [compile "${srcdir}/${subdir}/${srcfile} -g -o ${binfile}"] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     perror "Couldn't compile ${srcfile}"
     return -1
 }
 
 # Create and source the file that provides information about the compiler
 # used to compile the test case.
-execute_anywhere "rm -f ${binfile}.ci"
-if  { [compile "-E ${srcdir}/${subdir}/compiler.c > ${binfile}.ci"] != "" } {
-    perror "Couldn't make ${binfile}.ci file"
-    return -1
+if [get_compiler_info ${binfile}] {
+    return -1;
 }
-source ${binfile}.ci
 
 proc signal_tests_1 {} {
     global prompt
@@ -37,7 +34,7 @@ proc signal_tests_1 {} {
        gdb_test "next" "\\+\\+count; /\\* first \\*/" \
                "next over alarm (1)"
        # An alarm has been signaled, give the signal time to get delivered.
-       exec sleep 2
+       sleep 2
 
        # i386 BSD currently fails the next test with a SIGTRAP.
        setup_xfail "i*86-*-bsd*"
@@ -51,8 +48,8 @@ proc signal_tests_1 {} {
        # linux (aout versions) also fails with "next" acting like "continue"
        # this is probably more dependant on the kernel version than on the
        # object file format or utils.  (sigh)
-       setup_xfail "i*86-*-linuxaout" "i*86-*-linuxoldld"
-       send "next\n"
+       setup_xfail "i*86-pc-linuxaout-gnu" "i*86-pc-linuxoldld-gnu"
+       send_gdb "next\n"
        expect {
            -re "alarm .*$prompt $" { pass "next to 2nd alarm (1)" }
            -re "Program received signal SIGTRAP.*first.*$prompt $" {
@@ -127,11 +124,11 @@ proc signal_tests_1 {} {
        gdb_test "next" "\\+\\+count; /\\* second \\*/" \
            "next to 2nd ++count in signals_tests_1"
        # An alarm has been signaled, give the signal time to get delivered.
-       exec sleep 2
+       sleep 2
 
        set bash_bug 0
-       send "next\n"
-       setup_xfail "i*86-*-linux"
+       send_gdb "next\n"
+       setup_xfail "i*86-pc-linux-gnu"
        expect {
            -re "Breakpoint.*handler.*$prompt $" {
                pass "next to handler in signals_tests_1"
@@ -151,7 +148,7 @@ proc signal_tests_1 {} {
        # This doesn't test that main is frame #2, just that main is frame
        # #2, #3, or higher.  At some point this should be fixed (but
        # it quite possibly would introduce new FAILs on some systems).
-       setup_xfail "i*86-*-linux" "i*86-*-bsdi2.0"
+       setup_xfail "i*86-pc-linux-gnu" "i*86-*-bsdi2.0"
        gdb_test "backtrace" "#0.*handler.*#1.*#2.*main.*" \
            "backtrace in signals_tests_1"
 
@@ -162,8 +159,8 @@ proc signal_tests_1 {} {
        # a SIGTRAP, but with different symptoms.
        setup_xfail "vax-*-ultrix*"
        setup_xfail "i*86-*-bsd*"
-       setup_xfail "i*86-*-linux"
-       send "continue\n"
+       setup_xfail "i*86-pc-linux-gnu"
+       send_gdb "continue\n"
        expect {
            -re "Breakpoint.*func1.*$prompt $" { pass "continue to func1" }
            -re "Program received signal SIGTRAP.*second.*$prompt $" {
@@ -193,8 +190,7 @@ proc signal_tests_1 {} {
        }
 
        setup_xfail "*-*-irix*"
-       setup_xfail "i*86-*-linux"
-       send "signal SIGUSR1\n"
+       send_gdb "signal SIGUSR1\n"
        expect {
            -re "Breakpoint.*handler.*$prompt $" { pass "signal SIGUSR1" }
            -re "Program received signal SIGUSR1.*$prompt $" {
@@ -219,7 +215,7 @@ proc signal_tests_1 {} {
        # anytime soon.
 
        setup_xfail "*-*-*"
-       send "continue\n"
+       send_gdb "continue\n"
        expect {
            -re "Breakpoint.*func2.*$prompt $" { pass "continue to func2" }
            -re "Breakpoint.*func1.*$prompt $" {
@@ -231,7 +227,7 @@ proc signal_tests_1 {} {
            default { fail "continue to func2" }
        }
 
-       exec sleep 2
+       sleep 2
 
         # GDB yanks out the breakpoints to step over the breakpoint it
         # stopped at, which means the breakpoint at handler is yanked.
@@ -249,7 +245,7 @@ proc signal_tests_1 {} {
            setup_xfail "m68*-*-sunos4*"
        }
 
-       setup_xfail "i*86-*-linux"
+       setup_xfail "i*86-pc-linux-gnu"
        gdb_test "continue" "Breakpoint.*handler.*" "continue to handler"
 
        # If the NO_SINGLE_STEP failure happened, we have already exited.
@@ -300,252 +296,17 @@ gdb_start
 # This will need to be updated as the exact list of signals changes,
 # but I want to test that TARGET_SIGNAL_0, TARGET_SIGNAL_DEFAULT, and
 # TARGET_SIGNAL_UNKNOWN are skipped.
-# Increase expect input buffer for large output from gdb.
-# Allow blank or TAB as whitespace characters and test individually for
-# each specific signal.
-
 proc test_handle_all_print {} {
+    global timeout
+    # Increase timeout and expect input buffer for large output from gdb.
+    # Allow blank or TAB as whitespace characters.
+    set oldtimeout $timeout
+    set timeout [expr "$timeout + 360"]
+    verbose "Timeout is now $timeout seconds" 2
     match_max 10000
-    gdb_test "handle all print" \
-        "Signal\[ \t\]+Stop\[ \t\]+Print\[ \t\]+Pass to program\[ \t\]+Description\r\n.*" \
-        "handle all print - Output headers"
-    gdb_test "handle all print" \
-        ".*SIGHUP\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Hangup\r\n.*" \
-        "handle all print - Hangup"
-    gdb_test "handle all print" \
-        ".*SIGQUIT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Quit\r\n.*" \
-        "handle all print - Quit"
-    gdb_test "handle all print" \
-        ".*SIGILL\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Illegal instruction\r\n.*" \
-        "handle all print - Illegal instruction"
-    gdb_test "handle all print" \
-        ".*SIGABRT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Aborted\r\n.*" \
-        "handle all print - Aborted"
-    gdb_test "handle all print" \
-        ".*SIGEMT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Emulation trap\r\n.*" \
-        "handle all print - Emulation trap"
-    gdb_test "handle all print" \
-        ".*SIGFPE\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Arithmetic exception\r\n.*" \
-        "handle all print - Arithmetic exception"
-    gdb_test "handle all print" \
-        ".*SIGKILL\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Killed\r\n.*" \
-        "handle all print - Killed"
-    gdb_test "handle all print" \
-        ".*SIGBUS\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Bus error\r\n.*" \
-        "handle all print - Bus error"
-    gdb_test "handle all print" \
-        ".*SIGSEGV\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Segmentation fault\r\n.*" \
-        "handle all print - Segmentation fault"
-    gdb_test "handle all print" \
-        ".*SIGSYS\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Bad system call\r\n.*" \
-        "handle all print - Bad system call"
-    gdb_test "handle all print" \
-        ".*SIGPIPE\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Broken pipe\r\n.*" \
-        "handle all print - Broken pipe"
-    gdb_test "handle all print" \
-        ".*SIGALRM\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Alarm clock\r\n.*" \
-        "handle all print - Alarm clock"
-    gdb_test "handle all print" \
-        ".*SIGTERM\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Terminated\r\n.*" \
-        "handle all print - Terminated"
-    gdb_test "handle all print" \
-        ".*SIGURG\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Urgent I/O condition\r\n.*" \
-        "handle all print - Urgent I/O condition"
-    gdb_test "handle all print" \
-        ".*SIGSTOP\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Stopped \\(signal\\)\r\n.*" \
-        "handle all print - Stopped (signal)"
-    gdb_test "handle all print" \
-        ".*SIGTSTP\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Stopped \\(user\\)\r\n.*" \
-        "handle all print - Stopped (user)"
-    gdb_test "handle all print" \
-        ".*SIGCONT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Continued\r\n.*" \
-        "handle all print - Continued"
-    gdb_test "handle all print" \
-        ".*SIGCHLD\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Child status changed\r\n.*" \
-        "handle all print - Child status changed"
-    gdb_test "handle all print" \
-        ".*SIGTTIN\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Stopped \\(tty input\\)\r\n.*" \
-        "handle all print - Stopped (tty input)"
-    gdb_test "handle all print" \
-        ".*SIGTTOU\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Stopped \\(tty output\\)\r\n.*" \
-        "handle all print - Stopped (tty output)"
-    gdb_test "handle all print" \
-        ".*SIGIO\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+I/O possible\r\n.*" \
-        "handle all print - I/O possible"
-    gdb_test "handle all print" \
-        ".*SIGXCPU\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+CPU time limit exceeded\r\n.*" \
-        "handle all print - CPU time limit exceeded"
-    gdb_test "handle all print" \
-        ".*SIGXFSZ\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+File size limit exceeded\r\n.*" \
-        "handle all print - File size limit exceeded"
-    gdb_test "handle all print" \
-        ".*SIGVTALRM\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Virtual timer expired\r\n.*" \
-        "handle all print - Virtual timer expired"
-    gdb_test "handle all print" \
-        ".*SIGPROF\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Profiling timer expired\r\n.*" \
-        "handle all print - Profiling timer expired"
-    gdb_test "handle all print" \
-        ".*SIGWINCH\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Window size changed\r\n.*" \
-        "handle all print - Window size changed"
-    gdb_test "handle all print" \
-        ".*SIGLOST\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Resource lost\r\n.*" \
-        "handle all print - Resource lost"
-    gdb_test "handle all print" \
-        ".*SIGUSR1\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+User defined signal 1\r\n.*" \
-        "handle all print - User defined signal 1"
-    gdb_test "handle all print" \
-        ".*SIGUSR2\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+User defined signal 2\r\n.*" \
-        "handle all print - User defined signal 2"
-    gdb_test "handle all print" \
-        ".*SIGPWR\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Power fail/restart\r\n.*" \
-        "handle all print - Power fail/restart"
-    gdb_test "handle all print" \
-        ".*SIGPOLL\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Pollable event occurred\r\n.*" \
-        "handle all print - Pollable event occurred"
-    gdb_test "handle all print" \
-        ".*SIGWIND\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+SIGWIND\r\n.*" \
-        "handle all print - SIGWIND"
-    gdb_test "handle all print" \
-        ".*SIGPHONE\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+SIGPHONE\r\n.*" \
-        "handle all print - SIGPHONE"
-    gdb_test "handle all print" \
-        ".*SIGWAITING\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Process's LWPs are blocked\r\n.*" \
-        "handle all print - Process's LWPs are blocked"
-    gdb_test "handle all print" \
-        ".*SIGLWP\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Signal LWP\r\n.*" \
-        "handle all print - Signal LWP"
-    gdb_test "handle all print" \
-        ".*SIGDANGER\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Swap space dangerously low\r\n.*" \
-        "handle all print - Swap space dangerously low"
-    gdb_test "handle all print" \
-        ".*SIGGRANT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Monitor mode granted\r\n.*" \
-        "handle all print - Monitor mode granted"
-    gdb_test "handle all print" \
-        ".*SIGRETRACT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Need to relinguish monitor mode\r\n.*" \
-        "handle all print - Need to relinguish monitor mode"
-    gdb_test "handle all print" \
-        ".*SIGMSG\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Monitor mode data available\r\n.*" \
-        "handle all print - Monitor mode data available"
-    gdb_test "handle all print" \
-        ".*SIGSOUND\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Sound completed\r\n.*" \
-        "handle all print - Sound completed"
-    gdb_test "handle all print" \
-        ".*SIGSAK\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Secure attention\r\n.*" \
-        "handle all print - Secure attention"
-    gdb_test "handle all print" \
-        ".*SIGPRIO\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+SIGPRIO\r\n.*" \
-        "handle all print - SIGPRIO"
-    gdb_test "handle all print" \
-        ".*SIG33\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 33\r\n.*" \
-        "handle all print - Real-time event 33"
-    gdb_test "handle all print" \
-        ".*SIG34\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 34\r\n.*" \
-        "handle all print - Real-time event 34"
-    gdb_test "handle all print" \
-        ".*SIG35\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 35\r\n.*" \
-        "handle all print - Real-time event 35"
-    gdb_test "handle all print" \
-        ".*SIG36\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 36\r\n.*" \
-        "handle all print - Real-time event 36"
-    gdb_test "handle all print" \
-        ".*SIG37\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 37\r\n.*" \
-        "handle all print - Real-time event 37"
-    gdb_test "handle all print" \
-        ".*SIG38\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 38\r\n.*" \
-        "handle all print - Real-time event 38"
-    gdb_test "handle all print" \
-        ".*SIG39\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 39\r\n.*" \
-        "handle all print - Real-time event 39"
-    gdb_test "handle all print" \
-        ".*SIG40\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 40\r\n.*" \
-        "handle all print - Real-time event 40"
-    gdb_test "handle all print" \
-        ".*SIG41\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 41\r\n.*" \
-        "handle all print - Real-time event 41"
-    gdb_test "handle all print" \
-        ".*SIG42\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 42\r\n.*" \
-        "handle all print - Real-time event 42"
-    gdb_test "handle all print" \
-        ".*SIG43\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 43\r\n.*" \
-        "handle all print - Real-time event 43"
-    gdb_test "handle all print" \
-        ".*SIG44\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 44\r\n.*" \
-        "handle all print - Real-time event 44"
-    gdb_test "handle all print" \
-        ".*SIG45\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 45\r\n.*" \
-        "handle all print - Real-time event 45"
-    gdb_test "handle all print" \
-        ".*SIG46\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 46\r\n.*" \
-        "handle all print - Real-time event 46"
-    gdb_test "handle all print" \
-        ".*SIG47\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 47\r\n.*" \
-        "handle all print - Real-time event 47"
-    gdb_test "handle all print" \
-        ".*SIG48\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 48\r\n.*" \
-        "handle all print - Real-time event 48"
-    gdb_test "handle all print" \
-        ".*SIG49\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 49\r\n.*" \
-        "handle all print - Real-time event 49"
-    gdb_test "handle all print" \
-        ".*SIG50\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 50\r\n.*" \
-        "handle all print - Real-time event 50"
-    gdb_test "handle all print" \
-        ".*SIG51\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 51\r\n.*" \
-        "handle all print - Real-time event 51"
-    gdb_test "handle all print" \
-        ".*SIG52\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 52\r\n.*" \
-        "handle all print - Real-time event 52"
-    gdb_test "handle all print" \
-        ".*SIG53\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 53\r\n.*" \
-        "handle all print - Real-time event 53"
-    gdb_test "handle all print" \
-        ".*SIG54\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 54\r\n.*" \
-        "handle all print - Real-time event 54"
-    gdb_test "handle all print" \
-        ".*SIG55\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 55\r\n.*" \
-        "handle all print - Real-time event 55"
-    gdb_test "handle all print" \
-        ".*SIG56\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 56\r\n.*" \
-        "handle all print - Real-time event 56"
-    gdb_test "handle all print" \
-        ".*SIG57\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 57\r\n.*" \
-        "handle all print - Real-time event 57"
-    gdb_test "handle all print" \
-        ".*SIG58\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 58\r\n.*" \
-        "handle all print - Real-time event 58"
-    gdb_test "handle all print" \
-        ".*SIG59\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 59\r\n.*" \
-        "handle all print - Real-time event 59"
-    gdb_test "handle all print" \
-        ".*SIG60\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 60\r\n.*" \
-        "handle all print - Real-time event 60"
-    gdb_test "handle all print" \
-        ".*SIG61\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 61\r\n.*" \
-        "handle all print - Real-time event 61"
-    gdb_test "handle all print" \
-        ".*SIG62\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 62\r\n.*" \
-        "handle all print - Real-time event 62"
-    gdb_test "handle all print" \
-        ".*SIG63\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Real-time event 63\r\n.*" \
-        "handle all print - Real-time event 63"
-    gdb_test "handle all print" \
-        ".*EXC_BAD_ACCESS\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Could not access memory\r\n.*" \
-        "handle all print - Could not access memory"
-    gdb_test "handle all print" \
-        ".*EXC_BAD_INSTRUCTION\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Illegal instruction/operand\r\n.*" \
-        "handle all print - Illegal instruction/operand"
-    gdb_test "handle all print" \
-        ".*EXC_ARITHMETIC\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Arithmetic exception\r\n.*" \
-        "handle all print - Arithmetic exception"
-    gdb_test "handle all print" \
-        ".*EXC_EMULATION\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Emulation instruction\r\n.*" \
-        "handle all print - Emulation instruction"
-    gdb_test "handle all print" \
-        ".*EXC_SOFTWARE\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Software generated exception\r\n.*" \
-        "handle all print - Software generated exception"
-    gdb_test "handle all print" \
-        ".*EXC_BREAKPOINT\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Breakpoint.*" \
-        "handle all print - Breakpoint"
+    gdb_test "handle all print" "Signal\[      \]+Stop\[       \]+Print\[      \]+Pass to program\[    \]+Description\r\nSIGHUP\[      \]+Yes\[        \]+Yes\[        \]+Yes\[        \]+Hangup.*SIG63\[      \]+Yes\[        \]+Yes\[        \]+Yes\[        \]+Real-time event 63.*EXC_BREAKPOINT\[         \]+Yes\[        \]+Yes\[        \]+Yes\[        \]+Breakpoint"
+    set timeout $oldtimeout
+    verbose "Timeout restored to $timeout seconds" 2
 }
 test_handle_all_print
 
@@ -557,7 +318,7 @@ signal_tests_1
 
 # Force a resync, so we're looking at the right prompt.  On SCO we
 # were getting out of sync (I don't understand why).
-send "p 1+1\n"
+send_gdb "p 1+1\n"
 expect {
     -re "= 2.*$prompt $" {}
     -re ".*$prompt $" { perror "sync trouble in signals.exp" }
@@ -574,7 +335,7 @@ if [runto_main] then {
     gdb_test "next" "\\+\\+count; /\\* first \\*/" \
        "next to ++count #1 in signals.exp"
     # Give the signal time to get delivered
-    exec sleep 2
+    sleep 2
 
     # Now call a function.  When GDB tries to run the stack dummy,
     # it will hit the breakpoint at handler.  Provided it doesn't
@@ -596,7 +357,7 @@ if [runto_main] then {
     gdb_test "next" "alarm \\(.*" "next to alarm #2 in signals.exp"
     gdb_test "next" "\\+\\+count; /\\* second \\*/" \
        "next to ++count #2 in signals.exp"
-    exec sleep 2
+    sleep 2
 
     # This time we stop when GDB tries to run the stack dummy.
     # So it is OK that we do not print the return value from the function.
index 327ce3a19323db45a83ae65516dcef27d92e089e..88f9a5c87d19138536cec4a0c11a19cf43374533 100644 (file)
@@ -26,32 +26,27 @@ if $tracelevel then {
 set prms_id 0
 set bug_id 0
 
-set prototypes 0
+set prototypes 1
 set testfile "structs"
 set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
 
 # build the first test case
-execute_anywhere "rm -f ${binfile}.ci"
-execute_anywhere "echo set prototypes 1 > ${binfile}.ci"
-if  { [compile "-g ${srcdir}/${subdir}/${srcfile} -o ${binfile} "] != "" } {
-    execute_anywhere "rm -f ${binfile}.ci"    
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     # built the second test case since we can't use prototypes
     warning "Prototypes not supported, rebuilding with -DNO_PROTOTYPES"
-    execute_anywhere "echo set prototypes 0 > ${binfile}.ci"
-    if  { [compile "-g -DNO_PROTOTYPES ${srcdir}/${subdir}/${srcfile} -o ${binfile} "] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DNO_PROTOTYPES}] != "" } {
        perror "Couldn't compile ${testfile}.c"
        return -1
     }
+    set prototypes 0
 }
 
 # Create and source the file that provides information about the compiler
 # used to compile the test case.
-if  { [compile "-E ${srcdir}/${subdir}/compiler.c >> ${binfile}.ci"] != "" } {
-    perror "Couldn't make ${binfile}.ci"
-    return -1
+if [get_compiler_info ${binfile}] {
+    return -1;
 }
-source ${binfile}.ci
 
 # The a29k can't call functions, so don't even bother with this test.
 if [istarget "a29k-*-udi"] then {
@@ -60,13 +55,6 @@ if [istarget "a29k-*-udi"] then {
     continue
 }
 
-# The h8300 simulator can't call functions, so don't even bother with this test.
-if [istarget "h8300*-*-*"] then {
-    setup_xfail "h8300*-*-*" 
-    fail "h8300*-*-* simulator can not call functions"
-    continue
-}
-
 # FIXME:  Before calling this proc, we should probably verify that
 # we can call inferior functions and get a valid integral value
 # returned.
@@ -84,13 +72,9 @@ proc do_function_calls {} {
     gdb_test "p fun2()" " = {a = 97 'a', b = 98 'b'}"
     gdb_test "p fun3()" " = {a = 65 'A', b = 66 'B', c = 67 'C'}"
     gdb_test "p fun4()" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4'}"
-    setup_xfail "hppa*-*-hpux9*"
     gdb_test "p fun5()" " = {a = 97 'a', b = 98 'b', c = 99 'c', d = 100 'd', e = 101 'e'}"
-    setup_xfail "hppa*-*-hpux9*"
     gdb_test "p fun6()" " = {a = 65 'A', b = 66 'B', c = 67 'C', d = 68 'D', e = 69 'E', f = 70 'F'}"
-    setup_xfail "hppa*-*-hpux9*"
     gdb_test "p fun7()" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4', e = 53 '5', f = 54 '6', g = 55 '7'}"
-    setup_xfail "hppa*-*-hpux9*"
     gdb_test "p fun8()" " = {a = 49 '1', b = 50 '2', c = 51 '3', d = 52 '4', e = 53 '5', f = 54 '6', g = 55 '7', h = 56 '8'}"
     gdb_test "p fun9()" " = {a = 97 'a', b = 98 'b', c = 99 'c', d = 100 'd', e = 101 'e', f = 102 'f', g = 103 'g', h = 104 'h', i = 105 'i'}"
     gdb_test "p fun10()" " = {a = 65 'A', b = 66 'B', c = 67 'C', d = 68 'D', e = 69 'E', f = 70 'F', g = 71 'G', h = 72 'H', i = 73 'I', j = 74 'J'}"
@@ -145,9 +129,9 @@ gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
 
-send "set print sevenbit-strings\n" ; expect -re "$prompt $"
-send "set print address off\n" ; expect -re "$prompt $"
-send "set width 0\n" ; expect -re "$prompt $"
+send_gdb "set print sevenbit-strings\n" ; expect -re "$prompt $"
+send_gdb "set print address off\n" ; expect -re "$prompt $"
+send_gdb "set width 0\n" ; expect -re "$prompt $"
 
 if [runto_main] then {
     do_function_calls
index be550f0562a245e1c0945a0f5575113de29e72e7..ced0ae45d47de6e88a13eb6b0c1d4f4594e589de 100644 (file)
@@ -12,7 +12,7 @@
 # 
 # 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.  */
+# 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
@@ -28,6 +28,8 @@ if ![isnative] then {
     continue
 }
 
+gdb_start
+
 #
 # test running programs
 #
@@ -35,9 +37,9 @@ set prms_id 0
 set bug_id 0
 
 set testfile "run"
-set srcfile ${srcdir}/$subdir/${testfile}.c
+set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
-if  { [compile "${srcfile} -g -o ${binfile}"] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     perror "Couldn't compile ${srcfile}"
     return -1
 }
@@ -46,51 +48,27 @@ delete_breakpoints
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
 
-# Test that GDB correctly identifies that it does not control a terminal.
-send "info terminal\n"
+gdb_test "set print sevenbit-strings" "" "test set print sevenbit-strings"
+gdb_test "set print address off" "" "test set print address off"
+gdb_test "set width 0" "" "test set width 0"
+gdb_test "info terminal" "No saved terminal information.*" "test info terminal"
+gdb_run_cmd 5
 expect {
-    -re "No saved terminal information..*$prompt $"\
-       { send "run 5\n"
-           expect {
-               -re "Starting program.*$binfile.*120.*Program exited normally..*$prompt $"\
-                   { send "info terminal\n"
-                       expect {
-                           -re "No saved terminal information..*$prompt $"\
-                               { pass "info terminal" }
-                           -re ".*$prompt $"   { fail "info terminal" }
-                           timeout             { fail "(timeout) info terminal" }
-                       }
-                   }
-               -re ".*$prompt $"       { fail "info terminal" }
-               timeout         { fail "(timeout) info terminal" }
-           }
-       }
-    -re ".*$prompt $"  { fail "info terminal" }
-    timeout            { fail "(timeout) info terminal" }
+    -re ".*120.*Program exited normally.*$prompt $" {
+       gdb_test "info terminal" "No saved terminal information.*" "test info terminal"
+    }
+    default {
+       fail "term.exp, factorial didn't run to completion for info terminal"
+    }
 }
 
-
 # In mid-execution
-send "break main\n"
+gdb_breakpoint main
+gdb_run_cmd 5
 expect {
-    -re "Breakpoint.*at.* file .*, line.*$prompt $"\
-       { send "run 5\n"
-           expect {
-               -re "Starting program.*Breakpoint \[0-9\]+,.*main.*if .argc != 2.*$prompt $"\
-                   { send "info terminal\n"
-                       expect {
-                           -re "Inferior's terminal status .currently saved by GDB.:.*$prompt $"\
-                               { pass "info terminal at breakpoint" }
-                           -re ".*$prompt $"   { fail "info terminal at breakpoint" }
-                           timeout                     { fail "(timeout) info terminal at breakpoint" }
-                       }
-                   }
-               -re ".*$prompt $"       { fail "info terminal at breakpoint" }
-               timeout                 { fail "(timeout) info terminal at breakpoint" }
-           }
-       }
+    -re ".*Breakpoint \[0-9\]+,.*main.*if .argc != 2.*$prompt $" {
+       gdb_test "info terminal" "Inferior's terminal status .currently saved by GDB.:.*" "info terminal at breakpoint"
+    }
     -re ".*$prompt $"  { fail "info terminal at breakpoint" }
     timeout            { fail "(timeout) info terminal at breakpoint" }
 }
-
-
index 2956313ab6e068fbf45e1d14a48e811748aadaab..0a9e30746710c531c0a68b2425a5886637e5c3ed 100644 (file)
@@ -29,7 +29,7 @@ set bug_id 0
 set testfile "watchpoint"
 set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
-if  { [compile "${srcdir}/${subdir}/${srcfile} -g -o ${binfile}"] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     perror "Couldn't compile ${srcfile}"
     return -1
 }
@@ -56,7 +56,7 @@ proc initialize {} {
     global decimal
     global srcfile
 
-    send "break marker1\n"
+    send_gdb "break marker1\n"
     expect {
        -re "Breakpoint 1 at $hex: file .*$srcfile, line $decimal.*$prompt $" {
            pass "set breakpoint at marker1"
@@ -65,7 +65,7 @@ proc initialize {} {
        timeout { fail "set breakpoint at marker1 (timeout)" ; return 0 }
     }
 
-    send "break marker2\n"
+    send_gdb "break marker2\n"
     expect {
        -re "Breakpoint 2 at $hex: file .*$srcfile, line $decimal.*$prompt $" {
            pass "set breakpoint at marker2"
@@ -74,14 +74,14 @@ proc initialize {} {
        timeout { fail "set breakpoint at marker2 (timeout)" ; return 0 }
     }
 
-    send "info break\n"
+    send_gdb "info break\n"
     expect {
        -re "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*\r\n$prompt $" { pass "info break in watchpoint.exp" }
        -re ".*$prompt $" { fail "info break in watchpoint.exp" ; return 0 }
        timeout { fail "info break in watchpoint.exp (timeout)" ; return 0 }
     }
 
-    send "watch ival3\n"
+    send_gdb "watch ival3\n"
     expect {
        -re ".*\[Ww\]atchpoint 3: ival3\r\n$prompt $" { 
            pass "set watchpoint on ival3"
@@ -92,7 +92,7 @@ proc initialize {} {
 
     # "info watch" is the same as "info break"
 
-    send "info watch\n"
+    send_gdb "info watch\n"
     expect {
        -re "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*\r\n3\[ \]*.*watchpoint.*ival3\r\n$prompt $" {
            pass "watchpoint found in watchpoint/breakpoint table"
@@ -101,7 +101,7 @@ proc initialize {} {
            fail "watchpoint found in watchpoint/breakpoint table" ; return 0
        }
        timeout {
-          fail "watchpoint found in watchpoint/breakpoint table" ; return 0
+          fail "watchpoint found in watchpoint/breakpoint table (timeout)" ; return 0
        }
     }
 
@@ -109,7 +109,7 @@ proc initialize {} {
     # to use it.  This allows the test program to run at full speed until
     # we get to the first marker function.
 
-    send "disable 3\n"
+    send_gdb "disable 3\n"
     expect {
        -re "disable 3\[\r\n\]+$prompt $" { pass "disable watchpoint" }
        -re ".*$prompt $" { fail "disable watchpoint" ; return 0 }
@@ -131,7 +131,7 @@ proc test_simple_watchpoint {} {
 
     # Ensure that the watchpoint is disabled when we startup.
 
-    send "disable 3\n"
+    send_gdb "disable 3\n"
     expect {
        -re "^disable 3\[\r\n\]+$prompt $" {
            pass "disable watchpoint in test_simple_watchpoint"
@@ -149,6 +149,7 @@ proc test_simple_watchpoint {} {
     # Run until we get to the first marker function.
 
     gdb_run_cmd
+    set timeout 600
     expect {
        -re "Breakpoint 1, marker1 .*$prompt $" {
            pass "run to marker1 in test_simple_watchpoint"
@@ -165,7 +166,7 @@ proc test_simple_watchpoint {} {
 
     # After reaching the marker function, enable the watchpoint.
 
-    send "enable 3\n"
+    send_gdb "enable 3\n"
     expect {
        -re "^enable 3\[\r\n\]+$prompt $" { pass "enable watchpoint" }
        -re ".*$prompt $" { fail "enable watchpoint" ; return }
@@ -180,7 +181,7 @@ proc test_simple_watchpoint {} {
 
     # Continue until the first change, from -1 to 0
 
-    send "cont\n"
+    send_gdb "cont\n"
     expect {
        -re "Continuing.*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count; ival4 = count;.*$prompt $" {
            pass "watchpoint hit, first time"
@@ -222,7 +223,7 @@ Continuing.*\[Ww\]atchpoint.*ival3.*Old value = -1.*New value = 0.*ival3 = count
 
     # Disable the watchpoint so we run at full speed until we exit.
 
-    send "disable 3\n"
+    send_gdb "disable 3\n"
     expect {
        -re "^disable 3\[\r\n\]+$prompt $" { pass "watchpoint disabled" }
        -re ".*$prompt $" { fail "watchpoint disabled" ; return }
@@ -249,7 +250,7 @@ proc test_disabling_watchpoints {} {
 
     # Ensure that the watchpoint is disabled when we startup.
 
-    send "disable 3\n"
+    send_gdb "disable 3\n"
     expect {
        -re "^disable 3\[\r\n\]+$prompt $" {
            pass "disable watchpoint in test_disabling_watchpoints"
@@ -267,6 +268,7 @@ proc test_disabling_watchpoints {} {
     # Run until we get to the first marker function.
 
     gdb_run_cmd
+    set timeout 600
     expect {
        -re "Breakpoint 1, marker1 .*$prompt $" {
            pass "run to marker1 in test_disabling_watchpoints"
@@ -283,7 +285,7 @@ proc test_disabling_watchpoints {} {
 
     # After reaching the marker function, enable the watchpoint.
 
-    send "enable 3\n"
+    send_gdb "enable 3\n"
     expect {
        -re "^enable 3\[\r\n\]+$prompt $" { pass "watchpoint enabled" }
        -re ".*$prompt $" { fail "watchpoint enabled" ; return }
@@ -300,7 +302,7 @@ proc test_disabling_watchpoints {} {
     
     # Disable the watchpoint but leave breakpoints
 
-    send "disable 3\n"
+    send_gdb "disable 3\n"
     expect {
        -re "^disable 3\[\r\n\]+$prompt $" {
            pass "disable watchpoint #2 in test_disabling_watchpoints"
@@ -375,14 +377,14 @@ proc test_stepping {} {
        # on other targets. In this case we will step once more.
        #
 
-       send "finish\n"
+       send_gdb "finish\n"
        expect {
            -re "Run.*exit from.*marker1.*main.* at" { }
            default { fail "finish from marker1" ; return }
        }
        expect {
            -re "marker1 \\(\\);.*$prompt $" {
-               send "step\n"
+               send_gdb "step\n"
                exp_continue
            }
            -re "func1 \\(\\);.*$prompt $" {
@@ -407,7 +409,7 @@ proc test_stepping {} {
 
        gdb_test "until" "ival1 = count.*" "until to ival1 assignment"
        gdb_test "until" "ival3 = count.*" "until to ival3 assignment"
-       send "until\n"
+       send_gdb "until\n"
        expect {
            -re "(for \\(count = 0|\}).*$prompt $" {
                gdb_test "until" "ival1 = count; /. Outside loop ./" \
@@ -430,6 +432,7 @@ proc test_stepping {} {
 proc test_watchpoint_triggered_in_syscall {} {
     global prompt
     global noinferiorio
+    global noresults
 
     if $noinferiorio {
        verbose "Skipping test_watchpoint_triggered_in_syscall due to noinferiorio"
@@ -449,50 +452,50 @@ proc test_watchpoint_triggered_in_syscall {} {
 
        gdb_test "set doread = 1" ""
 
-       # If we send "123\n" before gdb has switched the tty, then it goes
+       # If we send_gdb "123\n" before gdb has switched the tty, then it goes
        # to gdb, not the inferior, and we lose.  So that is why we have
        # watchpoint.c prompt us, so we can wait for that prompt.
-       send "continue\n"
+       send_gdb "continue\n"
        expect {
            -re "Continuing\\.\r\ntype stuff for buf now:" {
                pass "continue to read"
            }
            default { fail "continue to read"; return }
        }
-       send "123\n"
+       send_gdb "123\n"
        expect {
            -re ".*\[Ww\]atchpoint.*buf\\\[0\\\].*Old value = 0.*New value = 49\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
            -re ".*\[Ww\]atchpoint.*buf\\\[1\\\].*Old value = 0.*New value = 50\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
            -re ".*\[Ww\]atchpoint.*buf\\\[2\\\].*Old value = 0.*New value = 51\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
            -re ".*\[Ww\]atchpoint.*buf\\\[3\\\].*Old value = 0.*New value = 10\[^\n\]*\n" { set x [expr $x+1] ; exp_continue }
            -re ".*$prompt $" { pass "sent 123" }
-           timeout { fail "sent 123" }
+           timeout { fail "sent 123 (timeout)" }
        }
 
        # Examine the values in buf to see how many watchpoints we
        # should have printed.
-       send "print buf\[0\]\n"
+       send_gdb "print buf\[0\]\n"
        expect {
            -re ".*= 49.*$prompt $" { set y [expr $y+1]; pass "print buf\[0\]"}
            -re ".*= 0.*$prompt $" { pass "print buf\[0\]"}
            -re ".*$prompt $" { fail "print buf\[0\]"}
            default { fail "print buf\[0\]"}
        }
-       send "print buf\[1\]\n"
+       send_gdb "print buf\[1\]\n"
        expect {
            -re ".*= 50.*$prompt $" { set y [expr $y+1]; pass "print buf\[1\]"}
            -re ".*= 0.*$prompt $" { pass "print buf\[1\]"}
            -re ".*$prompt $" { fail "print buf\[1\]"}
            default { fail "print buf\[1\]"}
        }
-       send "print buf\[2\]\n"
+       send_gdb "print buf\[2\]\n"
        expect {
            -re ".*= 51.*$prompt $" { set y [expr $y+1]; pass "print buf\[2\]"}
            -re ".*= 0.*$prompt $" { pass "print buf\[2\]"}
            -re ".*$prompt $" { fail "print buf\[2\]"}
            default { fail "print buf\[2\]"}
        }
-       send "print buf\[3\]\n"
+       send_gdb "print buf\[3\]\n"
        expect {
            -re ".*= 10.*$prompt $" { set y [expr $y+1]; pass "print buf\[3\]"}
            -re ".*= 0.*$prompt $" { pass "print buf\[3\]"}
@@ -511,6 +514,8 @@ proc test_watchpoint_triggered_in_syscall {} {
        # Disable everything so we can finish the program at full speed
        gdb_test "disable" "" "disable in test_watchpoint_triggered_in_syscall"
 
+        if $noresults==1 then { return }
+
        gdb_test "cont" "Continuing.*Program exited normally.*" \
            "continue to exit in test_watchpoint_triggered_in_syscall"
     }
@@ -521,6 +526,7 @@ proc test_watchpoint_triggered_in_syscall {} {
 
 proc test_complex_watchpoint {} {
     global prompt
+    global noresults
 
     if [runto marker4] then {
        gdb_test "watch ptr1->val" ".*\[Ww\]atchpoint \[0-9\]*: ptr1->val"
@@ -537,6 +543,8 @@ proc test_complex_watchpoint {} {
        # Disable everything so we can finish the program at full speed
        gdb_test "disable" "" "disable in test_complex_watchpoint"
 
+        if $noresults==1 then { return }
+
        gdb_test "cont" "Continuing.*Program exited normally.*" \
            "continue to exit in test_complex_watchpoint"
     }
@@ -548,6 +556,8 @@ gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load $binfile
+set timeout 600        
+verbose "Timeout now 600 sec.\n"
 
 if [initialize] then {
 
index 3fbf989c83dd9a2f25e8990dadfc34a5c1b1ecda..1379a840937e2c60ba52df269f26e685ff703c18 100644 (file)
@@ -42,20 +42,20 @@ proc set_lang_chill {} {
 
     verbose "loading file '$binfile'"
     gdb_load $binfile
-    send "set language chill\n"
+    send_gdb "set language chill\n"
     expect {
        -re ".*$prompt $" {}
        timeout { fail "set language chill (timeout)" ; return 0 }
     }
 
-    send "show language\n"
+    send_gdb "show language\n"
     expect {
        -re ".* source language is \"chill\".*$prompt $" {
            pass "set language to \"chill\""
-           send "break xx_\n"
+           send_gdb "break xx_\n"
            expect {
                -re ".*$prompt $" {
-                   send "run\n" 
+                   send_gdb "run\n" 
                    expect -re ".*$prompt $" {}
                    return 1
                }
@@ -85,7 +85,7 @@ proc set_lang_chill {} {
 #
 # Args are:
 #
-#      First one is string to send to gdb
+#      First one is string to send_gdb to gdb
 #      Second one is string to match gdb result to
 #      Third one is an optional message to be printed
 
@@ -427,7 +427,7 @@ gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 
-send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
+gdb_test "set print sevenbit-strings ".*"
 
 if [set_lang_chill] then {
     # test builtins as described in chapter 6.20.3 Z.200
index 2a5007bec305caff146361fbb2f380adc44cdf68..4fe4e657646765330da3665a6be890a26397c2e3 100644 (file)
@@ -46,10 +46,10 @@ proc do_tests {} {
     gdb_reinitialize_dir $srcdir/$subdir
     gdb_load $binfile
 
-    send "set language chill\n" ; 
+    send_gdb "set language chill\n" ; 
 
-    send "break callch.ch:48\n"; expect -re "$prompt $"
-    send "run\n"; expect -re "Breakpoint .*callch.ch:48.*$prompt $"
+    gdb_test "break callch.ch:48 ""
+    send_gdb "run\n"; expect -re "Breakpoint .*callch.ch:48.*$prompt $"
     gdb_test {set fred(10, i)} {a is '10'; b is '12'.}
     gdb_test_exact "call klaus()" {here's klaus calling.}
     gdb_test_exact "call fred()" {too few arguments in function call}
index 831c537d249cb3548618895699a81f03d77695ad..9961b82d751fe12634df7644c41026ada6695403 100644 (file)
@@ -32,13 +32,13 @@ set bug_id 0
 proc set_lang_chill {} {
     global prompt
 
-    send "set language chill\n"
+    send_gdb "set language chill\n"
     expect {
        -re ".*$prompt $" {}
        timeout { fail "set language chill (timeout)" ; return 0 }
     }
 
-    send "show language\n"
+    send_gdb "show language\n"
     expect {
        -re ".* source language is \"chill\".*$prompt $" {
            pass "set language to \"chill\""
@@ -248,19 +248,19 @@ proc test_float_literals_accepted {} {
 proc test_convenience_variables {} {
     global prompt
 
-    gdb_test "set \$foo := 101"        " := 101\[\r\n\]*" \
+    gdb_test "set \$foo := 101"        " := 101\[\r\]*" \
        "Set a new convenience variable"
 
     gdb_test "print \$foo"             " = 101" \
        "Print contents of new convenience variable"
 
-    gdb_test "set \$foo := 301"        " := 301\[\r\n\]*" \
+    gdb_test "set \$foo := 301"        " := 301\[\r\]*" \
        "Set convenience variable to a new value"
 
     gdb_test "print \$foo"             " = 301" \
        "Print new contents of convenience variable"
 
-    gdb_test "set \$_ := 11"           " := 11\[\r\n\]*" \
+    gdb_test "set \$_ := 11"           " := 11\[\r\]*" \
        "Set convenience variable \$_"
 
     gdb_test "print \$_"               " = 11" \
@@ -432,7 +432,7 @@ gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 
-send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
+gdb_test "set print sevenbit-strings" ""
 
 if [set_lang_chill] then {
     test_value_history
index c11ebc3fca792c576ecc21ccfde1493c04b58bdc..05d20d5edc95836aa68d7462a2a4c54b4d7dc54c 100644 (file)
@@ -46,16 +46,16 @@ proc do_tests {} {
     gdb_reinitialize_dir $srcdir/$subdir
     gdb_load $binfile
 
-    send "set language chill\n" ; expect -re "$prompt $"
+    gdb_test "set language chill ""
 
     # This is needed (at least on SunOS4) to make sure the
     # the symbol table is read.
-    send "break chillvars.ch:3\n" ; expect -re "$prompt $"
-    send "delete 1\n" ; expect -re "$prompt $"
+    gdb_test "break chillvars.ch:3 ""
+    gdb_test "delete 1 ""
 
-    send "set width 0\n" ; expect -re "$prompt $"
-    send "set print sevenbit-strings\n" ; expect -re "$prompt $"
-    send "set print address off\n" ; expect -re "$prompt $"
+    gdb_test "set width 0 ""
+    gdb_test "set print sevenbit-strings ""
+    gdb_test "set print address off ""
 
     test_BOOL
     test_CHAR
index cd08a45db0d6b1ac05fbbf90c0e52cb751228d20..faec871060124b3d964acde6d5ef16aac5401cbd 100644 (file)
@@ -44,7 +44,7 @@ proc set_lang_chill {} {
     verbose "loading file '$binfile'"
     gdb_load $binfile
 
-    send "set language chill\n"
+    send_gdb "set language chill\n"
     expect {
        -re ".*$prompt $" {}
        timeout { fail "set language chill (timeout)" ; return 0 }
@@ -63,12 +63,12 @@ gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 
-send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
+gdb_test "set print sevenbit-strings ".*"
 
 if ![set_lang_chill] then {
     runto hugo_
 
-    send "set var \$i := d\n"
+    send_gdb "set var \$i := d\n"
     expect -re ".*$prompt $"
     gdb_test "print \$i" { = d}
     gdb_test "print size (\$i)" { = 1}
@@ -80,6 +80,6 @@ if ![set_lang_chill] then {
     gdb_test "print a/=\$i" { = TRUE}
 
 # This is PR 8870:
-    send "break malloc\n"; expect -re ".*$prompt $"
+    gdb_test "break malloc ".*"
     gdb_test {set var $j := m_set[b]} ".*invalid.*tuple.*"
 }
index c789cc222bfe81dba91f6484789b28931b3d9d32..204daeea47c4c0fc53ca06001be4aba884af8cd3 100644 (file)
@@ -54,12 +54,12 @@ proc do_tests {} {
     gdb_reinitialize_dir $srcdir/$subdir
     gdb_load $binfile
 
-    send "set language chill\n" ; expect -re "$prompt $"
+    gdb_test "set language chill ""
 
-    send "set var \$i := m_x\[\]\n" ; expect -re "$prompt $"
+    gdb_test "set var \$i := m_x\[\] ""
     gdb_test "print \$i" { = \[.i: 0, .ar: \[\(5:6\): \[.f1: 0, .f2: NULL, .f3: \[\(2:3\): 0\]\]\]\]}
 
-    send "set var \$j := m_y\[\]\n" ; expect -re "$prompt $"
+    gdb_test "set var \$j := m_y\[\] ""
     gdb_test "print \$j" { = \[.i: 0, .ar: \[\(7:8\): \[\(9:10\): \[.f1: 0, .f2: NULL, .f3: \[\(2:3\): 0\]\]\]\]\]}
 }
 
index e6bb8f2ff058d282a62c053d398e82d4a29f8512..c033cef6c4a6d20dbaf4f84028d7461096552f30 100644 (file)
@@ -45,7 +45,7 @@ proc set_lang_chill {} {
     verbose "loading file '$binfile'"
     gdb_load $binfile
 
-    send "set language chill\n"
+    send_gdb "set language chill\n"
     expect {
        -re ".*$prompt $" {}
        timeout { fail "set language chill (timeout)" ; return 0 }
@@ -64,7 +64,7 @@ gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 
-send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
+gdb_test "set print sevenbit-strings ".*"
 
 if ![set_lang_chill] then {
     runto arr_
index 4eb78c27e7a338817e029d47e109bffbf85cd525..eb83c60e40a8d3b1accabe01a73e4a645f029c34 100644 (file)
@@ -44,7 +44,7 @@ proc set_lang_chill {} {
     verbose "loading file '$binfile'"
     gdb_load $binfile
 
-    send "set language chill\n"
+    send_gdb "set language chill\n"
     expect {
         -re ".*$prompt $" {}
         timeout { fail "set language chill (timeout)" ; return 0 }
@@ -63,19 +63,19 @@ gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 
-send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
+gdb_test "set print sevenbit-strings ".*"
 
 if ![set_lang_chill] then {
     runto brrr
 
     # check foo
     gdb_test {print foo} { = \[\(0:99\): 222\]}
-    send "set var foo := m_array\[\(\*\):44\]\n" ; expect -re ".*$prompt $"
+    gdb_test "set var foo := m_array\[\(\*\):44\] ".*"
     gdb_test {print foo} { = \[\(0:99\): 44\]}
 
     # check bar
     gdb_test {print bar} { = \[\(-10:20\): \[.i: 0, .b: FALSE\]\]}
-    send "set var bar := m_bar\[\(\*\): \[42, TRUE\]\]\n" ; expect -re ".*$prompt $"
+    gdb_test "set var bar := m_bar\[\(\*\): \[42, TRUE\]\] ".*"
     gdb_test {print bar} { = \[\(-10:20\): \[.i: 42, .b: TRUE\]\]}
 
     # some failues
index 5afccfac44f912e38fcb5cb0586a45927be92c2f..e33850ca43b6a14b168618c9d4bb8e4d61d7cd1f 100644 (file)
@@ -44,7 +44,7 @@ proc set_lang_chill {} {
     verbose "loading file '$binfile'"
     gdb_load $binfile
 
-    send "set language chill\n"
+    send_gdb "set language chill\n"
     expect {
         -re ".*$prompt $" {}
         timeout { fail "set language chill (timeout)" ; return 0 }
@@ -63,14 +63,14 @@ gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 
-send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
+gdb_test "set print sevenbit-strings ".*"
 
 if ![set_lang_chill] then {
     runto doit
-    send "next\n" ; expect -re "$prompt $"
+    gdb_test "next ""
     # check too many array elements
     gdb_test {set var v_x := [1,2,3,4,5]} {Too many array elements}
     gdb_test {set var $i := m_x[(3): 22, 25]} {Too many array elements}
-    send "set var \$i := m_x\[\(2\): 22, 25\]\n" ; expect -re "$prompt $"
+    gdb_test "set var \$i := m_x\[\(2\): 22, 25\] ""
     gdb_test {print $i} { = \[\(1\): 0, \(2\): 22, \(3\): 25\]}
 }
index 8b633093b3b7b736a601a9bd78400226cade3584..995384e5a7e4aa961f8d7ae07eb2bd30983812a5 100644 (file)
@@ -46,20 +46,20 @@ proc set_lang_chill {} {
 
     verbose "loading file '$binfile'"
     gdb_load $binfile
-    send "set language chill\n"
+    send_gdb "set language chill\n"
     expect {
        -re ".*$prompt $" {}
        timeout { fail "set language chill (timeout)" ; return 0 }
     }
 
-    send "show language\n"
+    send_gdb "show language\n"
     expect {
        -re ".* source language is \"chill\".*$prompt $" {
            pass "set language to \"chill\""
-           send "break xx_\n"
+           send_gdb "break xx_\n"
            expect {
                -re ".*$prompt $" {
-                   send "run\n" 
+                   send_gdb "run\n" 
                    expect -re ".*$prompt $" {}
                    return 1
                }
@@ -89,7 +89,7 @@ proc set_lang_chill {} {
 #
 # Args are:
 #
-#      First one is string to send to gdb
+#      First one is string to send_gdb to gdb
 #      Second one is string to match gdb result to
 #      Third one is an optional message to be printed
 
@@ -122,30 +122,30 @@ proc test_chars {} {
     test_print_accept "print c" {'a'<repeats 70 times>//"\^\(0,5\)Jason"//'b'<repeats 70 times>}
     test_print_accept "print d" {'\^\(11\)'}
 
-    send "set var a := (100)'\^(0,255)'\n" ; expect -re "$prompt $"
+    gdb_test "set var a := (100)'\^(0,255)' ""
     test_print_accept "print a" {"\^\(0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255\)"}
 
-    send "set var a := (10)'\^(1)'//(26)\"\^(66,67)\"//\" \"//'I'//' '//'a'//'m'//\" Hugo\" \n" ; expect -re "$prompt $"
+    send_gdb "set var a := (10)'\^(1)'//(26)\"\^(66,67)\"//\" \"//'I'//' '//'a'//'m'//\" Hugo\" \n" ; expect -re "$prompt $"
     test_print_accept "print a" {"\^\(1,1,1,1,1,1,1,1,1,1\)BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC I am Hugo"}
-    send "set var b := \"Hugo \"\"\^(3,4)\"\"Otto\^(17)\" \n" ; expect -re "$prompt $"
+    send_gdb "set var b := \"Hugo \"\"\^(3,4)\"\"Otto\^(17)\" \n" ; expect -re "$prompt $"
     test_print_accept "print b" {"Hugo ""\^\(3,4\)""Otto\^\(17\)"}
-    send "set var c := (70)'b' // \"\^(2,3)Hugo \" // (70)'c' \n" ; expect -re "$prompt $"
+    send_gdb "set var c := (70)'b' // \"\^(2,3)Hugo \" // (70)'c' \n" ; expect -re "$prompt $"
     test_print_accept "print c" {'b'<repeats 70 times>//"\^\(2,3\)Hugo "//'c'<repeats 70 times>}
-    send "set var d := '\^(199)'\n" ; expect -re "$prompt $"
+    gdb_test "set var d := '\^(199)' ""
     test_print_accept "print d" {'\^\(199\)'}
 
     test_print_accept "print (10)'\^(0)'//(26)\"\^(66,67)\"//\" \"//'I'//' '//'a'//'m'//\" Hugo\"" {"\^\(0,0,0,0,0,0,0,0,0,0\)BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC I am Hugo"}
     test_print_accept "print \"Jason\"\"\^(0,5)\"\"Hugo\^(10)\"" {"Jason""\^\(0,5\)""Hugo\^\(10\)"}
 
-    send "set var a := \"\" \n" ; expect -re "$prompt $"
+    send_gdb "set var a := \"\" \n" ; expect -re "$prompt $"
     test_print_accept "print a" {""}
-    send "set var a := \"\"\"\" \n" ; expect -re "$prompt $"
+    send_gdb "set var a := \"\"\"\" \n" ; expect -re "$prompt $"
     test_print_accept "print a" {""""}
-    send "set var a := \" \"\"\" \n" ; expect -re "$prompt $"
+    send_gdb "set var a := \" \"\"\" \n" ; expect -re "$prompt $"
     test_print_accept "print a" {" """}
-    send "set var a := \"\^\^\" \n" ; expect -re "$prompt $"
+    send_gdb "set var a := \"\^\^\" \n" ; expect -re "$prompt $"
     test_print_accept "print a" {"\^\^"}
-    send "set var a := \"'\" \n" ; expect -re "$prompt $"
+    send_gdb "set var a := \"'\" \n" ; expect -re "$prompt $"
     test_print_accept "print a" {"'"}
 }
 
@@ -170,7 +170,7 @@ gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 
-send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
+gdb_test "set print sevenbit-strings ".*"
 
 
 if [set_lang_chill] then {
index 55d62fd918aba4d2993ae2500b2875d1fc987ec1..2ebefc8148d29d5419a634da2d2d0a540645ab3e 100644 (file)
@@ -46,20 +46,20 @@ proc set_lang_chill {} {
 
     verbose "loading file '$binfile'"
     gdb_load $binfile
-    send "set language chill\n"
+    send_gdb "set language chill\n"
     expect {
        -re ".*$prompt $" {}
        timeout { fail "set language chill (timeout)" ; return 0 }
     }
 
-    send "show language\n"
+    send_gdb "show language\n"
     expect {
        -re ".* source language is \"chill\".*$prompt $" {
            pass "set language to \"chill\""
-           send "break xx_\n"
+           send_gdb "break xx_\n"
            expect {
                -re ".*$prompt $" {
-                   send "run\n" 
+                   send_gdb "run\n" 
                    expect -re ".*$prompt $" {}
                    return 1
                }
@@ -89,7 +89,7 @@ proc set_lang_chill {} {
 #
 # Args are:
 #
-#      First one is string to send to gdb
+#      First one is string to send_gdb to gdb
 #      Second one is string to match gdb result to
 #      Third one is an optional message to be printed
 
@@ -120,105 +120,105 @@ proc test_power {} {
     test_print_accept "print v2_power1" {\[\]}
     test_print_accept "print SIZE(v1_power1)" "1"
 
-    send "set v1_power1 := \[b1\] \n" ; expect -re "$prompt $"
+    gdb_test "set v1_power1 := \[b1\]  ""
 #   if GDB has rejected the improper values, we have to expect the same!
     test_print_accept "print v1_power1" {\[e1:e5\]}
 
-    send "set v1_power1 := \[a1,a2\] \n" ; expect -re "$prompt $"
+    gdb_test "set v1_power1 := \[a1,a2\]  ""
     test_print_accept "print v1_power1" {\[e1:e5\]}
-    send "set v1_power1 := \[b1,b2,b3,e4\] \n" ; expect -re "$prompt $"
+    gdb_test "set v1_power1 := \[b1,b2,b3,e4\]  ""
     test_print_accept "print v1_power1" {\[e1:e5\]}
-    send "set v1_power1 := \[e4:e5\] \n" ; expect -re "$prompt $"
+    gdb_test "set v1_power1 := \[e4:e5\]  ""
     test_print_accept "print v1_power1" {\[e4:e5\]}
-    send "set v1_power1 := \[e1, e2:e3, e5\] \n" ; expect -re "$prompt $"
+    gdb_test "set v1_power1 := \[e1, e2:e3, e5\]  ""
     test_print_accept "print v1_power1" {\[e1:e3, e5\]}
-    send "set v1_power1 := \[e1, e2:e4, e4:e5\] \n" ; expect -re "$prompt $"
+    gdb_test "set v1_power1 := \[e1, e2:e4, e4:e5\]  ""
     test_print_accept "print v1_power1" {\[e1:e5\]}
-    send "set v1_power1 := \[e1, e1:e3, e1:e2, e2:e3\] \n" ; expect -re "$prompt $"
+    gdb_test "set v1_power1 := \[e1, e1:e3, e1:e2, e2:e3\]  ""
     test_print_accept "print v1_power1" {\[e1:e3\]}
 
-    send "set v_power2 := \[e2\] \n" ; expect -re "$prompt $"
+    gdb_test "set v_power2 := \[e2\]  ""
     test_print_accept "print v_power2" {\[\]}
-    send "set v_power2 := \[1,2,3\] \n" ; expect -re "$prompt $"
+    gdb_test "set v_power2 := \[1,2,3\]  ""
     test_print_accept "print v_power2" {\[\]}
-    send "set v_power2 := \[e2, b2, b1\] \n" ; expect -re "$prompt $"
+    gdb_test "set v_power2 := \[e2, b2, b1\]  ""
     test_print_accept "print v_power2" {\[\]}
 
 # Note, that this is a numbered SET, so a1:a3 contains all elements (exept a6)
-    send "set v_power2 := \[a1:a3, a6:a4, a7:a9\] \n" ; expect -re "$prompt $"
+    gdb_test "set v_power2 := \[a1:a3, a6:a4, a7:a9\]  ""
     test_print_accept "print v_power2" {\[a6:a3\]}
-    send "set v_power2 := \[a1, a4:a6, a9\] \n" ; expect -re "$prompt $"
+    gdb_test "set v_power2 := \[a1, a4:a6, a9\]  ""
     test_print_accept "print v_power2" {\[a1, a9\]}
-    send "set v_power2 := \[a1:a2, a6, a9\] \n" ; expect -re "$prompt $"
+    gdb_test "set v_power2 := \[a1:a2, a6, a9\]  ""
     test_print_accept "print v_power2" {\[a6:a2, a9\]}
-    send "set v_power2 := \[a1, a4, a7:a8, a9:a3\] \n" ; expect -re "$prompt $"
+    gdb_test "set v_power2 := \[a1, a4, a7:a8, a9:a3\]  ""
     test_print_accept "print v_power2" {\[a1, a4, a9:a8\]}
-    send "set v_power2 := \[a1, a4:a8\] \n" ; expect -re "$prompt $"
+    gdb_test "set v_power2 := \[a1, a4:a8\]  ""
     test_print_accept "print v_power2" {\[a1, a4:a8\]}
-    send "set v_power2 := \[a8,a3,a7,a9,a5,a6\] \n" ; expect -re "$prompt $"
+    gdb_test "set v_power2 := \[a8,a3,a7,a9,a5,a6\]  ""
     test_print_accept "print v_power2" {\[a6, a5, a9, a7, a3, a8\]}
 
-    send "set v_power3 := \[b1:b2,e1\] \n" ; expect -re "$prompt $"
+    gdb_test "set v_power3 := \[b1:b2,e1\]  ""
     test_print_accept "print v_power3" {\[b1:b2\]}
-    send "set v_power3 := \[b1, b3, b6:b7\] \n" ; expect -re "$prompt $"
+    gdb_test "set v_power3 := \[b1, b3, b6:b7\]  ""
     test_print_accept "print v_power3" {\[b1, b3, b6:b7\]}
-    send "set v_power3 := \[b1, b3:b4, b7\] \n" ; expect -re "$prompt $"
+    gdb_test "set v_power3 := \[b1, b3:b4, b7\]  ""
     test_print_accept "print v_power3" {\[b1, b3:b4, b7\]}
-    send "set v_power3 := \[b1, b4:b6, b7\] \n" ; expect -re "$prompt $"
+    gdb_test "set v_power3 := \[b1, b4:b6, b7\]  ""
     test_print_accept "print v_power3" {\[b1, b4:b7\]}
-    send "set v_power3 := \[b1:b7\] \n" ; expect -re "$prompt $"
+    gdb_test "set v_power3 := \[b1:b7\]  ""
     test_print_accept "print v_power3" {\[b1:b7\]}
-    send "set v_power3 := \[b5:b7, b1\] \n" ; expect -re "$prompt $"
+    gdb_test "set v_power3 := \[b5:b7, b1\]  ""
     test_print_accept "print v_power3" {\[b1, b5:b7\]}
 
-    send "set v_power4 := \[\"b\"\] \n" ; expect -re "$prompt $"
+    send_gdb "set v_power4 := \[\"b\"\] \n" ; expect -re "$prompt $"
     test_print_accept "print v_power4" {\['b':'x'\]}
-    send "set v_power4 := \[5\] \n" ; expect -re "$prompt $"
+    gdb_test "set v_power4 := \[5\]  ""
     test_print_accept "print v_power4" {\['b':'x'\]}
-    send "set v_power4 := \['c':'f','g':'h','o':'t'\]\n"; expect -re "$prompt $"
+    gdb_test "set v_power4 := \['c':'f','g':'h','o':'t'\] ""
     test_print_accept "print v_power4" {\['c':'h', 'o':'t'\]}
-    send "set v_power4 := \['a','b','c','d','e','f'\]\n"; expect -re "$prompt $"
+    gdb_test "set v_power4 := \['a','b','c','d','e','f'\] ""
     test_print_accept "print v_power4" {\['a':'f'\]}
-    send "set v_power4 := \['\^(0)':'\^(200)'\]\n"; expect -re "$prompt $"
+    gdb_test "set v_power4 := \['\^(0)':'\^(200)'\] ""
     test_print_accept "print v_power4" {\['\^\(0\)':'\^\(200\)'\]}
 
-    send "set v_power5 := \[a8\] \n" ; expect -re "$prompt $"
+    gdb_test "set v_power5 := \[a8\]  ""
     test_print_accept "print v_power5" {\[2:100\]}
-    send "set v_power5 := \[4\] \n" ; expect -re "$prompt $"
+    gdb_test "set v_power5 := \[4\]  ""
     test_print_accept "print v_power5" {\[4\]}
-    send "set v_power5 := \[3:95,9:100,10:107,200:250\]\n" ; expect -re "$prompt $"
+    gdb_test "set v_power5 := \[3:95,9:100,10:107,200:250\] ""
     test_print_accept "print v_power5" {\[3:107, 200:250\]}
-    send "set v_power5 := \[2, 100:120, 350:400\] \n" ; expect -re "$prompt $"
+    gdb_test "set v_power5 := \[2, 100:120, 350:400\]  ""
     test_print_accept "print v_power5" {\[2, 100:120, 350:400\]}
-    send "set v_power5 := \[2:64,65:127,128:256,256:399,400\]\n" ; expect -re "$prompt $"
+    gdb_test "set v_power5 := \[2:64,65:127,128:256,256:399,400\] ""
     test_print_accept "print v_power5" {\[2:400\]}
-    send "set v_power5 := \[3:95, 99:100, 101:107, 200:250\] \n" ; expect -re "$prompt $"
+    gdb_test "set v_power5 := \[3:95, 99:100, 101:107, 200:250\]  ""
     test_print_accept "print v_power5" {\[3:95, 99:107, 200:250\]}
 
-    send "set v_power6 := \[a8\] \n" ; expect -re "$prompt $"
+    gdb_test "set v_power6 := \[a8\]  ""
     test_print_accept "print v_power6" {\[\]}
-    send "set v_power6 := \[4\] \n" ; expect -re "$prompt $"
+    gdb_test "set v_power6 := \[4\]  ""
     test_print_accept "print v_power6" {\[4\]}
-    send "set v_power6 := \[3:95, 99:100, 101:107, 200:250\] \n" ; expect -re "$prompt $"
+    gdb_test "set v_power6 := \[3:95, 99:100, 101:107, 200:250\]  ""
     test_print_accept "print v_power6" {\[3:95, 99:107, 200:250\]}
-    send "set v_power6 := \[-111:0, 1:112, 11111:22222\] \n" ; expect -re "$prompt $"
+    gdb_test "set v_power6 := \[-111:0, 1:112, 11111:22222\]  ""
     test_print_accept "print v_power6" {\[-111:112, 11111:22222\]}
-    send "set v_power6 := \[0, 200:4000, 6666:9999\] \n" ; expect -re "$prompt $"
+    gdb_test "set v_power6 := \[0, 200:4000, 6666:9999\]  ""
     test_print_accept "print v_power6" {\[0, 200:4000, 6666:9999\]}
 
-#    send "set v_power7 := \[a8\] \n" ; expect -re "$prompt $"
+#    gdb_test "set v_power7 := \[a8\]  ""
 #    test_print_accept "print v_power7" {\[2:100\]}
-#    send "set v_power7 := \[4\] \n" ; expect -re "$prompt $"
+#    gdb_test "set v_power7 := \[4\]  ""
 #    test_print_accept "print v_power7" {\[4\]}
-#    send "set v_power7 := \[3:95, 99:100, 101:107, 200:250\]\n" ; expect -re "$prompt $"
+#    gdb_test "set v_power7 := \[3:95, 99:100, 101:107, 200:250\] ""
 #    test_print_accept "print v_power7" {\[3:95, 99:107, 200:250\]}
-#    send "set v_power7 := \[0, 1000, 1000000, 10000000000\] \n" ; expect -re "$prompt $"
+#    gdb_test "set v_power7 := \[0, 1000, 1000000, 10000000000\]  ""
 #    test_print_accept "print v_power7" {\[0, 1000, 1000000, 1000000000\]}
-#    send "set v_power7 := \[-20000:100000, 111111:2222222\] \n" ; expect -re "$prompt $"
+#    gdb_test "set v_power7 := \[-20000:100000, 111111:2222222\]  ""
 #    test_print_accept "print v_power7" {\[-20000:100000, 111111:2222222\]}
-#    send "set v_power7 := \[\] \n" ; expect -re "$prompt $"
+#    gdb_test "set v_power7 := \[\]  ""
 #    test_print_accept "print v_power7" {\[3:95, 99:107, 200:250\]}
-#    send "set v_power7 := \[2:-500, -501:1, 20:370, -888:-920, 1000:2000, 1800:2500\]\ \n" ; expect -re "$prompt $"
+#    gdb_test "set v_power7 := \[2:-500, -501:1, 20:370, -888:-920, 1000:2000, 1800:2500\]\  ""
 #    test_print_accept "print v_power7" {\[-920:-888, -501:2, 20:370, 1000:2500\]}
 #    test_print_accept "print SIZE(v_power7)" ""
 
@@ -237,7 +237,7 @@ gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 
-send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
+gdb_test "set print sevenbit-strings ".*"
 
 
 if [set_lang_chill] then {
index 1c1a5b208e31bcef0b72519a97ac19b5c8713569..bf5b6d3625cea3c33ca4a1ea26690ed52273e93c 100644 (file)
@@ -45,7 +45,7 @@ proc set_lang_chill {} {
     verbose "loading file '$binfile'"
     gdb_load $binfile
 
-    send "set language chill\n"
+    send_gdb "set language chill\n"
     expect {
        -re ".*$prompt $" {}
        timeout { fail "set language chill (timeout)" ; return 0 }
@@ -64,7 +64,7 @@ gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 
-send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
+gdb_test "set print sevenbit-strings ".*"
 
 if ![set_lang_chill] then {
     runto dummyfunc
@@ -78,7 +78,7 @@ if ![set_lang_chill] then {
     gdb_test "print NULL" " = NULL" "print emptiness literal"
 
     # This tests PR 8496.
-    gdb_test {printf "%d %d.\n",  3+4,2} "7 2." "printf with 2 arguments"
+    gdb_test {printf "%d %d.",  3+4,2} "7 2." "printf with 2 arguments"
 
     # This tests GCH/924
     gdb_test {print (h'23)} { = 35} "print parantised integer literal"
@@ -93,7 +93,7 @@ if ![set_lang_chill] then {
     setup_xfail "m68*-*-hpux*"
     gdb_test "print array () ubyte (foo)" { = \[\(0:11\): 0\]}
        
-    send "set var \$i := foo\n"
+    send_gdb "set var \$i := foo\n"
     expect -re ".*$prompt $"
     setup_xfail "m68*-*-hpux*"
     gdb_test "print/x array () byte (\$i)" { = \[\(0:11\): H'0\]}
index 5a62aed8b5aee3472609076556527c3dc2cbca13..9a912d673cd9c9e98ae2d39d4f83cd9c07adb6d3 100644 (file)
@@ -42,20 +42,20 @@ proc set_lang_chill {} {
 
     verbose "loading file '$binfile'"
     gdb_load $binfile
-    send "set language chill\n"
+    send_gdb "set language chill\n"
     expect {
        -re ".*$prompt $" {}
        timeout { fail "set language chill (timeout)" ; return 0 }
     }
 
-    send "show language\n"
+    send_gdb "show language\n"
     expect {
        -re ".* source language is \"chill\".*$prompt $" {
            pass "set language to \"chill\""
-           send "break xx_\n"
+           send_gdb "break xx_\n"
            expect {
                -re ".*$prompt $" {
-                   send "run\n" 
+                   send_gdb "run\n" 
                    expect -re ".*$prompt $" {}
                    return 1
                }
@@ -85,7 +85,7 @@ proc set_lang_chill {} {
 #
 # Args are:
 #
-#      First one is string to send to gdb
+#      First one is string to send_gdb to gdb
 #      Second one is string to match gdb result to
 #      Third one is an optional message to be printed
 
@@ -175,7 +175,7 @@ gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 
-send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
+gdb_test "set print sevenbit-strings ".*"
 
 if [set_lang_chill] then {
     # test builtins as described in chapter 6.20.3 Z.200
index 787b3bd71544de92bbdc84631fc6cdbaf043f28c..892f1edf44c83259cb834149ca959a4759cd0014 100644 (file)
@@ -54,7 +54,7 @@ proc do_tests {} {
     gdb_reinitialize_dir $srcdir/$subdir
     gdb_load $binfile
 
-    send "set language chill\n" ; expect -re "$prompt $"
+    gdb_test "set language chill ""
 
     # This is needed (at least on SunOS4) to make sure the
     # the symbol table is read.
index 4e5ff88741f49599c891093f377478f587b0962f..2a036d1a2f68563aa753982d25225d79d1626109 100644 (file)
@@ -46,7 +46,7 @@ proc do_tests {} {
     gdb_reinitialize_dir $srcdir/$subdir
     gdb_load $binfile
 
-    send "set language chill\n" ; expect -re "$prompt $"
+    gdb_test "set language chill ""
 
     runto dump
     # Linux thinks type is "_cint" (and so does sparc-sun-sunos4, alpha-dec-osf2.0)
@@ -55,7 +55,7 @@ proc do_tests {} {
     gdb_test_exact "ptype m_index" "type = RANGE (1:10)" "ptype m_index"
     gdb_test_exact "whatis a" "type = /*LOC*/ vector"
     gdb_test "ptype a" "type = /\\*LOC\\*/ ARRAY \\(1:10\\) (INT|int)"
-    send "step\n"; expect -re "$prompt $"
+    gdb_test "step ""
     gdb_test_exact "whatis i" "type = long" "whatis loop counter i"
 }
 
index 47a43023d0fcd0871d376600b447a2a9cd0e1630..777f66407922cdc76a886ab39cb8cd03518fc30f 100644 (file)
@@ -46,16 +46,16 @@ proc do_tests {} {
     gdb_reinitialize_dir $srcdir/$subdir
     gdb_load $binfile
 
-    send "set language chill\n" ; expect -re "$prompt $"
+    gdb_test "set language chill ""
 
     # This is needed (at least on SunOS4) to make sure the
     # the symbol table is read.
-    send "break chillvars.ch:3\n" ; expect -re "$prompt $"
-    send "delete 1\n" ; expect -re "$prompt $"
+    gdb_test "break chillvars.ch:3 ""
+    gdb_test "delete 1 ""
 
-    send "set width 0\n" ; expect -re "$prompt $"
-    send "set print sevenbit-strings\n" ; expect -re "$prompt $"
-    send "set print address off\n" ; expect -re "$prompt $"
+    gdb_test "set width 0 ""
+    gdb_test "set print sevenbit-strings ""
+    gdb_test "set print address off ""
 
     test_pr_5020
 }
@@ -71,7 +71,7 @@ proc test_pr_5020 {} {
        {= [(10): [.l: 10, .b: TRUE], (11): [.l: 111, .b: FALSE]]}
     gdb_test_exact "print setarr" \
        {= [(aa): [.l: 10, .b: TRUE], (bb): [.l: 111, .b: FALSE]]}
-    send "set print pretty\n" ; expect -re "$prompt $"
+    gdb_test "set print pretty ""
     gdb_test_exact "print y" \
 {= [('a'): [\r
     .l: 10, \r
index e690343aecbbd77bc3442e7c2e16176f5c1891e1..e08c40bf7d5076b19d21569c8f2de2ee866d94f2 100644 (file)
@@ -46,15 +46,15 @@ proc do_tests {} {
     gdb_reinitialize_dir $srcdir/$subdir
     gdb_load $binfile
 
-    send "set language chill\n" ; expect -re "$prompt $"
+    gdb_test "set language chill ""
 
     # This is needed (at least on SunOS4) to make sure the
     # the symbol table is read.
-    send "break gdbme.ch:3\n" ; expect -re "$prompt $"
-    send "delete 1\n" ; expect -re "$prompt $"
+    gdb_test "break gdbme.ch:3 ""
+    gdb_test "delete 1 ""
 
-    send "set width 0\n" ; expect -re "$prompt $"
-    send "set print sevenbit-strings\n" ; expect -re "$prompt $"
+    gdb_test "set width 0 ""
+    gdb_test "set print sevenbit-strings ""
 
     test_pr_5022
 }
@@ -63,7 +63,7 @@ proc test_pr_5022 {} {
     global prompt
     runto dummy_pr_5022
     gdb_test "p p" " = NULL" "print NULL pointer"
-    send "continue\n" ; expect -re "$prompt $"
+    gdb_test "continue ""
     gdb_test "p p" {= PTR\(H'[0-9a-fA-F]+\)} "print non-NULL pointer"
 }
 
index 2c0cb08157b5be6b545b34ba55dbc45aff3ba428..3ef55246270a964c25bff3a4074a10cbb2c7a733 100644 (file)
@@ -54,10 +54,10 @@ proc do_tests {} {
     gdb_reinitialize_dir $srcdir/$subdir
     gdb_load $binfile
 
-    send "set language chill\n" ; expect -re "$prompt $"
+    gdb_test "set language chill ""
 
     runto p
-    send "next\n" ;  expect -re "$prompt $"
+    gdb_test "next ""
     gdb_test_exact "print xx" {= [a:b]}
 }
 
index 450c3351a05280550d896554a21f62f661271c51..5ae609cca88b157343d0b2398247ad149dc642df 100644 (file)
@@ -46,10 +46,10 @@ proc do_tests {} {
     gdb_reinitialize_dir $srcdir/$subdir
     gdb_load $binfile
 
-    send "set language chill\n" ; 
+    send_gdb "set language chill\n" ; 
 
-    send "break pr-5984.ch:6\n"; expect -re "$prompt $"
-    send "run\n"; expect -re "Breakpoint .*pr-5984.ch:6"
+    gdb_test "break pr-5984.ch:6 ""
+    send_gdb "run\n"; expect -re "Breakpoint .*pr-5984.ch:6"
     expect -re "$prompt $"
     gdb_test "next" "Jason Dark.*" "next over Jason Dark"
 }
index 45c66d3e80b88d875127fea89d3a3dab7b2029ae..9fa6f7419347049d102dbab22f1bc7fd6bc525cb 100644 (file)
@@ -46,10 +46,10 @@ proc do_tests {} {
     gdb_reinitialize_dir $srcdir/$subdir
     gdb_load $binfile
 
-    send "set language chill\n" ; 
+    send_gdb "set language chill\n" ; 
 
-    send "break pr-6292.ch:15\n"; expect -re "$prompt $"
-    send "run\n"; expect -re "Breakpoint .*pr-6292.ch:15.*$prompt $"
+    gdb_test "break pr-6292.ch:15 ""
+    send_gdb "run\n"; expect -re "Breakpoint .*pr-6292.ch:15.*$prompt $"
     gdb_test_exact "call klaus()" {here's klaus calling.}
     gdb_test {set fred(10, i)} {a was '10'; b was '12'.}
     gdb_test "print i" { = 13} "print i after call"
index 51650f5efb0660282a3df7f8821ab4259a382499..5baaded0b49b1792011812f07feb16ab0ff76a67 100644 (file)
@@ -55,7 +55,7 @@ proc do_tests {} {
     gdb_reinitialize_dir $srcdir/$subdir
     gdb_load $binfile
 
-    send "set language chill\n" ;  expect -re "$prompt $"
+    gdb_test "set language chill ""
 
     runto p
     gdb_test "whatis x" {type = m_dummy_range}
index bbf97d9f455c5bc2974b79359c193758e0548727..7f269916456e8e36fae3a4b7a8ce46840ff3fd1e 100644 (file)
@@ -55,7 +55,7 @@ proc do_tests {} {
     gdb_reinitialize_dir $srcdir/$subdir
     gdb_load $binfile
 
-    send "set language chill\n" ;  expect -re "$prompt $"
+    gdb_test "set language chill ""
 
     runto p1
     gdb_test "print first" "= 1"
index 133144fe89e89ef40ab6abe08489d993272bab7f..4fc0f7d1f11b4cfb2610bbc4ff7d9b493bd610f7 100644 (file)
@@ -54,7 +54,7 @@ proc do_tests {} {
     gdb_reinitialize_dir $srcdir/$subdir
     gdb_load $binfile
 
-    send "set language chill\n" ;  expect -re "$prompt $"
+    gdb_test "set language chill ""
 
     runto p1
     gdb_test "print ps" {= \[e3, e7:e9\]}
index 9dcf67694aedcdbe2140457efc10fab3e862713c..c21f961194aab9ed3795b5ea7ae920a526398848 100644 (file)
@@ -35,8 +35,8 @@ proc do_tests {} {
     gdb_start
     gdb_load $binfile
 
-    send "set language chill\n" ;  expect -re "$prompt $"
-    send "set var \$i:=xx\n" ;  expect -re "$prompt $"
+    gdb_test "set language chill ""
+    gdb_test "set var \$i:=xx ""
     gdb_test "print \$i" {= \[.c: "", .b: B'00000000', .boo: FALSE\]}
 }
 
index 9ffe82c7868013e679baa4eee03b9dc6ca759d00..9fbd1c383d15445be70562de653c5db35f50f8c7 100644 (file)
@@ -46,7 +46,7 @@ proc do_tests {} {
     gdb_reinitialize_dir $srcdir/$subdir
     gdb_load $binfile
 
-    send "set language chill\n" ; expect -re "$prompt $"
+    gdb_test "set language chill ""
 
     runto dummy
 
index 58e53a01fe8992bfe01b16fe28b0e55fbd11bfc4..0e3ceeb34df57fe866f939195b9d51e68181798d 100644 (file)
@@ -52,7 +52,7 @@ proc do_tests {} {
     gdb_reinitialize_dir $srcdir/$subdir
     gdb_load $binfile
 
-    send "set language chill\n" ;  expect -re "$prompt $"
+    gdb_test "set language chill ""
 
     gdb_test "print size(m_byte)" { = 2}
     gdb_test "print size(m_struct)" { = 6}
index 455a950663e125acea14fca9799e46b27d2b08f4..1a5df3ea72bd982605a1ffe465f5a13ebfabc75e 100644 (file)
@@ -35,7 +35,7 @@ proc do_tests {} {
     gdb_start
     gdb_load $binfile
 
-    send "set language chill\n" ;  expect -re "$prompt $"
+    gdb_test "set language chill ""
     runto pr-9095.ch:12
     gdb_test {p v_arr2(5)->.p(5)} "reference value used as function" \
        "bad call using pointer"
index dce73dfc9c1597e34bb8e5beda428ef6aa97774a..1897c6a94685ff85367b94b6b4ea20f14ffad5d3 100644 (file)
@@ -45,7 +45,7 @@ proc set_lang_chill {} {
     verbose "loading file '$binfile'"
     gdb_load $binfile
 
-    send "set language chill\n"
+    send_gdb "set language chill\n"
     expect {
         -re ".*$prompt $" {}
         timeout { fail "set language chill (timeout)" ; return 0 }
@@ -64,11 +64,11 @@ gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 
-send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
+gdb_test "set print sevenbit-strings ".*"
 
 if ![set_lang_chill] then {
     runto x_
-    send "next\n" ; expect -re "$prompt $"
+    gdb_test "next ""
     # check comparison of SET's
     gdb_test {print xyz=moving} { = TRUE}
     gdb_test {print xyz/=moving} { = FALSE}
index d10157aa014695212e4dc0f134fca2c81e592018..492b00737bbe84e6be40e86e2b0979d9f2adb86d 100644 (file)
@@ -46,31 +46,31 @@ proc do_tests {} {
     gdb_reinitialize_dir $srcdir/$subdir
     gdb_load $binfile
 
-    send "set language chill\n" ; expect -re "$prompt $"
+    gdb_test "set language chill ""
 
-    send "set width 0\n" ; expect -re "$prompt $"
-    send "set print sevenbit-strings\n" ; expect -re "$prompt $"
-    send "set print address off\n" ; expect -re "$prompt $"
+    gdb_test "set width 0 ""
+    gdb_test "set print sevenbit-strings ""
+    gdb_test "set print address off ""
 
     # simple function
     runto simple_func
-    send "step 2\n" ; expect -re "$prompt $"
+    gdb_test "step 2 ""
     gdb_test "print j" "= 5"
     gdb_test "p RESULT" "= 10"
-    send "continue\n" ; expect -re "$prompt $"
+    gdb_test "continue ""
     gdb_test "print i" "= 7"
-    send "step 4\n" ; expect -re "$prompt $"
-    send "set RESULT := 50\n" ; expect -re "$prompt $"
-    send "finish\n" ; expect -re "$prompt $"
-    send "step\n" ; expect -re "$prompt $"
+    gdb_test "step 4 ""
+    gdb_test "set RESULT := 50 ""
+    gdb_test "finish ""
+    gdb_test "step ""
     gdb_test "print i" "= 50"
 
     # returning a structure
     runto ret_struct
-    send "step 2\n"; expect -re "$prompt $"
+    gdb_test "step 2 ""
     gdb_test "p result" {\[.l: 33, .b: FALSE\]}
-    send "set var result := \[383, TRUE\]\n"; expect -re "$prompt $"
-    send "finish\n"; expect -re "$prompt $"
+    gdb_test "set var result := \[383, TRUE\] ""
+    gdb_test "finish ""
     gdb_test "p v_struct" {\[.l: 383, .b: TRUE\]}
 }
 
index 54c88dabe80d60c556763e771b0936dc8ccde66c..794fd732cbdeaa5feb7591d31513eef92481e920 100644 (file)
@@ -44,7 +44,7 @@ proc do_tests {} {
     gdb_reinitialize_dir $srcdir/$subdir
     gdb_load $binfile
 
-    send "set language chill\n" ; expect -re "$prompt $"
+    gdb_test "set language chill ""
 
     # These tests based on Cygnus PR chill/5696.
     runto string.ch:22
index 9102ffc4d99443957795bddd26c1ede282dcc219..010968733b0ead9c08fc4b5944f6f4a50a5cd41c 100644 (file)
@@ -42,20 +42,20 @@ proc set_lang_chill {} {
 
     verbose "loading file '$binfile'"
     gdb_load $binfile
-    send "set language chill\n"
+    send_gdb "set language chill\n"
     expect {
        -re ".*$prompt $" {}
        timeout { fail "set language chill (timeout)" ; return 0 }
     }
 
-    send "show language\n"
+    send_gdb "show language\n"
     expect {
        -re ".* source language is \"chill\".*$prompt $" {
            pass "set language to \"chill\""
-           send "break dummyfunc\n"
+           send_gdb "break dummyfunc\n"
            expect {
                -re ".*$prompt $" {
-                   send "run\n" 
+                   send_gdb "run\n" 
                    expect -re ".*$prompt $" {}
                    return 1
                }
@@ -85,7 +85,7 @@ proc set_lang_chill {} {
 #
 # Args are:
 #
-#      First one is string to send to gdb
+#      First one is string to send_gdb to gdb
 #      Second one is string to match gdb result to
 #      Third one is an optional message to be printed
 
@@ -811,7 +811,7 @@ gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 
-send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
+gdb_test "set print sevenbit-strings ".*"
 
 if [set_lang_chill] then {
     test_modes
index 7bc5db41c91d2f4d681719a56912d3680e1aeab7..45f89b09c684985f0f5db8047ee9fd32f7244052 100644 (file)
@@ -54,20 +54,20 @@ proc set_lang_chill {} {
     verbose "loading file '$objdir/$subdir/$binfile'"
     gdb_load $objdir/$subdir/$binfile
 
-    send "set language chill\n"
+    send_gdb "set language chill\n"
     expect {
        -re ".*$prompt $" {}
        timeout { fail "set language chill (timeout)" ; return 0 }
     }
 
-    send "show language\n"
+    send_gdb "show language\n"
     expect {
        -re ".* source language is \"chill\".*$prompt $" {
            pass "set language to \"chill\""
-           send "break dummyfunc\n"
+           send_gdb "break dummyfunc\n"
            expect {
                -re ".*$prompt $" {
-                   send "run\n"
+                   send_gdb "run\n"
                    expect -re ".*$prompt $" {}
                    return 1
                }
@@ -116,7 +116,7 @@ proc test_write { args } {
     verbose "loc: $location, val: $value, msg: $message, ext: $extended, match: $matchval"
 
     verbose "setting var $value..."
-    send "set var $location.m$extended := $value\n"
+    send_gdb "set var $location.m$extended := $value\n"
     expect -re ".*$prompt $" {}
     gdb_test "print $location" \
       ".*= \[\[\]\\.p1: 2863311530, \\.m: $matchval, \\.p2: 1431655765\[\]\]"\
@@ -262,7 +262,7 @@ gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 
-send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
+gdb_test "set print sevenbit-strings ".*"
 
 if [set_lang_chill] then {
     write_access
index 5204c762a12983aa120cc24412751a2033b403f1..639a10eab83e7375195cb3cd6120b20edf06a29d 100644 (file)
@@ -46,7 +46,7 @@ proc do_tests {} {
     gdb_reinitialize_dir $srcdir/$subdir
     gdb_load $binfile
 
-    send "set language chill\n" ; expect -re "$prompt $"
+    gdb_test "set language chill ""
 
     runto tuples.ch:40
 
@@ -109,8 +109,8 @@ proc do_tests {} {
    gdb_test_exact "print vstr.ch1" {= 'x'} "vstr.ch1 after assignment"
 
 #   These tests are from Cygnus PR chill/5024:
-    send "break printdow\n" ; expect -re "$prompt $"
-    send "continue\n" ; expect -re "$prompt $"
+    gdb_test "break printdow ""
+    gdb_test "continue ""
     gdb_test_exact "set var w:= dow\[monday\]" {}
     gdb_test "print w" " = \\\[monday\\\]" \
        "print bitstring after assignment"
index e2b7ef7db05c45b67e219dbe79c0b67055f24856..190bed4ebf7eb7103bbe76dc5a0b6f1350d520b5 100644 (file)
@@ -1,3 +1,4 @@
+
 # Copyright (C) 1992 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -12,7 +13,7 @@
 # 
 # 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.  */
+# 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
@@ -23,20 +24,36 @@ if $tracelevel then {
        strace $tracelevel
 }
 
+if ![istarget "hppa*-*-*"] {
+    verbose "Tests ignored for all but hppa based targets."
+    return
+}
+
+global exec_output
 set prms_id 0
 set bug_id 0
 
-set binfile "hppa"
-set srcfile $binfile.s
+set testfile "hppa"
+set srcfile ${srcdir}/${subdir}/${testfile}.s
+set binfile ${objdir}/${subdir}/${testfile}
+if  { [gdb_compile "${srcfile}" "${binfile}" executable ""] != "" } {
+    if [ regexp "Opcode not defined - DIAG" $exec_output] {
+       warning "HP assembler in use--skipping disasm tests"
+       return
+    } else {
+       perror "Couldn't compile ${srcfile}"
+       return -1
+    }
+}
 
 proc all_integer_memory_tests { } {
     global prompt
     global hex
     global decimal
 
-    send "x/8i integer_memory_tests\n"
+    send_gdb "x/8i integer_memory_tests\n"
     expect {
-       -re ".*
+       -re "
 .*ldw 0\\(sr0,r4\\),r26.*
 .*ldh 0\\(sr0,r4\\),r26.*
 .*ldb 0\\(sr0,r4\\),r26.*
@@ -50,9 +67,9 @@ proc all_integer_memory_tests { } {
        timeout { fail "(timeout) integer memory_tests" }
     }
 
-    send "x/20i integer_indexing_load\n"
+    send_gdb "x/20i integer_indexing_load\n"
     expect {
-       -re ".*
+       -re "
 .*ldwx r5\\(sr0,r4\\),r26.*
 .*ldwx,s r5\\(sr0,r4\\),r26.*
 .*ldwx,m r5\\(sr0,r4\\),r26.*
@@ -78,9 +95,9 @@ proc all_integer_memory_tests { } {
        timeout { fail "(timeout) integer_indexing" }
     }
 
-    send "x/15i integer_load_short_memory\n"
+    send_gdb "x/15i integer_load_short_memory\n"
     expect {
-       -re ".*
+       -re "
 .*ldws 0\\(sr0,r4\\),r26.*
 .*ldws,mb 0\\(sr0,r4\\),r26.*
 .*ldws,ma 0\\(sr0,r4\\),r26.*
@@ -102,9 +119,9 @@ proc all_integer_memory_tests { } {
     }
 
 
-    send "x/17i integer_store_short_memory\n"
+    send_gdb "x/17i integer_store_short_memory\n"
     expect {
-       -re ".*
+       -re "
 .*stws r26,0\\(sr0,r4\\).*
 .*stws,mb r26,0\\(sr0,r4\\).*
 .*stws,ma r26,0\\(sr0,r4\\).*
@@ -133,9 +150,9 @@ proc all_immediate_tests { } {
     global hex
     global decimal
 
-    send "x/3i immediate_tests\n"
+    send_gdb "x/3i immediate_tests\n"
     expect {
-       -re ".*
+       -re "
 .*ldo 5\\(r26\\),r26.*
 .*ldil -21524800,r26.*
 .*addil -21524800,r5.*
@@ -150,9 +167,9 @@ proc all_branch_tests { } {
     global hex
     global decimal
 
-    send "x/10i branch_tests_1\n"
+    send_gdb "x/10i branch_tests_1\n"
     expect {
-       -re ".*
+       -re "
 .*bl.*,rp.*
 .*bl,n.*,rp.*
 .*b.*
@@ -168,9 +185,9 @@ proc all_branch_tests { } {
        timeout { fail "(timeout) branch_tests_1" }
     }
 
-    send "x/6i branch_tests_2\n"
+    send_gdb "x/6i branch_tests_2\n"
     expect {
-       -re ".*
+       -re "
 .*bv r0\\(rp\\).*
 .*bv,n r0\\(rp\\).*
 .*be 1234\\(sr1,rp\\).*
@@ -183,9 +200,9 @@ proc all_branch_tests { } {
     }
 
 
-    send "x/8i movb_tests\n"
+    send_gdb "x/8i movb_tests\n"
     expect {
-       -re ".*
+       -re "
 .*movb r4,r26,.* <movb_tests>.*
 .*movb,= r4,r26,.* <movb_tests>.*
 .*movb,< r4,r26,.* <movb_tests>.*
@@ -199,9 +216,9 @@ proc all_branch_tests { } {
        timeout { fail "(timeout) movb_tests " }
     }
 
-    send "x/8i movb_nullified_tests\n"
+    send_gdb "x/8i movb_nullified_tests\n"
     expect {
-       -re ".*
+       -re "
 .*movb,n.*r4,r26,.* <movb_tests>.*
 .*movb,=,n.*r4,r26,.* <movb_tests>.*
 .*movb,<,n.*r4,r26,.* <movb_tests>.*
@@ -215,9 +232,9 @@ proc all_branch_tests { } {
        timeout { fail "(timeout) movb_nullified_tests " }
     }
 
-    send "x/8i movib_tests\n"
+    send_gdb "x/8i movib_tests\n"
     expect {
-       -re ".*
+       -re "
 .*movib 5,r26,.* <movib_tests>.*
 .*movib,= 5,r26,.* <movib_tests>.*
 .*movib,< 5,r26,.* <movib_tests>.*
@@ -231,9 +248,9 @@ proc all_branch_tests { } {
        timeout { fail "(timeout) movib_tests " }
     }
 
-    send "x/8i movib_nullified_tests\n"
+    send_gdb "x/8i movib_nullified_tests\n"
     expect {
-       -re ".*
+       -re "
 .*movib,n.*5,r26,.* <movib_tests>.*
 .*movib,=,n.*5,r26,.* <movib_tests>.*
 .*movib,<,n.*5,r26,.* <movib_tests>.*
@@ -247,9 +264,9 @@ proc all_branch_tests { } {
        timeout { fail "(timeout) movib_nullified_tests " }
     }
 
-    send "x/8i comb_tests_1\n"
+    send_gdb "x/8i comb_tests_1\n"
     expect {
-       -re ".*
+       -re "
 .*comb r0,r4,.* <comb_tests_1>.*
 .*comb,= r0,r4,.* <comb_tests_1>.*
 .*comb,< r0,r4,.* <comb_tests_1>.*
@@ -263,9 +280,9 @@ proc all_branch_tests { } {
        timeout { fail "(timeout) comb_tests_1" }
     }
 
-    send "x/8i comb_tests_2\n"
+    send_gdb "x/8i comb_tests_2\n"
     expect {
-       -re ".*
+       -re "
 .*combf r0,r4,.* <comb_tests_2>.*
 .*combf,= r0,r4,.* <comb_tests_2>.*
 .*combf,< r0,r4,.* <comb_tests_2>.*
@@ -279,9 +296,9 @@ proc all_branch_tests { } {
        timeout { fail "(timeout) comb_tests_2" }
     }
 
-    send "x/8i comb_nullified_tests_1\n"
+    send_gdb "x/8i comb_nullified_tests_1\n"
     expect {
-       -re ".*
+       -re "
 .*comb,n r0,r4,.* <comb_tests_1>.*
 .*comb,=,n r0,r4,.* <comb_tests_1>.*
 .*comb,<,n r0,r4,.* <comb_tests_1>.*
@@ -295,9 +312,9 @@ proc all_branch_tests { } {
        timeout { fail "(timeout) comb_nullified_tests_1" }
     }
 
-    send "x/8i comb_nullified_tests_2\n"
+    send_gdb "x/8i comb_nullified_tests_2\n"
     expect {
-       -re ".*
+       -re "
 .*combf,n r0,r4,.* <comb_tests_2>.*
 .*combf,=,n r0,r4,.* <comb_tests_2>.*
 .*combf,<,n r0,r4,.* <comb_tests_2>.*
@@ -311,9 +328,9 @@ proc all_branch_tests { } {
        timeout { fail "(timeout) comb_nullified_tests_2" }
     }
 
-    send "x/8i comib_tests_1\n"
+    send_gdb "x/8i comib_tests_1\n"
     expect {
-       -re ".*
+       -re "
 .*comib 0,r4,.* <comib_tests_1>.*
 .*comib,= 0,r4,.* <comib_tests_1>.*
 .*comib,< 0,r4,.* <comib_tests_1>.*
@@ -327,9 +344,9 @@ proc all_branch_tests { } {
        timeout { fail "(timeout) comib_tests_1" }
     }
 
-    send "x/8i comib_tests_2\n"
+    send_gdb "x/8i comib_tests_2\n"
     expect {
-       -re ".*
+       -re "
 .*comibf 0,r4,.* <comib_tests_2>.*
 .*comibf,= 0,r4,.* <comib_tests_2>.*
 .*comibf,< 0,r4,.* <comib_tests_2>.*
@@ -343,9 +360,9 @@ proc all_branch_tests { } {
        timeout { fail "(timeout) comib_tests_2" }
     }
 
-    send "x/8i comib_nullified_tests_1\n"
+    send_gdb "x/8i comib_nullified_tests_1\n"
     expect {
-       -re ".*
+       -re "
 .*comib,n 0,r4,.* <comib_tests_1>.*
 .*comib,=,n 0,r4,.* <comib_tests_1>.*
 .*comib,<,n 0,r4,.* <comib_tests_1>.*
@@ -359,9 +376,9 @@ proc all_branch_tests { } {
        timeout { fail "(timeout) comib_nullified_tests_1" }
     }
 
-    send "x/8i comib_nullified_tests_2\n"
+    send_gdb "x/8i comib_nullified_tests_2\n"
     expect {
-       -re ".*
+       -re "
 .*comibf,n 0,r4,.* <comib_tests_2>.*
 .*comibf,=,n 0,r4,.* <comib_tests_2>.*
 .*comibf,<,n 0,r4,.* <comib_tests_2>.*
@@ -375,9 +392,9 @@ proc all_branch_tests { } {
        timeout { fail "(timeout) comib_nullified_tests_2" }
     }
 
-    send "x/8i addb_tests_1\n"
+    send_gdb "x/8i addb_tests_1\n"
     expect {
-       -re ".*
+       -re "
 .*addb r1,r4,.* <addb_tests_1>.*
 .*addb,= r1,r4,.* <addb_tests_1>.*
 .*addb,< r1,r4,.* <addb_tests_1>.*
@@ -391,9 +408,9 @@ proc all_branch_tests { } {
        timeout { fail "(timeout) addb_tests_1" }
     }
 
-    send "x/8i addb_tests_2\n"
+    send_gdb "x/8i addb_tests_2\n"
     expect {
-       -re ".*
+       -re "
 .*addbf r1,r4,.* <addb_tests_2>.*
 .*addbf,= r1,r4,.* <addb_tests_2>.*
 .*addbf,< r1,r4,.* <addb_tests_2>.*
@@ -407,9 +424,9 @@ proc all_branch_tests { } {
        timeout { fail "(timeout) addb_tests_2" }
     }
 
-    send "x/8i addb_nullified_tests_1\n"
+    send_gdb "x/8i addb_nullified_tests_1\n"
     expect {
-       -re ".*
+       -re "
 .*addb,n r1,r4,.* <addb_tests_1>.*
 .*addb,=,n r1,r4,.* <addb_tests_1>.*
 .*addb,<,n r1,r4,.* <addb_tests_1>.*
@@ -423,9 +440,9 @@ proc all_branch_tests { } {
        timeout { fail "(timeout) addb_nullified_tests_1" }
     }
 
-    send "x/8i addb_nullified_tests_2\n"
+    send_gdb "x/8i addb_nullified_tests_2\n"
     expect {
-       -re ".*
+       -re "
 .*addbf,n r1,r4,.* <addb_tests_2>.*
 .*addbf,=,n r1,r4,.* <addb_tests_2>.*
 .*addbf,<,n r1,r4,.* <addb_tests_2>.*
@@ -439,9 +456,9 @@ proc all_branch_tests { } {
        timeout { fail "(timeout) addb_nullified_tests_2" }
     }
 
-    send "x/8i addib_tests_1\n"
+    send_gdb "x/8i addib_tests_1\n"
     expect {
-       -re ".*
+       -re "
 .*addib -1,r4,.* <addib_tests_1>.*
 .*addib,= -1,r4,.* <addib_tests_1>.*
 .*addib,< -1,r4,.* <addib_tests_1>.*
@@ -455,9 +472,9 @@ proc all_branch_tests { } {
        timeout { fail "(timeout) addib_tests_1" }
     }
 
-    send "x/8i addib_tests_2\n"
+    send_gdb "x/8i addib_tests_2\n"
     expect {
-       -re ".*
+       -re "
 .*addibf -1,r4,.* <addib_tests_2>.*
 .*addibf,= -1,r4,.* <addib_tests_2>.*
 .*addibf,< -1,r4,.* <addib_tests_2>.*
@@ -471,9 +488,9 @@ proc all_branch_tests { } {
        timeout { fail "(timeout) addib_tests_2" }
     }
 
-    send "x/8i addib_nullified_tests_1\n"
+    send_gdb "x/8i addib_nullified_tests_1\n"
     expect {
-       -re ".*
+       -re "
 .*addib,n -1,r4,.* <addib_tests_1>.*
 .*addib,=,n -1,r4,.* <addib_tests_1>.*
 .*addib,<,n -1,r4,.* <addib_tests_1>.*
@@ -487,9 +504,9 @@ proc all_branch_tests { } {
        timeout { fail "(timeout) addb_nullified_tests_1" }
     }
 
-    send "x/8i addib_nullified_tests_2\n"
+    send_gdb "x/8i addib_nullified_tests_2\n"
     expect {
-       -re ".*
+       -re "
 .*addibf,n -1,r4,.* <addib_tests_2>.*
 .*addibf,=,n -1,r4,.* <addib_tests_2>.*
 .*addibf,<,n -1,r4,.* <addib_tests_2>.*
@@ -503,9 +520,9 @@ proc all_branch_tests { } {
        timeout { fail "(timeout) addb_nullified_tests_2" }
     }
 
-    send "x/8i bb_tests\n"
+    send_gdb "x/8i bb_tests\n"
     expect {
-       -re ".*
+       -re "
 .*bvb,< r4,.* <bb_tests>.*
 .*bvb,>= r4,.* <bb_tests>.*
 .*bvb,<,n r4,.* <bb_tests>.*
@@ -531,9 +548,9 @@ proc all_integer_computational_tests { } {
                        {sh3add} {sh3addl} {sh3addo} ]
 
     foreach i $add_insns {
-       send "x/16i $i"; send "_tests\n"
+       send_gdb "x/16i $i"; send_gdb "_tests\n"
        expect {
-           -re ".*
+           -re "
 .*$i r4,r5,r6.*
 .*$i,= r4,r5,r6.*
 .*$i,< r4,r5,r6.*
@@ -560,9 +577,9 @@ proc all_integer_computational_tests { } {
                        {ds} {comclr} ]
 
     foreach i $sub_insns {
-       send "x/16i $i"; send "_tests\n"
+       send_gdb "x/16i $i"; send_gdb "_tests\n"
        expect {
-           -re ".*
+           -re "
 .*$i r4,r5,r6.*
 .*$i,= r4,r5,r6.*
 .*$i,< r4,r5,r6.*
@@ -588,9 +605,9 @@ proc all_integer_computational_tests { } {
     set logical_insns [list {or} {xor} {and} {andcm} ]
 
     foreach i $logical_insns {
-       send "x/10i $i"; send "_tests\n"
+       send_gdb "x/10i $i"; send_gdb "_tests\n"
        expect {
-           -re ".*
+           -re "
 .*$i r4,r5,r6.*
 .*$i,= r4,r5,r6.*
 .*$i,< r4,r5,r6.*
@@ -610,9 +627,9 @@ proc all_integer_computational_tests { } {
     set unit_insns1 [list {uxor} {uaddcm} {uaddcmt} ]
 
     foreach i $unit_insns1 {
-       send "x/12i $i"; send "_tests\n"
+       send_gdb "x/12i $i"; send_gdb "_tests\n"
        expect {
-           -re ".*
+           -re "
 .*$i r4,r5,r6.*
 .*$i,sbz r4,r5,r6.*
 .*$i,shz r4,r5,r6.*
@@ -634,9 +651,9 @@ proc all_integer_computational_tests { } {
     set unit_insns2 [list {dcor} {idcor} ]
 
     foreach i $unit_insns2 {
-       send "x/12i $i"; send "_tests\n"
+       send_gdb "x/12i $i"; send_gdb "_tests\n"
        expect {
-           -re ".*
+           -re "
 .*$i r4,r5.*
 .*$i,sbz r4,r5.*
 .*$i,shz r4,r5.*
@@ -658,9 +675,9 @@ proc all_integer_computational_tests { } {
     set addi_insns [list {addi} {addio} {addit} {addito} ]
 
     foreach i $addi_insns {
-       send "x/16i $i"; send "_tests\n"
+       send_gdb "x/16i $i"; send_gdb "_tests\n"
        expect {
-           -re ".*
+           -re "
 .*$i 7b,r5,r6.*
 .*$i,= 7b,r5,r6.*
 .*$i,< 7b,r5,r6.*
@@ -686,9 +703,9 @@ proc all_integer_computational_tests { } {
     set subi_insns [list {subi} {subio} {comiclr} ] 
 
     foreach i $subi_insns {
-       send "x/16i $i"; send "_tests\n"
+       send_gdb "x/16i $i"; send_gdb "_tests\n"
        expect {
-           -re ".*
+           -re "
 .*$i 7b,r5,r6.*
 .*$i,= 7b,r5,r6.*
 .*$i,< 7b,r5,r6.*
@@ -711,9 +728,9 @@ proc all_integer_computational_tests { } {
        }
     }
 
-    send "x/8i vshd_tests\n"
+    send_gdb "x/8i vshd_tests\n"
     expect {
-       -re ".*
+       -re "
 .*vshd r4,r5,r6.*
 .*vshd,= r4,r5,r6.*
 .*vshd,< r4,r5,r6.*
@@ -727,9 +744,9 @@ proc all_integer_computational_tests { } {
            timeout { fail "(timeout) "vshd tests" }
        }
 
-    send "x/8i shd_tests\n"
+    send_gdb "x/8i shd_tests\n"
     expect {
-       -re ".*
+       -re "
 .*shd r4,r5,5,r6.*
 .*shd,= r4,r5,5,r6.*
 .*shd,< r4,r5,5,r6.*
@@ -746,9 +763,9 @@ proc all_integer_computational_tests { } {
     set extract_insns1 [list {extru} {extrs} {zdep} {dep} ] 
 
     foreach i $extract_insns1 {
-       send "x/8i $i"; send "_tests\n"
+       send_gdb "x/8i $i"; send_gdb "_tests\n"
        expect {
-           -re ".*
+           -re "
 .*$i r4,5,10,r6.*
 .*$i,= r4,5,10,r6.*
 .*$i,< r4,5,10,r6.*
@@ -766,9 +783,9 @@ proc all_integer_computational_tests { } {
     set extract_insns2 [list {vextru} {vextrs} {zvdep} {vdep} ] 
 
     foreach i $extract_insns2 {
-       send "x/8i $i"; send "_tests\n"
+       send_gdb "x/8i $i"; send_gdb "_tests\n"
        expect {
-           -re ".*
+           -re "
 .*$i r4,5,r6.*
 .*$i,= r4,5,r6.*
 .*$i,< r4,5,r6.*
@@ -786,9 +803,9 @@ proc all_integer_computational_tests { } {
     set extract_insns3 [list {vdepi} {zvdepi} ] 
 
     foreach i $extract_insns3 {
-       send "x/8i $i"; send "_tests\n"
+       send_gdb "x/8i $i"; send_gdb "_tests\n"
        expect {
-           -re ".*
+           -re "
 .*$i -1,5,r6.*
 .*$i,= -1,5,r6.*
 .*$i,< -1,5,r6.*
@@ -806,9 +823,9 @@ proc all_integer_computational_tests { } {
     set extract_insns4 [list {depi} {zdepi} ] 
 
     foreach i $extract_insns4 {
-       send "x/8i $i"; send "_tests\n"
+       send_gdb "x/8i $i"; send_gdb "_tests\n"
        expect {
-           -re ".*
+           -re "
 .*$i -1,4,10,r6.*
 .*$i,= -1,4,10,r6.*
 .*$i,< -1,4,10,r6.*
@@ -829,9 +846,9 @@ proc all_system_control_tests { } {
     global hex
     global decimal
 
-    send "x/13i system_control_tests\n"
+    send_gdb "x/14i system_control_tests\n"
     expect {
-       -re ".*
+       -re "
 .*break 5,c.*
 .*rfi.*
 .*rfir.*
@@ -844,15 +861,16 @@ proc all_system_control_tests { } {
 .*mfsp sr0,r4.*
 .*mfctl ccr,r4.*
 .*sync.*
+.*syncdma.*
 .*diag 4d2.*
 .*$prompt $" { pass "system_constrol_tests" }
        -re "$prompt $" { fail "system_control_tests" }
        timeout { file "(timeout) system_control_tests" }
     }
 
-    send "x/4i probe_tests\n"
+    send_gdb "x/4i probe_tests\n"
     expect {
-       -re ".*
+       -re "
 .*prober \\(sr0,r5\\),r6,r7.*
 .*proberi \\(sr0,r5\\),1,r7.*
 .*probew \\(sr0,r5\\),r6,r7.*
@@ -862,21 +880,23 @@ proc all_system_control_tests { } {
        timeout { file "(timeout) probe_tests" }
     }
 
-    send "x/4i lpa_tests\n"
+    # lci uses the same bit pattern as lha, so accept lha.
+    send_gdb "x/5i lpa_tests\n"
     expect {
-       -re ".*
+       -re "
 .*lpa r4\\(sr0,r5\\),r6.*
 .*lpa,m r4\\(sr0,r5\\),r6.*
 .*lha r4\\(sr0,r5\\),r6.*
 .*lha,m r4\\(sr0,r5\\),r6.*
+.*lha r4\\(sr0,r5\\),r6.*
 .*$prompt $" { pass "lpa_tests" }
        -re "$prompt $" { fail "lpa_tests" }
        timeout { file "(timeout) lpa_tests" }
     }
 
-    send "x/18i purge_tests\n"
+    send_gdb "x/18i purge_tests\n"
     expect {
-       -re ".*
+       -re "
 .*pdtlb r4\\(sr0,r5\\).*
 .*pdtlb,m r4\\(sr0,r5\\).*
 .*pitlb r4\\(sr0,r5\\).*
@@ -900,9 +920,9 @@ proc all_system_control_tests { } {
        timeout { file "(timeout) purge_tests" }
     }
 
-    send "x/4i insert_tests\n"
+    send_gdb "x/4i insert_tests\n"
     expect {
-       -re ".*
+       -re "
 .*idtlba r4,\\(sr0,r5\\).*
 .*iitlba r4,\\(sr0,r5\\).*
 .*idtlbp r4,\\(sr0,r5\\).*
@@ -919,9 +939,9 @@ proc all_fpu_memory_tests { } {
     global hex
     global decimal
 
-    send "x/20i fpu_memory_indexing_tests\n"
+    send_gdb "x/20i fpu_memory_indexing_tests\n"
     expect {
-       -re ".*
+       -re "
 .*fldwx r4\\(sr0,r5\\),fr6.*
 .*fldwx,s r4\\(sr0,r5\\),fr6.*
 .*fldwx,m r4\\(sr0,r5\\),fr6.*
@@ -947,9 +967,9 @@ proc all_fpu_memory_tests { } {
        timeout { file "(timeout) fpu_memory_indexing_tests" }
     }
 
-    send "x/15i fpu_short_memory_tests\n"
+    send_gdb "x/15i fpu_short_memory_tests\n"
     expect {
-       -re ".*
+       -re "
 .*fldws 0\\(sr0,r5\\),fr6.*
 .*fldws,mb 0\\(sr0,r5\\),fr6.*
 .*fldws,ma 0\\(sr0,r5\\),fr6.*
@@ -977,9 +997,9 @@ proc all_fpu_computational_tests { } {
     global hex
     global decimal
 
-    send "x/1i fpu_misc_tests\n"
+    send_gdb "x/1i fpu_misc_tests\n"
     expect {
-       -re ".*
+       -re "
 .*ftest.*
 .*$prompt $" { pass "fpu_misc_tests" }
        -re "$prompt $" { fail "fpu_misc_tests" }
@@ -989,9 +1009,9 @@ proc all_fpu_computational_tests { } {
     set fpu_two_op_insns [list {fcpy} {fabs} {fsqrt} {frnd} ]
 
     foreach i $fpu_two_op_insns {
-       send "x/5i $i"; send "_tests\n"
+       send_gdb "x/5i $i"; send_gdb "_tests\n"
        expect {
-           -re ".*
+           -re "
 .*$i,sgl fr5,fr10.*
 .*$i,dbl fr5,fr10.*
 .*$i,quad fr5,fr10.*
@@ -1006,9 +1026,9 @@ proc all_fpu_computational_tests { } {
     set fpu_conversions [list {fcnvff} {fcnvxf} {fcnvfx} {fcnvfxt} ]
 
     foreach i $fpu_conversions {
-       send "x/18i $i"; send "_tests\n"
+       send_gdb "x/18i $i"; send_gdb "_tests\n"
        expect {
-           -re ".*
+           -re "
 .*$i,sgl,sgl fr5,fr10.*
 .*$i,sgl,dbl fr5,fr10.*
 .*$i,sgl,quad fr5,fr10.*
@@ -1036,9 +1056,9 @@ proc all_fpu_computational_tests { } {
     set fpu_three_op_insns [list {fadd} {fsub} {fmpy} {fdiv} {frem} ]
 
     foreach i $fpu_three_op_insns {
-       send "x/6i $i"; send "_tests\n"
+       send_gdb "x/6i $i"; send_gdb "_tests\n"
        expect {
-           -re ".*
+           -re "
 .*$i,sgl fr4,fr8,fr12.*
 .*$i,dbl fr4,fr8,fr12.*
 .*$i,quad fr4,fr8,fr12.*
@@ -1051,9 +1071,9 @@ proc all_fpu_computational_tests { } {
        }
     }
 
-    send "x/4i fmpy_addsub_tests\n"
+    send_gdb "x/4i fmpy_addsub_tests\n"
     expect {
-       -re ".*
+       -re "
 .*fmpyadd,sgl fr16,fr17,fr18,fr19,fr20.*
 .*fmpyadd,dbl fr16,fr17,fr18,fr19,fr20.*
 .*fmpysub,sgl fr16,fr17,fr18,fr19,fr20.*
@@ -1063,9 +1083,9 @@ proc all_fpu_computational_tests { } {
        timeout { fail "(timeout) fmpy_addsub_tests" }
     }
 
-    send "x/i xmpyu_tests\n"
+    send_gdb "x/i xmpyu_tests\n"
     expect {
-       -re ".*
+       -re "
 .*xmpyu fr4,fr5,fr6.*
 .*$prompt $" {pass "xmpyu_tests" }
        -re "$prompt $" {fail "xmpyu_tests" }
@@ -1082,9 +1102,9 @@ proc all_fpu_comparison_tests { } {
     set fpu_comparison_formats [list {sgl} {dbl} {quad} ]
 
     foreach i $fpu_comparison_formats {
-       send "x/8i fcmp_$i"; send "_tests_1\n"
+       send_gdb "x/8i fcmp_$i"; send_gdb "_tests_1\n"
        expect {
-           -re ".*
+           -re "
 .*fcmp,$i,false\\? fr4,fr5.*
 .*fcmp,$i,false fr4,fr5.*
 .*fcmp,$i,\\? fr4,fr5.*
@@ -1098,9 +1118,9 @@ proc all_fpu_comparison_tests { } {
            timeout { fail "(timeout) fcmp_$i tests (part1) " }
        }
 
-       send "x/8i fcmp_$i"; send "_tests_2\n"
+       send_gdb "x/8i fcmp_$i"; send_gdb "_tests_2\n"
        expect {
-           -re ".*
+           -re "
 .*fcmp,$i,!\\?>= fr4,fr5.*
 .*fcmp,$i,< fr4,fr5.*
 .*fcmp,$i,\\?< fr4,fr5.*
@@ -1114,9 +1134,9 @@ proc all_fpu_comparison_tests { } {
            timeout { fail "(timeout) fcmp_$i tests (part2) " }
        }
 
-       send "x/8i fcmp_$i"; send "_tests_3\n"
+       send_gdb "x/8i fcmp_$i"; send_gdb "_tests_3\n"
        expect {
-           -re ".*
+           -re "
 .*fcmp,$i,!\\?<= fr4,fr5.*
 .*fcmp,$i,> fr4,fr5.*
 .*fcmp,$i,\\?> fr4,fr5.*
@@ -1130,9 +1150,9 @@ proc all_fpu_comparison_tests { } {
            timeout { fail "(timeout) fcmp_$i tests (part3) " }
        }
 
-       send "x/16i fcmp_$i"; send "_tests_4\n"
+       send_gdb "x/8i fcmp_$i"; send_gdb "_tests_4\n"
        expect {
-           -re ".*
+           -re "
 .*fcmp,$i,!\\?= fr4,fr5.*
 .*fcmp,$i,<> fr4,fr5.*
 .*fcmp,$i,!= fr4,fr5.*
@@ -1153,9 +1173,9 @@ proc all_special_tests { } {
     global hex
     global decimal
 
-    send "x/4i special_tests\n"
+    send_gdb "x/4i special_tests\n"
     expect {
-       -re ".*
+       -re "
 .*gfw r4\\(sr0,r5\\).*
 .*gfw,m r4\\(sr0,r5\\).*
 .*gfr r4\\(sr0,r5\\).*
@@ -1172,9 +1192,9 @@ proc all_sfu_tests { } {
     global hex
     global decimal
 
-    send "x/16i sfu_tests\n"
+    send_gdb "x/16i sfu_tests\n"
     expect {
-       -re ".*
+       -re "
 .*spop0,4,5.*
 .*spop0,4,73.*
 .*spop0,4,5,n.*
@@ -1202,9 +1222,9 @@ proc all_copr_tests { } {
     global hex
     global decimal
 
-    send "x/4i copr_tests\n"
+    send_gdb "x/4i copr_tests\n"
     expect {
-       -re ".*
+       -re "
 .*copr,4,5.*
 .*copr,4,73.*
 .*copr,4,5,n.*
@@ -1220,9 +1240,9 @@ proc all_copr_mem_tests { } {
     global hex
     global decimal
 
-    send "x/8i copr_indexing_load\n"
+    send_gdb "x/8i copr_indexing_load\n"
     expect {
-       -re ".*
+       -re "
 .*cldwx,4 r5\\(sr0,r4\\),r26.*
 .*cldwx,4,s r5\\(sr0,r4\\),r26.*
 .*cldwx,4,m r5\\(sr0,r4\\),r26.*
@@ -1236,9 +1256,9 @@ proc all_copr_mem_tests { } {
        timeout { fail "(timeout) copr indexed load tests " }
     }
 
-    send "x/8i copr_indexing_store\n"
+    send_gdb "x/8i copr_indexing_store\n"
     expect {
-       -re ".*
+       -re "
 .*cstwx,4 r26,r5\\(sr0,r4\\).*
 .*cstwx,4,s r26,r5\\(sr0,r4\\).*
 .*cstwx,4,m r26,r5\\(sr0,r4\\).*
@@ -1252,9 +1272,9 @@ proc all_copr_mem_tests { } {
        timeout { fail "(timeout) copr indexed load tests " }
     }
 
-    send "x/12i copr_short_memory\n"
+    send_gdb "x/12i copr_short_memory\n"
     expect {
-       -re ".*
+       -re "
 .*cldws,4 0\\(sr0,r4\\),r26.*
 .*cldws,4,mb 0\\(sr0,r4\\),r26.*
 .*cldws,4,ma 0\\(sr0,r4\\),r26.*
@@ -1278,9 +1298,9 @@ proc fmemLRbug_tests { } {
     global hex
     global decimal
 
-    send "x/12i fmemLRbug_tests_1\n"
+    send_gdb "x/12i fmemLRbug_tests_1\n"
     expect {
-       -re ".*
+       -re "
 .*fstws fr6R,0\\(sr0,r26\\).*
 .*fstws fr6,4\\(sr0,r26\\).*
 .*fstws fr6,8\\(sr0,r26\\).*
@@ -1298,9 +1318,9 @@ proc fmemLRbug_tests { } {
        timeout { fail "(timeout) fmem LR register selector tests  (part1)" }
     }
 
-    send "x/12i fmemLRbug_tests_2\n"
+    send_gdb "x/12i fmemLRbug_tests_2\n"
     expect {
-       -re ".*
+       -re "
 .*fstws fr6R,0\\(sr0,r26\\).*
 .*fstws fr6,4\\(sr0,r26\\).*
 .*fstws fr6,8\\(sr0,r26\\).*
@@ -1318,9 +1338,9 @@ proc fmemLRbug_tests { } {
        timeout { fail "(timeout) fmem LR register selector tests  (part2)" }
     }
 
-    send "x/12i fmemLRbug_tests_3\n"
+    send_gdb "x/12i fmemLRbug_tests_3\n"
     expect {
-       -re ".*
+       -re "
 .*fstwx fr6R,r25\\(sr0,r26\\).*
 .*fstwx fr6,r25\\(sr0,r26\\).*
 .*fstwx fr6,r25\\(sr0,r26\\).*
@@ -1338,9 +1358,9 @@ proc fmemLRbug_tests { } {
        timeout { fail "(timeout) fmem LR register selector tests  (part3)" }
     }
 
-    send "x/12i fmemLRbug_tests_4\n"
+    send_gdb "x/12i fmemLRbug_tests_4\n"
     expect {
-       -re ".*
+       -re "
 .*fstwx fr6R,r25\\(sr0,r26\\).*
 .*fstwx fr6,r25\\(sr0,r26\\).*
 .*fstwx fr6,r25\\(sr0,r26\\).*
@@ -1359,31 +1379,25 @@ proc fmemLRbug_tests { } {
     }
 }
 
-if ![file exists $objdir/$subdir/$binfile] then {
-    if $all_flag then {
-       warning "$objdir/$subdir/$binfile does not exist; tests suppressed"
-    }
-} else {
-    # Start with a fresh gdb.
-
-    gdb_exit
-    gdb_start
-    gdb_reinitialize_dir $srcdir/$subdir
-    gdb_load $objdir/$subdir/$binfile
-
-    all_integer_memory_tests
-    all_immediate_tests
-    all_branch_tests
-    all_integer_computational_tests
-    all_system_control_tests
-    all_fpu_memory_tests
-    all_fpu_computational_tests
-    all_fpu_comparison_tests
-    all_special_tests
-    all_sfu_tests
-    all_copr_tests
-    all_copr_mem_tests
-
-    # Regression test for a bug Tege found.
-    fmemLRbug_tests
-}
+# Start with a fresh gdb.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load $binfile
+
+all_integer_memory_tests
+all_immediate_tests
+all_branch_tests
+all_integer_computational_tests
+all_system_control_tests
+all_fpu_memory_tests
+all_fpu_computational_tests
+all_fpu_comparison_tests
+all_special_tests
+all_sfu_tests
+all_copr_tests
+all_copr_mem_tests
+
+# Regression test for a bug Tege found.
+fmemLRbug_tests
index adcd11d65c76291b24c568a90d763636b402a226..52f86f334abef28275ccf35b68f8fd4c5a04ab88 100644 (file)
@@ -23,18 +23,28 @@ if $tracelevel then {
        strace $tracelevel
 }
 
+if ![istarget "sh3*-*-*"] {
+    verbose "Tests ignored for all but sh3 based targets."
+    return
+}
+
 set prms_id 0
 set bug_id 0
 
-set binfile "sh3"
-set srcfile $binfile.s
+set testfile "sh3"
+set srcfile ${srcdir}/${subdir}/${testfile}.s
+set binfile ${objdir}/${subdir}/${testfile}
+if  { [gdb_compile "${srcfile}" "${binfile}" executable ""] != "" } {
+    perror "Couldn't link ${binfile}"
+    return -1
+}
 
 proc all_fp_move_and_load_tests { } {
     global prompt
     global hex
     global decimal
 
-    send "x/9i fp_move_and_load_tests\n"
+    send_gdb "x/9i fp_move_and_load_tests\n"
     expect {
        -re "
 .*fmov.s\t@r0,fr0.*
@@ -57,14 +67,14 @@ proc all_fp_arithmetic_tests { } {
     global hex
     global decimal
 
-    send "x/13i fp_arithmetic_tests\n"
+    send_gdb "x/13i fp_arithmetic_tests\n"
     expect {
        -re "
 .*fadd\tfr0,fr1.*
 .*fsub\tfr0,fr1.*
 .*fmul\tfr0,fr1.*
 .*fdiv\tfr0,fr1.*
-.*fmac\tfr0,fr1.*
+.*fmac\tfr0,fr0,fr1.*
 .*fcmp/eq\tfr0,fr1.*
 .*fcmp/gt\tfr0,fr1.*
 .*ftst/nan\tfr0.*
@@ -84,7 +94,7 @@ proc all_fp_misc_tests { } {
     global hex
     global decimal
 
-    send "x/10i fp_misc_tests\n"
+    send_gdb "x/10i fp_misc_tests\n"
     expect {
        -re "
 .*fsts\tfpul,fr0.*
@@ -103,19 +113,12 @@ proc all_fp_misc_tests { } {
     }
 }
 
-if ![file exists $objdir/$subdir/$binfile] then {
-    if $all_flag then {
-       warning "$objdir/$subdir/$binfile does not exist; tests suppressed"
-    }
-} else {
-    # Start with a fresh gdb.
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load $binfile
 
-    gdb_exit
-    gdb_start
-    gdb_reinitialize_dir $srcdir/$subdir
-    gdb_load $objdir/$subdir/$binfile
+all_fp_move_and_load_tests
+all_fp_arithmetic_tests
+all_fp_misc_tests
 
-    all_fp_move_and_load_tests
-    all_fp_arithmetic_tests
-    all_fp_misc_tests
-}
index 28c86fe963160385f12b545b29a0c75e4b3a4ac1..0392843341dbf9d6567d6071e2a13c8e915a1b10 100644 (file)
@@ -12,7 +12,7 @@
 # 
 # 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.  */
+# 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
@@ -31,27 +31,15 @@ set bug_id 0
 
 proc set_lang_fortran {} {
     global prompt
-
-    send "set language fortran\n"
-    expect {
-       -re ".*$prompt $" {}
-       timeout { fail "set language fortran (timeout)" ; return 0 }
+    
+    if [gdb_test "set language fortran" ""] {
+       return 0;
     }
 
-    send "show language\n"
-    expect {
-       -re ".* source language is \"fortran\".*$prompt $" {
-           pass "set language to \"fortran\""
-           return 1
-       }
-       -re ".*$prompt $" {
-           fail "setting language to \"fortran\""
-           return 0
-       }
-       timeout {
-           fail "can't show language (timeout)"
-           return 0
-       }
+    if ![gdb_test "show language" ".* source language is \"fortran\".*"] {
+       return 1;
+    } else {
+       return 0;
     }
 }
 
@@ -92,72 +80,72 @@ proc test_float_literals_accepted {} {
 
     # Test various floating point formats
 
-    gdb_test "p .44 .LT. .45" " = 1"
-    gdb_test "p .44 .GT. .45" " = 0"
-    gdb_test "p 0.44 .LT. 0.45" " = 1"
-    gdb_test "p 0.44 .GT. 0.45" " = 0"
-    gdb_test "p 44. .LT. 45." " = 1"
-    gdb_test "p 44. .GT. 45." " = 0"
-    gdb_test "p 44.0 .LT. 45.0" " = 1"
-    gdb_test "p 44.0 .GT. 45.0" " = 0"
-    gdb_test "p 10D20 .LT. 10D21" " = 1"
-    gdb_test "p 10D20 .GT. 10D21" " = 0"
-    gdb_test "p 10d20 .LT. 10d21" " = 1"
-    gdb_test "p 10d20 .GT. 10d21" " = 0"
-    gdb_test "p 10E20 .LT. 10E21" " = 1"
-    gdb_test "p 10E20 .GT. 10E21" " = 0"
-    gdb_test "p 10e20 .LT. 10e21" " = 1"
-    gdb_test "p 10e20 .GT. 10e21" " = 0"
-    gdb_test "p 10.D20 .LT. 10.D21" " = 1"
-    gdb_test "p 10.D20 .GT. 10.D21" " = 0"
-    gdb_test "p 10.d20 .LT. 10.d21" " = 1"
-    gdb_test "p 10.d20 .GT. 10.d21" " = 0"
-    gdb_test "p 10.E20 .LT. 10.E21" " = 1"
-    gdb_test "p 10.E20 .GT. 10.E21" " = 0"
-    gdb_test "p 10.e20 .LT. 10.e21" " = 1"
-    gdb_test "p 10.e20 .GT. 10.e21" " = 0"
-    gdb_test "p 10.0D20 .LT. 10.0D21" " = 1"
-    gdb_test "p 10.0D20 .GT. 10.0D21" " = 0"
-    gdb_test "p 10.0d20 .LT. 10.0d21" " = 1"
-    gdb_test "p 10.0d20 .GT. 10.0d21" " = 0"
-    gdb_test "p 10.0E20 .LT. 10.0E21" " = 1"
-    gdb_test "p 10.0E20 .GT. 10.0E21" " = 0"
-    gdb_test "p 10.0e20 .LT. 10.0e21" " = 1"
-    gdb_test "p 10.0e20 .GT. 10.0e21" " = 0"
-    gdb_test "p 10.0D+20 .LT. 10.0D+21" " = 1"
-    gdb_test "p 10.0D+20 .GT. 10.0D+21" " = 0"
-    gdb_test "p 10.0d+20 .LT. 10.0d+21" " = 1"
-    gdb_test "p 10.0d+20 .GT. 10.0d+21" " = 0"
-    gdb_test "p 10.0E+20 .LT. 10.0E+21" " = 1"
-    gdb_test "p 10.0E+20 .GT. 10.0E+21" " = 0"
-    gdb_test "p 10.0e+20 .LT. 10.0e+21" " = 1"
-    gdb_test "p 10.0e+20 .GT. 10.0e+21" " = 0"
-    gdb_test "p 10.0D-11 .LT. 10.0D-10" " = 1"
-    gdb_test "p 10.0D-11 .GT. 10.0D-10" " = 0"
-    gdb_test "p 10.0d-11 .LT. 10.0d-10" " = 1"
-    gdb_test "p 10.0d-11 .GT. 10.0d-10" " = 0"
-    gdb_test "p 10.0E-11 .LT. 10.0E-10" " = 1"
-    gdb_test "p 10.0E-11 .GT. 10.0E-10" " = 0"
-    gdb_test "p 10.0e-11 .LT. 10.0e-10" " = 1"
-    gdb_test "p 10.0e-11 .GT. 10.0e-10" " = 0"
+    gdb_test "p .44 .LT. .45" " = .TRUE."
+    gdb_test "p .44 .GT. .45" " = .FALSE."
+    gdb_test "p 0.44 .LT. 0.45" " = .TRUE."
+    gdb_test "p 0.44 .GT. 0.45" " = .FALSE."
+    gdb_test "p 44. .LT. 45." " = .TRUE."
+    gdb_test "p 44. .GT. 45." " = .FALSE."
+    gdb_test "p 44.0 .LT. 45.0" " = .TRUE."
+    gdb_test "p 44.0 .GT. 45.0" " = .FALSE."
+    gdb_test "p 10D20 .LT. 10D21" " = .TRUE."
+    gdb_test "p 10D20 .GT. 10D21" " = .FALSE."
+    gdb_test "p 10d20 .LT. 10d21" " = .TRUE."
+    gdb_test "p 10d20 .GT. 10d21" " = .FALSE."
+    gdb_test "p 10E20 .LT. 10E21" " = .TRUE."
+    gdb_test "p 10E20 .GT. 10E21" " = .FALSE."
+    gdb_test "p 10e20 .LT. 10e21" " = .TRUE."
+    gdb_test "p 10e20 .GT. 10e21" " = .FALSE."
+    gdb_test "p 10.D20 .LT. 10.D21" " = .TRUE."
+    gdb_test "p 10.D20 .GT. 10.D21" " = .FALSE."
+    gdb_test "p 10.d20 .LT. 10.d21" " = .TRUE."
+    gdb_test "p 10.d20 .GT. 10.d21" " = .FALSE."
+    gdb_test "p 10.E20 .LT. 10.E21" " = .TRUE."
+    gdb_test "p 10.E20 .GT. 10.E21" " = .FALSE."
+    gdb_test "p 10.e20 .LT. 10.e21" " = .TRUE."
+    gdb_test "p 10.e20 .GT. 10.e21" " = .FALSE."
+    gdb_test "p 10.0D20 .LT. 10.0D21" " = .TRUE."
+    gdb_test "p 10.0D20 .GT. 10.0D21" " = .FALSE."
+    gdb_test "p 10.0d20 .LT. 10.0d21" " = .TRUE."
+    gdb_test "p 10.0d20 .GT. 10.0d21" " = .FALSE."
+    gdb_test "p 10.0E20 .LT. 10.0E21" " = .TRUE."
+    gdb_test "p 10.0E20 .GT. 10.0E21" " = .FALSE."
+    gdb_test "p 10.0e20 .LT. 10.0e21" " = .TRUE."
+    gdb_test "p 10.0e20 .GT. 10.0e21" " = .FALSE."
+    gdb_test "p 10.0D+20 .LT. 10.0D+21" " = .TRUE."
+    gdb_test "p 10.0D+20 .GT. 10.0D+21" " = .FALSE."
+    gdb_test "p 10.0d+20 .LT. 10.0d+21" " = .TRUE."
+    gdb_test "p 10.0d+20 .GT. 10.0d+21" " = .FALSE."
+    gdb_test "p 10.0E+20 .LT. 10.0E+21" " = .TRUE."
+    gdb_test "p 10.0E+20 .GT. 10.0E+21" " = .FALSE."
+    gdb_test "p 10.0e+20 .LT. 10.0e+21" " = .TRUE."
+    gdb_test "p 10.0e+20 .GT. 10.0e+21" " = .FALSE."
+    gdb_test "p 10.0D-11 .LT. 10.0D-10" " = .TRUE."
+    gdb_test "p 10.0D-11 .GT. 10.0D-10" " = .FALSE."
+    gdb_test "p 10.0d-11 .LT. 10.0d-10" " = .TRUE."
+    gdb_test "p 10.0d-11 .GT. 10.0d-10" " = .FALSE."
+    gdb_test "p 10.0E-11 .LT. 10.0E-10" " = .TRUE."
+    gdb_test "p 10.0E-11 .GT. 10.0E-10" " = .FALSE."
+    gdb_test "p 10.0e-11 .LT. 10.0e-10" " = .TRUE."
+    gdb_test "p 10.0e-11 .GT. 10.0e-10" " = .FALSE."
 }
 
 proc test_convenience_variables {} {
     global prompt
 
-    gdb_test "set \$foo = 101" " = 101\[\r\n\]+" \
+    gdb_test "set \$foo = 101" " = 101\[\r\n\]*" \
        "Set a new convenience variable"
 
     gdb_test "print \$foo"             " = 101" \
        "Print contents of new convenience variable"
 
-    gdb_test "set \$foo = 301" " = 301\[\r\n\]+" \
+    gdb_test "set \$foo = 301" " = 301\[\r\n\]*" \
        "Set convenience variable to a new value"
 
     gdb_test "print \$foo"             " = 301" \
        "Print new contents of convenience variable"
 
-    gdb_test "set \$_ = 11"            " = 11\[\r\n\]+" \
+    gdb_test "set \$_ = 11"            " = 11\[\r\n\]*" \
        "Set convenience variable \$_"
 
     gdb_test "print \$_"               " = 11" \
@@ -269,7 +257,7 @@ gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 
-send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
+gdb_test "set print sevenbit-strings" ""
 
 if [set_lang_fortran] then {
     test_value_history
@@ -281,5 +269,5 @@ if [set_lang_fortran] then {
     test_float_literals_accepted
     test_arithmetic_expressions
 } else {
-    warning "$test_name tests suppressed."
+    warning "$test_name tests suppressed." 0
 }
index ecba2565b0f9eb7f4512db9509e8937975e452d1..0c4751173ee4a21cfd3687f5c19f800788d25486 100644 (file)
@@ -12,7 +12,7 @@
 # 
 # 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.  */
+# 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
@@ -31,213 +31,64 @@ set bug_id 0
 
 proc set_lang_fortran {} {
     global prompt
-
-    send "set language fortran\n"
-    expect {
-       -re ".*$prompt $" {}
-       timeout { fail "set language fortran (timeout)" ; return 0 }
-    }
-
-    send "show language\n"
-    expect {
-       -re ".* source language is \"fortran\".*$prompt $" {
-           pass "set language to \"fortran\""
-           return 1
-       }
-       -re ".*$prompt $" {
-           fail "setting language to \"fortran\""
-           return 0
-       }
-       timeout {
-           fail "can't show language (timeout)"
-           return 0
-       }
+    
+    if [gdb_test "set language fortran" ""] {
+       return 0;
     }
-}
-
-# Testing printing of a specific value.  Increment passcount for
-# success or issue fail message for failure.  In both cases, return
-# a 1 to indicate that more tests can proceed.  However a timeout
-# is a serious error, generates a special fail message, and causes
-# a 0 to be returned to indicate that more tests are likely to fail
-# as well.
-#
-# Args are:
-#
-#      First one is string to send to gdb
-#      Second one is string to match gdb result to
-#      Third one is an optional message to be printed
 
-proc test_print_accept { args } {
-    global prompt
-    global passcount
-    global verbose
-
-    if [llength $args]==3 then {
-       set message [lindex $args 2]
+    if ![gdb_test "show language" ".* source language is \"fortran\".*"] {
+       return 1;
     } else {
-       set message [lindex $args 0]
-    }
-    set sendthis [lindex $args 0]
-    set expectthis [lindex $args 1]
-    if $verbose>2 then {
-       send_user "Sending \"$sendthis\" to gdb\n"
-       send_user "Looking to match \"$expectthis\"\n"
-       send_user "Message is \"$message\"\n"
-    }
-    send "$sendthis\n"
-    expect {
-       -re ".* = $expectthis\r\n$prompt $" {
-           incr passcount
-           return 1
-       }
-       -re ".*$prompt $" {
-           if ![string match "" $message] then {
-               fail "$sendthis ($message)"
-           } else {
-               fail "$sendthis"
-           }
-           return 1
-       }
-       timeout {
-           fail "$sendthis (timeout)"
-           return 0
-       }
-    }
-}
-
-# Testing printing of a specific value.  Increment passcount for
-# success or issue fail message for failure.  In both cases, return
-# a 1 to indicate that more tests can proceed.  However a timeout
-# is a serious error, generates a special fail message, and causes
-# a 0 to be returned to indicate that more tests are likely to fail
-# as well.
-
-proc test_print_reject { args } {
-    global prompt
-    global passcount
-    global verbose
-
-    if [llength $args]==2 then {
-       set expectthis [lindex $args 1]
-    } else {
-       set expectthis "should never match this bogus string"
-    }
-    set sendthis [lindex $args 0]
-    if $verbose>2 then {
-       send_user "Sending \"$sendthis\" to gdb\n"
-       send_user "Looking to match \"$expectthis\"\n"
-    }
-    send "$sendthis\n"
-    expect {
-       -re ".*A .* in expression.*\\.*$prompt $" {
-           incr passcount
-           return 1
-       }
-       -re ".*Junk after end of expression.*$prompt $" {
-           incr passcount
-           return 1
-       }
-       -re ".*No symbol table is loaded.*$prompt $" {
-           incr passcount
-           return 1
-       }
-       -re ".*$expectthis.*$prompt $" {
-           incr passcount
-           return 1
-       }
-       -re ".*$prompt $" {
-           fail "$sendthis not properly rejected"
-           return 1
-       }
-       timeout {
-           fail "$sendthis (timeout)"
-           return 0
-       }
+       return 0;
     }
 }
 
 proc test_integer_literal_types_accepted {} {
     global prompt
-    global passcount
-
-    set passcount 0
 
     # Test various decimal values.
 
-    test_print_accept "pt 123" "integer"
-
-    if $passcount then {
-       pass "$passcount correct integer literal types printed"
-    }
+    gdb_test "pt 123" "type = int" # Should be integer*4 probably
 }
 
 proc test_character_literal_types_accepted {} {
     global prompt
-    global passcount
-
-    set passcount 0
 
     # Test various character values.
 
-    test_print_accept "pt 'a'" "character*1"
-
-    if $passcount then {
-       pass "$passcount correct character literal types printed"
-    }
+    gdb_test "pt 'a'" "type = character\\*1"
 }
 
 proc test_integer_literal_types_rejected {} {
     global prompt
-    global passcount
-
-    set passcount 0
 
     test_print_reject "pt _"
-
-    if $passcount then {
-       pass "$passcount incorrect integer literal types rejected"
-    }
 }
 
 proc test_logical_literal_types_accepted {} {
     global prompt
-    global passcount
-
-    set passcount 0
 
     # Test the only possible values for a logical, TRUE and FALSE.
 
-    test_print_accept "pt .TRUE." "logical*2"
-    test_print_accept "pt .FALSE." "logical*2"
-
-    if $passcount then {
-       pass "$passcount correct logical literal types printed"
-    }
+    gdb_test "pt .TRUE." "type = logical\\*2"
+    gdb_test "pt .FALSE." "type = logical\\*2"
 }
 
 proc test_float_literal_types_accepted {} {
     global prompt
-    global passcount
-
-    set passcount 0
 
     # Test various floating point formats
 
-    test_print_accept "pt .44" "real*8"
-    test_print_accept "pt 44.0" "real*8"
-    test_print_accept "pt 10D20" "1"
-    test_print_accept "pt 10D20" "0"
-    test_print_accept "pt 10d20" "1"
-    test_print_accept "pt 10d20" "0"
-    test_print_accept "pt 10E20" "real*8"
-    test_print_accept "pt 10E20" "real*8"
-    test_print_accept "pt 10e20" "real*8"
-    test_print_accept "pt 10e20" "real*8"
-
-    if $passcount then {
-       pass "$passcount correct float literal comparisons"
-    }
+    gdb_test "pt .44" "type = real\\*8"
+    gdb_test "pt 44.0" "type = real\\*8"
+    gdb_test "pt 10D20" "type = real\\*8"
+    gdb_test "pt 10D20" "type = real\\*8"
+    gdb_test "pt 10d20" "type = real\\*8"
+    gdb_test "pt 10d20" "type = real\\*8"
+    gdb_test "pt 10E20" "type = real\\*8"
+    gdb_test "pt 10E20" "type = real\\*8"
+    gdb_test "pt 10e20" "type = real\\*8"
+    gdb_test "pt 10e20" "type = real\\*8"
 }
 
 # Start with a fresh gdb.
@@ -246,7 +97,7 @@ gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 
-send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
+gdb_test "set print sevenbit-strings" ""
 
 if [set_lang_fortran] then {
     test_integer_literal_types_accepted
@@ -255,5 +106,5 @@ if [set_lang_fortran] then {
     test_character_literal_types_accepted
     test_float_literal_types_accepted
 } else {
-    warning "$test_name tests suppressed."
+    warning "$test_name tests suppressed." 0
 }
index c0efab92e7676254b54de0b24fc407eac6b47cc6..b1c750cbaae9a229d0f0a4df4ee2c1480cf8c629 100644 (file)
@@ -5,6 +5,16 @@ if $tracelevel then {
        strace $tracelevel
 }
 
+# If the test directory was not created by configure then skip
+# this test.
+if ![file isdirectory ${objdir}/${subdir}] then {
+    return 0
+}
+
+if ![file exists ${objdir}/${subdir}/weird.s] {
+    return 0
+}
+
 set prms_id 0
 set bug_id 0
 
@@ -17,7 +27,7 @@ proc do_tests {} {
        # file is then processed with native cc, all stabs directives
        # will be lost.
        # Skip the rest of the stabs tests for this case.
-       send "ptype inttype\n"
+       send_gdb "ptype inttype\n"
        expect {
                -re "^ptype inttype\r*\ntype = inttype.*$prompt $" {
                        pass "stabs found"
@@ -179,8 +189,6 @@ field3 = 0x77888877\}" "print struct constant"
        gdb_test "p common0var2" "= 22"
 
        # this long line must be continous, not with "/" escaping the newline
-       # This apparently worked at one time and is now broken on some configs
-       setup_xfail "sparc-sun-sunos4*" "sparc-sun-solaris*" "hppa*-*-*"
        gdb_test "p v_comb" "{<> = {<> = {x = 42}, \[_a-zA-Z$.\]* = \[0-9xa-fA-F\]*, a = 43}, <> = {\[_a-zA-Z$.\]* = \[0-9xa-fA-F\]*, b = 44}, comb = 45}"
 }
 
@@ -189,7 +197,7 @@ proc print_weird_var { var } {
 
        # Make sure that the variable gets printed out correctly, without
        # any sort of warning message.
-       send "print $var\n"
+       send_gdb "print $var\n"
        expect {
                -re "^print $var\r*\n.\[0-9\]* = 42.*$prompt $" {
                        pass "variable $var printed properly"
@@ -223,7 +231,7 @@ gdb_reinitialize_dir $srcdir/$subdir
 # error messages during symbol reading.
 set testfile weird
 set srcfile ${objdir}/${subdir}/weird.s
-set binfile ${objdir}/${subdir}/weird.o
+set binfile ${objdir}/${subdir}/weirdx.o
 
 global target_os
 set sedscript ${srcdir}/${subdir}/aout.sed
@@ -252,19 +260,21 @@ switch -glob ${target_triplet} {
 }
 
 
-set exec_output [execute_anywhere "sed -f ${sedscript} < ${srcdir}/${subdir}/weird.def > ${srcfile}"]
-if { $exec_output != "" } {
-    perror "Couldn't make test case."
+# Hope this is a Unix box.
+set exec_output [remote_exec build "sed" "-f ${sedscript}" "${srcdir}/${subdir}/weird.def" "${srcfile}"]
+if { [lindex $exec_output 0] != 0 } {
+    perror "Couldn't make test case. $exec_output"
     return -1
 }
 
-if  { [compile "${srcfile} -c -o ${binfile}"] != "" } {
+if  { [gdb_compile "${srcfile}" "${binfile}" object ""] != "" } {
     perror "Couldn't compile ${srcfile}"
     return -1
 }
 
-set exec_output [execute_anywhere "rm -f ${srcfile}"]
-exp_send "file $binfile\n"
+remote_file build delete ${srcfile}
+set binfile [remote_download host ${binfile} object.o]
+send_gdb "file $binfile\n"
 # If $binfile is very long, a \r (but not a \n) will echo in the
 # middle of the echo of the command.  So to match the echo, we
 # would like to match anything not containing \n
@@ -274,22 +284,24 @@ exp_send "file $binfile\n"
 # But spaces following by backspaces aren't really spaces.
 expect {
     -re "^file (\[^ \]| +\008)*\r*\nReading symbols from $binfile\.\.\.done\.\r*\n$prompt $" {
-       pass "weird.o read without error"
+       pass "weirdx.o read without error"
     }
     -re "A program is being debugged already.  Kill it\? \(y or n\)" {
-       send "y\n"
+       send_gdb "y\n"
        exp_continue
     }
     -re ".*$prompt $" {
-       fail "Errors reading weird.o"
+       fail "Errors reading weirdx.o"
     }
     timeout {
        perror "couldn't load $binfile into $GDB (timed out)."
        return -1
     }
-    eof { fail "(eof) cannot read weird.o" }
+    eof { fail "(eof) cannot read weirdx.o" }
 }
 
 do_tests
 
+remote_file host delete ${binfile}
+
 return 0
index 93ef5cdee82686deb349902b0d392fe43ba37187..a2bc4e0b2e8e3cf864193f1cdc8d3537e1a5bd2c 100644 (file)
@@ -26,15 +26,49 @@ if $tracelevel then {
 set prms_id 0
 set bug_id 0
 
+# This only works with native configurations
+if ![isnative] then {
+    return
+}
+
 set testfile "pthreads"
 set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
-set ccout [compile "${srcdir}/${subdir}/${srcfile} -I${objdir}/${subdir} -g -o ${binfile} -lpthread"]
-switch -regexp -- $ccout {
-       ".*no posix threads support.*" { return 0 }
-       {^$} { pass "successfully compiled posix threads test case" }
-       default { perror "Couldn't compile ${srcfile}" ; return -1 }
+
+set built_binfile 0
+if [istarget "*-*-linux"] then {
+    set target_cflags "-D_MIT_POSIX_THREADS"
+} else {
+    set target_cflags ""
+}
+set why_msg "unrecognized error"
+foreach lib {-lpthreads -lpthread} {
+    set options "debug"
+    lappend options "incdir=${objdir}/${subdir}"
+    lappend options "libs=$lib"
+    set ccout [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $options]
+    switch -regexp -- $ccout {
+       ".*no posix threads support.*" {
+           set why_msg "missing threads include file"
+           break
+       }
+       ".*cannot open -lpthread.*" {
+           set why_msg "missing runtime threads library"
+       }
+       ".*Can't find library for -lpthread.*" {
+           set why_msg "missing runtime threads library"
+       }
+       {^$} {
+           pass "successfully compiled posix threads test case"
+           set built_binfile 1
+           break
+       }
     }
+}
+if {$built_binfile == "0"} {
+    unsupported "Couldn't compile ${srcfile}, ${why_msg}"
+    return -1
+}
 
 # Now we can proceed with the real testing.
 
@@ -45,16 +79,16 @@ gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
 
-send "set print sevenbit-strings\n" ; expect -re "$prompt $"
-#send "set print address off\n" ; expect -re "$prompt $"
-send "set width 0\n" ; expect -re "$prompt $"
+gdb_test "set print sevenbit-strings" ""
+#gdb_test "set print address off" ""
+gdb_test "set width 0" ""
 
-# We'll need this when we send a ^C to GDB.  Need to do it before we
+# We'll need this when we send_gdb a ^C to GDB.  Need to do it before we
 # run the program and gdb starts saving and restoring tty states.
 # On Ultrix, we don't need it and it is really slow (because shell_escape
 # doesn't use vfork).
 if ![istarget "*-*-ultrix*"] then {
-    send "shell stty intr '^C'\n" ; expect -re "$prompt $"
+    gdb_test "shell stty intr '^C'" ""
 }
 
 proc all_threads_running {} {
@@ -62,26 +96,26 @@ proc all_threads_running {} {
     global srcfile
 
     # Reset all the counters to zero.
-    send "set var common_routine::hits=0\n" ; expect -re "$prompt $"
-    send "set var common_routine::from_thread1=0\n" ; expect -re "$prompt $"
-    send "set var common_routine::from_thread2=0\n" ; expect -re "$prompt $"
-    send "set var common_routine::from_main=0\n" ; expect -re "$prompt $"
-    send "set var common_routine::full_coverage=0\n" ; expect -re "$prompt $"
+    gdb_test "set var common_routine::hits=0" ""
+    gdb_test "set var common_routine::from_thread1=0" ""
+    gdb_test "set var common_routine::from_thread2=0" ""
+    gdb_test "set var common_routine::from_main=0" ""
+    gdb_test "set var common_routine::full_coverage=0" ""
 
     # Disable all breakpoints.
-    send "disable\n" ; expect -re "$prompt $"
+    gdb_test "disable" ""
 
     # Set up a breakpoint that will cause us to stop when we have
     # been called 15 times.  This should be plenty of time to allow
     # every thread to run at least once, since each thread sleeps for
     # one second between calls to common_routine.
-    send "tbreak common_routine if hits == 15\n"; expect -re "$prompt $"
+    gdb_test "tbreak common_routine if hits == 15" ""
 
     # Start all the threads running again and wait for the inferior
     # to stop.  Since no other breakpoints are set at this time
     # we should stop only when we have been previously called 15 times.
 
-    send "continue\n"
+    send_gdb "continue\n"
     expect {
        -re "Continuing.*common_routine.*at.*$srcfile.*$prompt $" {}
        default {
@@ -97,13 +131,17 @@ proc all_threads_running {} {
     # Check that we stopped when we actually expected to stop, by
     # verifying that there have been 15 previous hits.
 
-    send "p common_routine::hits\n"
+    send_gdb "p common_routine::hits\n"
     expect {
        -re ".*= 15\r\n$prompt $" {}
        default {
            fail "stopped before calling common_routine 15 times"
            return 0
        }
+       -re ".*$prompt $" {
+           fail "stopped before clling common_routine 15 times"
+           return 0
+       }
        timeout {
            fail "stopped before calling common_routine 15 times (timeout)"
            return 0
@@ -113,7 +151,7 @@ proc all_threads_running {} {
     # Also check that all of the threads have run, which will only be true
     # if the full_coverage variable is set.
 
-    send "p common_routine::full_coverage\n"
+    send_gdb "p common_routine::full_coverage\n"
     expect {
        -re ".*= 1\r\n$prompt $" {}
        default {
@@ -135,10 +173,21 @@ proc test_startup {} {
     global main_id thread1_id thread2_id
 
     # We should be able to do an info threads before starting any others.
-    gdb_test "info threads" ".*Thread.*LWP.*main.*"
+    send_gdb "info threads\n"
+    expect {
+       -re ".*Thread.*LWP.*main.*" {
+           pass "info threads"
+       }
+       -re "\r\n$prompt $" {
+           pass "info threads"
+           setup_xfail "*-*-*"
+           fail "gdb does not support pthreads for this machine"
+           return 0
+       }
+    }
 
     # Extract the thread id number of main thread from "info threads" output.
-    send "info threads\n" ; expect -re "(\[0-9\]+)(.*Thread.*main.*)($prompt $)"
+    send_gdb "info threads\n" ; expect -re "(\[0-9\]+)(.*Thread.*main.*)($prompt $)"
     set main_id $expect_out(1,string)
 
     # Check that we can continue and create the first thread.
@@ -146,10 +195,10 @@ proc test_startup {} {
     gdb_test "continue" \
            "Continuing.*Breakpoint .*, thread1 \\(arg=0xfeedface\\).*at.*$srcfile.*" \
            "Continue to creation of first thread"
-    send "disable\n" ; expect -re "$prompt $"
+    gdb_test "disable" ""
 
     # Extract the thread id number of thread 1 from "info threads" output.
-    send "info threads\n" ; expect -re "(\[0-9\]+)(.*Thread.*thread1.*)($prompt $)"
+    send_gdb "info threads\n" ; expect -re "(\[0-9\]+)(.*Thread.*thread1.*)($prompt $)"
     set thread1_id $expect_out(1,string)
 
     # Check that we can continue and create the second thread,
@@ -160,8 +209,10 @@ proc test_startup {} {
            "Continue to creation of second thread"
 
     # Extract the thread id number of thread 2 from "info threads" output.
-    send "info threads\n" ; expect -re "(\[0-9\]+)(.*Thread.*thread2.*)($prompt $)"
+    send_gdb "info threads\n" ; expect -re "(\[0-9\]+)(.*Thread.*thread2.*)($prompt $)"
     set thread2_id $expect_out(1,string)
+
+    return 1
 }
 
 proc check_control_c {} {
@@ -173,9 +224,9 @@ proc check_control_c {} {
     }
 
     # Send a continue followed by ^C to the process to stop it.
-    send "continue\n"
+    send_gdb "continue\n"
     set description "Stopped with a ^C"
-    after 1000 [send "\003"]
+    after 1000 [send_gdb "\003"]
     expect {
        -re "Program received signal SIGINT.*$prompt $" {
            pass $description
@@ -187,7 +238,7 @@ proc check_control_c {} {
            fail "$description (timeout)"
        }
     }
-    send "bt\n" ; expect -re "$prompt $"
+    gdb_test "bt" ""
 
     # Verify that all threads can be run again after a ^C stop.
     if [all_threads_running] then {
@@ -224,10 +275,10 @@ proc check_backtraces {} {
            "Breakpoint .* at 0x.* file .* line .*" \
            "set break at common_routine in thread 2"
 
-    send "continue\n"
+    send_gdb "continue\n"
     expect {
        -re "Breakpoint .* common_routine \\(arg=2\\).*" {
-           send "backtrace\n"
+           send_gdb "backtrace\n"
            expect {
                -re "#0.*common_routine \\(arg=2\\).*#1.*thread2.*" {
                    pass "backtrace from thread 2 bkpt in common_routine"
@@ -246,18 +297,24 @@ proc check_backtraces {} {
        -re "Breakpoint .* common_routine \\(arg=1\\).*" {
            fail "stopped in main thread at breakpoint for thread 1"
        }
+       -re ".*$prompt" {
+           fail "continue to bkpt at common_routine in thread 2"
+       }
        default {
            fail "continue to bkpt at common_routine in thread 2"
        }
        timeout {
            fail "continue to bkpt at common_routine in thread 2 (timeout)"
        }
-       
     }
 }
 
+setup_xfail "alpha-*-osf*"
 if [runto_main] then {
-    test_startup
-    check_control_c
-    check_backtraces
+    clear_xfail "alpha-*-osf*"
+    if [test_startup] then {
+       check_control_c
+       check_backtraces
+    }
 }
+clear_xfail "alpha-*-osf*"
diff --git a/gdb/testsuite/gdb.threads/step.exp b/gdb/testsuite/gdb.threads/step.exp
new file mode 100644 (file)
index 0000000..284c9b5
--- /dev/null
@@ -0,0 +1,200 @@
+# step.exp -- Expect script to test gdb with step.c
+# 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., 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 Hiro Sugawara. (hiro@lynx.com)
+#
+# This test really needs some major surgery to be acceptable, but
+# I'm just about burnt out on lynx work, so I'm not doing it now.
+#
+#      * The test has an indeterminate number of pass/fails
+#      for each run (it runs a small group of tests until
+#      it's timer kicks off).  This is very bad for nightly
+#      automated regression testing.
+#
+#      * It tries to "step" from withint he prologue of a
+#      function.  This isn't support in gdb (it's going
+#      to act like a continue).
+#
+#      * This test rarely check that it stopped in sensible
+#      places.  (see previous bullet -- this test doesn't
+#      catch the fact it continued rather than stepped)
+
+
+if $tracelevel then {
+       strace $tracelevel
+}
+
+set program_exited 0
+
+proc set_bp { where } {
+    global prompt
+
+    send_gdb "break $where\n"
+    # The first regexp is what we get with -g, the second without -g.
+    expect {
+       -re "Break.* at .*: file .*, line \[0-9\]*.*$prompt $" {}
+       -re "Breakpoint \[0-9\]* at 0x\[0-9a-f\]*.*$prompt $" {}
+       -re "$prompt $" { fail "setting breakpoint at $where" ; return 0 }
+       timeout { fail "setting breakpoint at $where (timeout)" ; return 0 }
+    }
+    pass "set_bp"
+}
+
+proc step_it { cmd } {
+    global prompt
+    global program_exited
+
+    send_gdb "$cmd\n"
+    expect {
+       -re "0x\[0-9A-Fa-f\]* *in.*\r\n$prompt $" { pass "step_it"; return 0 }
+       -re "0x\[0-9A-Fa-f\]* *\[0-9\]*.*\r\n$prompt $" { pass "step_it"; return 1 }
+       -re "Program exited .*\n$prompt $" {
+               set program_exited 1
+               return -1
+           }
+       -re "$prompt $" { fail "single-stepping ($cmd).\n" ; return -1 }
+       timeout { fail "single-stepping ($cmd) timout.\n" ; return -1 }
+    }
+}
+
+proc step_inst {} {
+    step_it "stepi"
+}
+
+proc step_source {} {
+    step_it "step"
+}
+
+proc continue_all {} {
+    global prompt
+
+    send_gdb "continue\n"
+    expect {
+       -re "Breakpoint \[0-9\]*, thread\[0-9\]* .*$prompt $" { 
+           pass "continue_all"
+           return 0
+       }
+       -re "Program exited .*\n$prompt $" {
+           set program_exited 1
+           return 1;
+       }
+       -re "$prompt $" { fail "continue" ; return -1 }
+       timeout { fail "continue (timeout)" ; return -1 }
+    }
+}
+
+proc check_threads { num_threads } {
+    global prompt
+
+    set curr_thread 0
+    send_gdb "info threads\n"
+    while { $num_threads > 0 } {
+       expect {
+           -re "\\* *\[0-9\]* process \[0-9\]* thread \[0-9\]* .*\n" {
+               incr curr_thread
+               set num_threads [expr $num_threads - 1]
+           }
+           -re " *\[0-9\]* process \[0-9\]* thread \[0-9\]* .*\n" {
+               set num_threads [expr $num_threads - 1]
+           }
+           -re "$prompt $" {
+               if { $num_threads < 0 } {
+                   fail "check_threads (too many)" ; return -1
+               }
+               break
+           }
+           timeout { fail "check_threads (timeout)" ; return -1 }
+       }
+    }
+
+    if { $curr_thread == 0 } {
+       fail "check_threads (no current thread)\n"
+       return -1
+    }
+    if { $curr_thread > 1 } {
+       fail "check_threads (more than one current thread)\n"
+       return -1
+    }
+    return 0
+}
+
+proc test_cond_wait {} {
+    global program_exited
+
+    set_bp     135
+    runto      179
+    while { 1 } {
+       set stepi_counter 0
+       while { [step_inst] } {
+               if { $program_exited } { break }
+               incr stepi_counter
+               if { $stepi_counter > 30 } {
+                       fail "too many stepi's per line\n"
+                       return -1
+               }
+       }
+       if { $program_exited } { break }
+       step_source
+       if { $program_exited } { break }
+       continue_all
+       if { $program_exited } { break }
+       check_threads 3
+    }
+}
+
+proc do_tests {} {
+    global prms_id
+    global bug_id
+    global subdir
+    global objdir
+    global srcdir
+    global binfile
+    global prompt
+
+    set prms_id 0
+    set bug_id 0
+
+    # Start with a fresh gdb.
+
+    gdb_exit
+    gdb_start
+    gdb_reinitialize_dir $srcdir/$subdir
+    gdb_load $objdir/$subdir/$binfile
+
+    send_gdb "set width 0\n"
+    expect -re "$prompt $"
+
+    test_cond_wait
+}
+
+# Check to see if we have an executable to test.  If not, then either we
+# haven't tried to compile one, or the compilation failed for some reason.
+# In either case, just notify the user and skip the tests in this file.
+
+set binfile "step"
+set srcfile "step.c"
+
+if ![file exists $objdir/$subdir/$binfile] then {
+    if $all_flag then {
+       warning "$binfile does not exist; tests suppressed."
+    }
+} else {
+    do_tests
+}
diff --git a/gdb/testsuite/gdb.threads/step2.exp b/gdb/testsuite/gdb.threads/step2.exp
new file mode 100644 (file)
index 0000000..5827171
--- /dev/null
@@ -0,0 +1,150 @@
+# step2.exp -- Expect script to test gdb step.c
+# 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., 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 Jeff Law. (law@cygnus.com)
+#
+
+
+if $tracelevel then {
+       strace $tracelevel
+}
+
+set program_exited 0
+
+# A simple and crude test to see that we can step two threads independently
+proc test_multi_threaded_stepping {} {
+    global prompt
+    global hex
+    global srcfile
+    global decimal
+
+    # Set breakpoints in code that we know is executed in only
+    # thread of control.
+    gdb_test "break thread1" \
+            "Break.* at $hex: file .*$srcfile, line $decimal\\."
+    gdb_test "break thread2" \
+            "Break.* at $hex: file .*$srcfile, line $decimal\\."
+
+    # the order in which things happen is indeterminate.  So we basically
+    # look for a set of events and note that each one happens and that
+    # all of the required events have happened when we're done.
+    #
+    # Right now we only verify that both threads start and that they
+    # both call pthread_cond_wait twice.
+    set thread1started 0
+    set thread1condwait 0
+    set thread2started 0
+    set thread2condwait 0
+    
+    send_gdb "run\n"
+    expect {
+       -re "The program .* has been started already.*y or n. $" {
+           send_gdb "y\n"
+           exp_continue
+       }
+       -re ".*Breakpoint \[0-9\]+,.*thread1.* at .*$srcfile:.*\[\t \].*$prompt $" {
+           if { $thread1started != 0 } then {
+               fail "thread1 started"
+               return
+           } else {
+               set thread1started 1
+               pass "thread1 started"
+           }
+           send_gdb "step\n"
+           exp_continue
+       }
+       -re ".*Breakpoint \[0-9\]+,.*thread2.* at .*$srcfile:.*\[\t \].*$prompt $" {
+           if { $thread2started != 0 } then {
+               fail "thread2 started"
+               return
+           } else {
+               set thread2started 1
+               pass "thread2 started"
+           }
+           send_gdb "step\n"
+           exp_continue
+       }
+       -re ".*pthread_cond_wait.*cv_a.*$prompt" {
+           if { $thread1started == 0 } then {
+               fail "thread1 condwait"
+               return
+           }
+           if { $thread1condwait < 2 } then {
+               pass "thread1 condwait"
+               incr thread1condwait
+           }
+           if { $thread2condwait == 2 } then {
+               pass "multi threaded stepping"
+               return
+           }
+           send_gdb "step\n"
+           exp_continue
+       }
+                   
+       -re ".*pthread_cond_wait.*cv_b.*$prompt" {
+           if { $thread2started == 0 } then {
+               fail "thread2 condwait"
+               return
+           }
+           if { $thread2condwait < 2 } then {
+               pass "thread2 condwait"
+               incr thread2condwait
+           }
+           if { $thread1condwait == 2 } then {
+               pass "multi threaded stepping"
+               return
+           }
+           send_gdb "step\n"
+           exp_continue
+       }
+                   
+       -re "$prompt" {
+           send_gdb "step\n"
+           exp_continue
+       }
+       default { fail "multi threaded stepping" }
+    }
+}
+
+# Check to see if we have an executable to test.  If not, then either we
+# haven't tried to compile one, or the compilation failed for some reason.
+# In either case, just notify the user and skip the tests in this file.
+
+set binfile "step"
+set srcfile "step.c"
+
+if ![file exists $objdir/$subdir/$binfile] then {
+    if $all_flag then {
+       warning "$binfile does not exist; tests suppressed."
+    }
+    return
+}
+
+set prms_id 0
+set bug_id 0
+
+# Start with a fresh gdb.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load $objdir/$subdir/$binfile
+
+test_multi_threaded_stepping
index ec3b94e962d06c3889d5212f9db12d32370af10b..88894927bac8530fe737e773081c3194fbb68ec4 100644 (file)
 load_lib libgloss.exp
 
 global GDB
-global CC
-global CXX
-global CFLAGS
-global CXXFLAGS
 global CHILL_LIB
 global CHILL_RT0
 
-if ![info exists CC] {
-    set CC [findfile $base_dir/../../gcc/xgcc "$base_dir/../../gcc/xgcc -B$base_dir/../../gcc/" [transform gcc]]
-}
-verbose "using CC = $CC" 2
-if ![info exists CXX] {
-    set CXX [findfile $base_dir/../../gcc/xgcc "$base_dir/../../gcc/xgcc -B$base_dir/../../gcc/" [transform g++]]
-}
-verbose "using CXX = $CXX" 2
 if ![info exists CHILL_LIB] {
     set CHILL_LIB [findfile $base_dir/../../gcc/ch/runtime/libchill.a "$base_dir/../../gcc/ch/runtime/libchill.a" [transform -lchill]]
 }
@@ -50,21 +38,17 @@ if ![info exists CHILL_RT0] {
 }
 verbose "using CHILL_RT0 = $CHILL_RT0" 2
 
-if ![info exists LDFLAGS] {
-    if [is3way] {
-       append LDFLAGS " [libgloss_flags] [newlib_flags]"
+if ![info exists GDB] {
+    if ![is_remote host] {
+       set GDB [findfile $base_dir/../../gdb/gdb "$base_dir/../../gdb/gdb" [transform gdb]]
+    } else {
+       set GDB gdb
     }
-    set LDFLAGS ""
-}
-verbose "using LDFLAGS = $LDFLAGS" 2
-
-if ![info exists GDB] then {
-    set GDB [findfile $base_dir/../../gdb/gdb "$base_dir/../../gdb/gdb" [transform gdb]]
 }
 verbose "using GDB = $GDB" 2
 
 global GDBFLAGS
-if ![info exists GDBFLAGS] then {
+if ![info exists GDBFLAGS] {
     set GDBFLAGS "-nx"
 }
 verbose "using GDBFLAGS = $GDBFLAGS" 2
@@ -73,14 +57,7 @@ verbose "using GDBFLAGS = $GDBFLAGS" 2
 # is not already set.
 global prompt
 if ![info exists prompt] then {
-    set prompt "\\(gdb\\)"
-}
-
-global usestubs
-if [istarget "sparclite-*-*"] then {
-    set usestubs 1
-} else {
-    set usestubs 0
+    set prompt "\[(\]gdb\[)\]"
 }
 
 if ![info exists noargs] then {
@@ -105,15 +82,28 @@ if ![info exists noresults] then {
 proc default_gdb_version {} {
     global GDB
     global GDBFLAGS
-    if {[which $GDB] != 0} then {
-       set tmp [exec echo "q" | $GDB -nw $GDBFLAGS]
-       regexp " \[0-9\]\[^ \t\n\]+" $tmp version
-       clone_output "[which $GDB] version$version -nw $GDBFLAGS \n"
+    global prompt
+    set fileid [open "gdb_cmd" w];
+    puts $fileid "q";
+    close $fileid;
+    set cmdfile [remote_download host "gdb_cmd"];
+    set output [remote_exec host "$GDB -nw --command $cmdfile"]
+    remote_file build delete "gdb_cmd";
+    remote_file host delete "$cmdfile";
+    set tmp [lindex $output 1];
+    set version ""
+    regexp " \[0-9\]\[^ \t\n\r\]+" "$tmp" version
+    if ![is_remote host] {
+       clone_output "[which $GDB] version $version $GDBFLAGS\n"
     } else {
-       warning "$GDB does not exist"
+       clone_output "$GDB on remote host version $version $GDBFLAGS\n"
     }
 }
 
+proc gdb_version { } {
+    return [default_gdb_version];
+}
+
 #
 # gdb_unload -- unload a file if one is loaded
 #
@@ -122,17 +112,17 @@ proc gdb_unload {} {
     global verbose
     global GDB
     global prompt
-    send "file\n"
+    send_gdb "file\n"
     expect {
        -re "No exec file now.*\r" { exp_continue }
        -re "No symbol file now.*\r" { exp_continue }
        -re "A program is being debugged already..*Kill it.*y or n. $"\
-           { send "y\n"
+           { send_gdb "y\n"
                verbose "\t\tKilling previous program being debugged"
            exp_continue
        }
        -re "Discard symbol table from .*y or n. $" {
-           send "y\n"
+           send_gdb "y\n"
            exp_continue
        }
        -re "$prompt $" {}
@@ -151,23 +141,27 @@ proc gdb_unload {} {
 
 proc delete_breakpoints {} {
     global prompt
+    global gdb_spawn_id
 
-    send "delete breakpoints\n"
+    send_gdb "delete breakpoints\n"
     expect {
-       -re "Delete all breakpoints.*y or n. $" {
-           send "y\n"
+       -i $gdb_spawn_id -re ".*Delete all breakpoints.*y or n.*$" {
+           send_gdb "y\n";
            exp_continue
        }
-       -re "y\r\n$prompt $" {}
-       -re ".*$prompt $" { # This happens if there were no breakpoints
+       -i $gdb_spawn_id -re ".*$prompt $" { # This happens if there were no breakpoints
            }
-       timeout { perror "Delete all breakpoints (timeout)" ; return }
+       -i $gdb_spawn_id timeout { perror "Delete all breakpoints in delete_breakpoints (timeout)" ; return }
     }
-    send "info breakpoints\n"
+    send_gdb "info breakpoints\n"
     expect {
-       -re "No breakpoints or watchpoints..*$prompt $" {}
-       -re ".*$prompt $" { perror "breakpoints not deleted" ; return }
-       timeout { perror "info breakpoints (timeout)" ; return }
+       -i $gdb_spawn_id -re "No breakpoints or watchpoints..*$prompt $" {}
+       -i $gdb_spawn_id -re ".*$prompt $" { perror "breakpoints not deleted" ; return }
+       -i $gdb_spawn_id -re "Delete all breakpoints.*or n.*$" {
+           send_gdb "y\n";
+           exp_continue
+       }
+       -i $gdb_spawn_id timeout { perror "info breakpoints (timeout)" ; return }
     }
 }
 
@@ -179,35 +173,60 @@ proc delete_breakpoints {} {
 # Using ``.*$'' could swallow up output that we attempt to match
 # elsewhere.
 #
-proc gdb_run_cmd {} {
-    global usestubs
+proc gdb_run_cmd {args} {
     global prompt
+    global gdb_spawn_id
+
+    set spawn_id $gdb_spawn_id
 
-    if $usestubs!=0 {
-       send "jump *start\n"
+    if [target_info exists use_gdb_stub] {
+       send_gdb  "jump *start\n"
        expect {
            -re "Line.* Jump anyway.*y or n. $" {
-               send "y\n"
+               send_gdb "y\n"
                expect {
                    -re "Continuing.*$prompt $" {}
                    timeout { perror "Jump to start() failed (timeout)"; return }
                }
             }
+           -re "No symbol.*context.*$prompt $" {}
+           -re "The program is not being run.*$prompt $" {
+               gdb_load "";
+           }
            timeout { perror "Jump to start() failed (timeout)"; return }
        }
-       send "continue\n"
+       send_gdb "continue\n"
        return
     }
-    send "run\n"
+    send_gdb "run $args\n"
+# This doesn't work quite right yet.
     expect {
        -re "The program .* has been started already.*y or n. $" {
-           send "y\n"
+           send_gdb "y\n"
            exp_continue
        }
        -re "Starting program: \[^\n\]*" {}
     }
 }
 
+proc gdb_breakpoint { function } {
+    global prompt
+    global decimal
+    global gdb_spawn_id
+
+    set spawn_id $gdb_spawn_id
+
+    send_gdb "break $function\n"
+    # The first two regexps are what we get with -g, the third is without -g.
+    expect {
+       -re "Breakpoint \[0-9\]* at .*: file .*, line $decimal.\r\n$prompt $" {}
+       -re "Breakpoint \[0-9\]*: file .*, line $decimal.\r\n$prompt $" {}
+       -re "Breakpoint \[0-9\]* at .*$prompt $" {}
+       -re "$prompt $" { fail "setting breakpoint at $function" ; return 0 }
+       timeout { fail "setting breakpoint at $function (timeout)" ; return 0 }
+    }
+    return 1;
+}    
 
 # Set breakpoint at function and run gdb until it breaks there.
 # Since this is the only breakpoint that will be set, if it stops
@@ -218,28 +237,14 @@ proc gdb_run_cmd {} {
 proc runto { function } {
     global prompt
     global decimal
+    global gdb_spawn_id
 
-    send "delete\n"
-    expect {
-       -re "delete.*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 }
-    }
+    set spawn_id $gdb_spawn_id
 
-    send "break $function\n"
-    # The first two regexps are what we get with -g, the third is without -g.
-    expect {
-       -re "Breakpoint \[0-9\]* at .*: file .*, line $decimal.\r\n$prompt $" {}
-       -re "Breakpoint \[0-9\]*: file .*, line $decimal.\r\n$prompt $" {}
-       -re "Breakpoint \[0-9\]* at .*$prompt $" {}
-       -re "$prompt $" { fail "setting breakpoint at $function" ; return 0 }
-       timeout { fail "setting breakpoint at $function (timeout)" ; return 0 }
+    delete_breakpoints
+
+    if ![gdb_breakpoint $function] {
+       return 0;
     }
 
     gdb_run_cmd
@@ -254,61 +259,53 @@ proc runto { function } {
            return 1
        }
        -re "$prompt $" { 
-           fail "running to $function"
+           fail "running to $function in runto"
            return 0
        }
        timeout { 
-           fail "running to $function (timeout)"
+           fail "running to $function in runto (timeout)"
            return 0
        }
     }
 }
 
 #
-# runto_main -- ask gdb to run and untill hit break point at main.
-#              if it uses stubs, assuming we hit breakpoint() and just
-#              step out of the function.
+# runto_main -- ask gdb to run until we hit a breakpoint at main.
+#              The case where the target uses stubs has to be handled
+#              specially--if it uses stubs, assuming we hit
+#              breakpoint() and just step out of the function.
 #
 proc runto_main {} {
     global prompt
     global decimal
-    global usestubs
 
-    if $usestubs==0 {
+    if ![target_info exists gdb_stub] {
        return [runto main]
     }                  
 
-    send "delete\n"
-    expect {
-       -re "delete.*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 }
-    }
+    delete_breakpoints
 
-    send "step\n"
+    send_gdb "step\n"
     # if use stubs step out of the breakpoint() function.
     expect {
        -re "main.* at .*$prompt $" {}
+       -re "_start.*$prompt $" {}
        timeout { fail "single step at breakpoint() (timeout)" ; return 0 }
     }
     return 1
 }
 
 #
-# gdb_test -- send a command to gdb and test the result.
+# gdb_test -- send_gdb a command to gdb and test the result.
 #             Takes three parameters.
 #             Parameters:
-#                First one is the command to execute,
+#                First one is the command to execute.  If this is the null string
+#                 then no command is sent.
 #                Second one is the pattern to match for a PASS, and must NOT include
 #                 the \r\n sequence immediately before the gdb prompt.
 #                Third one is an optional message to be printed. If this
-#                  a null string "", then the pass/fail messages are not printed.
+#                  a null string "", then the pass/fail messages use the command
+#                 string as the message.
 #             Returns:
 #                1 if the test failed,
 #                0 if the test passes,
@@ -318,11 +315,10 @@ proc gdb_test { args } {
     global verbose
     global prompt
     global GDB
-    global spawn_id
     global expect_out
     upvar timeout timeout
 
-    if [llength $args]==3 then {
+    if [llength $args]>2 then {
        set message [lindex $args 2]
     } else {
        set message [lindex $args 0]
@@ -330,6 +326,13 @@ proc gdb_test { args } {
     set command [lindex $args 0]
     set pattern [lindex $args 1]
 
+    if [llength $args]==5 {
+       set question_string [lindex $args 3];
+       set response_string [lindex $args 4];
+    } else {
+       set question_string "^FOOBAR$"
+    }
+
     if $verbose>2 then {
        send_user "Sending \"$command\" to gdb\n"
        send_user "Looking to match \"$pattern\"\n"
@@ -338,7 +341,7 @@ proc gdb_test { args } {
 
     set result -1
     if ![string match $command ""] {
-       send "$command\n"
+       send_gdb "$command\n"
     }
 
     expect {
@@ -350,12 +353,16 @@ proc gdb_test { args } {
            gdb_start
            set result -1
        }
-       -re "$pattern\r\n$prompt $" {
+       -re "\[\r\n\]*$pattern\[\r\n\]+$prompt $" {
            if ![string match "" $message] then {
                pass "$message"
            }
            set result 0
        }
+       -re "${question_string}$" {
+           send_gdb "$response_string\n";
+           exp_continue;
+       }
        -re "Undefined command:.*$prompt" {
            perror "Undefined command \"$command\"."
            set result 1
@@ -364,13 +371,13 @@ proc gdb_test { args } {
            perror "\"$command\" is not a unique command name."
            set result 1
        }
-       -re "(.*)(Program exited with code \[0-9\]+)(.*$prompt $)" {
+       -re ".*Program exited with code \[0-9\]+.*$prompt $" {
            if ![string match "" $message] then {
-               set errmsg "$message: $expect_out(2,string)"
+               set errmsg "$message: the program exited"
            } else {
-               set errmsg "$command: $expect_out(2,string)"
+               set errmsg "$command: the program exited"
            }
-           perror "$errmsg"
+           fail "$errmsg"
            return -1
        }
        -re "The program is not being run.*$prompt $" {
@@ -379,7 +386,7 @@ proc gdb_test { args } {
            } else {
                set errmsg "$command: the program is no longer running"
            }
-           perror "$errmsg"
+           fail "$errmsg"
            return -1
        }
        -re ".*$prompt $" {
@@ -389,11 +396,11 @@ proc gdb_test { args } {
            set result 1
        }
        "<return>" {
-           send "\n"
+           send_gdb "\n"
            perror "Window too small."
        }
        -re "\\(y or n\\) " {
-           send "n\n"
+           send_gdb "n\n"
            perror "Got interactive prompt."
        }
        eof {
@@ -433,7 +440,7 @@ proc test_print_reject { args } {
        send_user "Sending \"$sendthis\" to gdb\n"
        send_user "Looking to match \"$expectthis\"\n"
     }
-    send "$sendthis\n"
+    send_gdb "$sendthis\n"
     expect {
        -re ".*A .* in expression.*\\.*$prompt $" {
            pass "reject $sendthis"
@@ -494,7 +501,20 @@ proc gdb_test_exact { args } {
     upvar timeout timeout
 
     set command [lindex $args 0]
-    set pattern [string_to_regexp [lindex $args 1]]
+
+    # This applies a special meaning to a null string pattern.  Without
+    # this, "$pattern\r\n$prompt $" will match anything, including error
+    # messages from commands that should have no output except a new
+    # prompt.  With this, only results of a null string will match a null
+    # string pattern.
+
+    set pattern [lindex $args 1]
+    if [string match $pattern ""] {
+       set pattern [string_to_regexp [lindex $args 0]]
+    } else {
+       set pattern [string_to_regexp [lindex $args 1]]
+    }
+
     # It is most natural to write the pattern argument with only
     # embedded \n's, especially if you are trying to avoid Tcl quoting
     # problems.  But expect really wants to see \r\n in patterns.  So
@@ -507,19 +527,25 @@ proc gdb_test_exact { args } {
     } else {
        set message $command
     }
+
     return [gdb_test $command $pattern $message]
 }
 \f
 proc gdb_reinitialize_dir { subdir } {
     global prompt
+    global gdb_spawn_id
+    set spawn_id $gdb_spawn_id
 
-   send "dir\n"
+    if [is_remote host] {
+       return "";
+    }
+    send_gdb "dir\n"
     expect {
        -re "Reinitialize source path to empty.*y or n. " {
-           send "y\n"
+           send_gdb "y\n"
            expect {
                -re "Source directories searched.*$prompt $" {
-                   send "dir $subdir\n"
+                   send_gdb "dir $subdir\n"
                    expect {
                        -re "Source directories searched.*$prompt $" {
                            verbose "Dir set to $subdir"
@@ -547,6 +573,11 @@ proc default_gdb_exit {} {
     global GDB
     global GDBFLAGS
     global verbose
+    global gdb_spawn_id
+
+    if ![info exists gdb_spawn_id] {
+       return;
+    }
 
     verbose "Quitting $GDB $GDBFLAGS"
 
@@ -554,13 +585,27 @@ proc default_gdb_exit {} {
     set timeout 5
     verbose "Timeout is now $timeout seconds" 2
 
-    # We used to try to send "quit" to GDB, and wait for it to die.
-    # Dealing with all the cases and errors got pretty hairy.  Just close it, 
-    # that is simpler.
-    close
+    if [is_remote host] {
+       send_gdb "quit\n";
+       expect {
+           -i $gdb_spawn_id -re ".*and kill it.*y or n. " {
+               send_gdb "y\n";
+               exp_continue;
+           }
+           -i $gdb_spawn_id timeout { }
+       }
+       remote_close host;
+    } else {
+       # We used to try to send_gdb "quit" to GDB, and wait for it to die.
+       # Dealing with all the cases and errors got pretty hairy.  Just close it, 
+       # that is simpler.
+       close -i $gdb_spawn_id
+
+       # Omitting this probably would cause strange timing-dependent failures.
+       wait -i $gdb_spawn_id
+    }
 
-    # Omitting this probably would cause strange timing-dependent failures.
-    wait
+    unset gdb_spawn_id
 }
 
 #
@@ -573,10 +618,19 @@ proc gdb_file_cmd { arg } {
     global loadfile
     global GDB
     global prompt
-    global spawn_id
     upvar timeout timeout
+    global gdb_spawn_id
+    set spawn_id $gdb_spawn_id
+
+    if [is_remote host] {
+       set arg [remote_download host $arg];
+       if { $arg == "" } {
+           error "download failed"
+           return -1;
+       }
+    }
 
-    send "file $arg\n"
+    send_gdb "file $arg\n"
     expect {
         -re "Reading symbols from.*done.*$prompt $" {
             verbose "\t\tLoaded $arg into the $GDB"
@@ -587,12 +641,12 @@ proc gdb_file_cmd { arg } {
             return -1
         }
         -re "A program is being debugged already.*Kill it.*y or n. $" {
-            send "y\n"
+            send_gdb "y\n"
                 verbose "\t\tKilling previous program being debugged"
             exp_continue
         }
         -re "Load new symbol table from \".*\".*y or n. $" {
-            send "y\n"
+            send_gdb "y\n"
             expect {
                 -re "Reading symbols from.*done.*$prompt $" {
                     verbose "\t\tLoaded $arg with new symbol table into $GDB"
@@ -639,30 +693,40 @@ proc default_gdb_start { } {
     global GDB
     global GDBFLAGS
     global prompt
-    global spawn_id
     global timeout
+    global gdb_spawn_id
+    global spawn_id
     verbose "Spawning $GDB -nw $GDBFLAGS"
 
-    if { [which $GDB] == 0 } then {
-       perror "$GDB does not exist."
-       exit 1
+    if [info exists gdb_spawn_id] {
+       return 0;
     }
-    
+
     set oldtimeout $timeout
     set timeout [expr "$timeout + 180"]
-    verbose "Timeout increased to $timeout seconds" 2
-    eval "spawn $GDB -nw $GDBFLAGS"
+    if [is_remote host] {
+       set shell_id [remote_spawn host "$GDB -nw $GDBFLAGS --command gdbinit"]
+    } else {
+       if { [which $GDB] == 0 } then {
+           perror "$GDB does not exist."
+           exit 1
+       }
+
+       set shell_id [remote_spawn host "$GDB -nw $GDBFLAGS"]
+    }
+    verbose $shell_id
+    set timeout 10
     expect {
-       -re ".*\r\n$prompt $" {
+       -i $shell_id -re ".*\[\r\n\]$prompt $" {
            verbose "GDB initialized."
        }
-       -re "$prompt $" {
+       -i $shell_id -re "$prompt $"    {
            perror "GDB never initialized."
            set timeout $oldtimeout
            verbose "Timeout restored to $timeout seconds" 2
            return -1
        }
-       timeout         {
+       -i $shell_id timeout            {
            perror "(timeout) GDB never initialized after $timeout seconds."
            set timeout $oldtimeout
            verbose "Timeout restored to $timeout seconds" 2
@@ -671,32 +735,35 @@ proc default_gdb_start { } {
     }
     set timeout $oldtimeout
     verbose "Timeout restored to $timeout seconds" 2
+    set gdb_spawn_id $shell_id
+    set spawn_id $gdb_spawn_id
     # force the height to "unlimited", so no pagers get used
-    send "set height 0\n"
+    send_gdb "set height 0\n"
     expect {
-       -re ".*$prompt $" { 
+       -i $shell_id -re ".*$prompt $" { 
            verbose "Setting height to 0." 2
        }
-       timeout {
-           warning "Couldn't set the height to 0."
+       -i $shell_id timeout {
+           warning "Couldn't set the height to 0"
        }
     }
     # force the width to "unlimited", so no wraparound occurs
-    send "set width 0\n"
+    send_gdb "set width 0\n"
     expect {
-       -re ".*$prompt $" {
+       -i $shell_id -re ".*$prompt $" {
            verbose "Setting width to 0." 2
        }
-       timeout {
+       -i $shell_id timeout {
            warning "Couldn't set the width to 0."
        }
     }
+    return 0;
 }
 
 #
 # FIXME: this is a copy of the new library procedure, but it's here too
 # till the new dejagnu gets installed everywhere. I'd hate to break the
-# gdb tests suite.
+# gdb testsuite.
 #
 global argv0
 if ![info exists argv0] then {
@@ -717,7 +784,74 @@ if ![info exists argv0] then {
 # chill target at the moment, don't run the chill tests.
 
 proc skip_chill_tests {} {
-    eval set skip_chill [expr ![isnative] || [istarget "*-*-aix*"] || [istarget "*-*-irix5*"] || [istarget "alpha-*-osf*"] || [istarget "hppa*-*-*"]]
+    if ![info exists do_chill_tests] {
+       return 1;
+    }
+    eval set skip_chill [expr ![isnative] || [istarget "*-*-aix*"] || [istarget "*-*-irix5*"] || [istarget "*-*-irix6*"] || [istarget "alpha-*-osf*"] || [istarget "hppa*-*-*"]]
     verbose "Skip chill tests is $skip_chill"
     return $skip_chill
 }
+
+proc get_compiler_info {binfile} {
+    # Create and source the file that provides information about the compiler
+    # used to compile the test case.
+    global srcdir
+    global subdir
+    # These two come from compiler.c.
+    global signed_keyword_not_used
+    global gcc_compiled
+
+    if { [gdb_compile "${srcdir}/${subdir}/compiler.c" "${binfile}.ci" preprocess {}] != "" } {
+       perror "Couldn't make ${binfile}.ci file"
+       return 1;
+    }
+    source ${binfile}.ci
+    return 0;
+}
+
+proc gdb_compile {source dest type options} {
+    if [target_info exists gdb_stub] {
+       set options2 { "additional_flags=-Dusestubs" }
+       lappend options "libs=[target_info gdb_stub]";
+       set options [concat $options2 $options]
+    }
+    verbose "options are $options"
+    verbose "source is $source $dest $type $options"
+    set result [target_compile $source $dest $type $options];
+    regsub "\[\r\n\]*$" "$result" "" result;
+    regsub "^\[\r\n\]*" "$result" "" result;
+    if { $result != "" } {
+       clone_output "gdb compile failed, $result"
+    }
+    return $result;
+}
+
+proc send_gdb { string } {
+    return [remote_send host "$string"];
+}
+
+proc gdb_start { } {
+    default_gdb_start
+}
+
+proc gdb_exit { } {
+    catch default_gdb_exit
+}
+
+#
+# gdb_load -- load a file into the debugger.
+#             return a -1 if anything goes wrong.
+#
+proc gdb_load { arg } {
+    return [gdb_file_cmd $arg]
+}
+
+proc gdb_continue { function } {
+    global decimal
+
+    return [gdb_test "continue" ".*Breakpoint $decimal, $function .*" "continue to $function"];
+}
+
+proc gdb_finish { } {
+    gdb_exit;
+}
index 68be6169f994115be344bd07c68726151279fe99..8faeff44667cd08814487cc58d7e9d4ccae98a70 100644 (file)
@@ -13,7 +13,7 @@
 # 
 # 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.  */
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #
 # Written by Jeffrey Wheat (cassidy@cygnus.com)
 # Rewritten by Ian Lance Taylor (ian@cygnus.com)
@@ -29,9 +29,15 @@ if ![isnative] {
     return
 }
 
-if { ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-foo.cc tmpdir/cdtest-foo.o]
-     || ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-bar.cc tmpdir/cdtest-bar.o]
-     || ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-main.cc tmpdir/cdtest-main.o] } {
+if { [which $CXX] == 0 } {
+    untested $test1
+    untested $test2
+    return
+}
+
+if { ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir/$subdir/cdtest-foo.cc tmpdir/cdtest-foo.o]
+     || ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir/$subdir/cdtest-bar.cc tmpdir/cdtest-bar.o]
+     || ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir/$subdir/cdtest-main.cc tmpdir/cdtest-main.o] } {
     unresolved $test1
     unresolved $test2
     return
@@ -48,9 +54,9 @@ if ![ld_link $ld tmpdir/cdtest {tmpdir/cdtest-foo.o tmpdir/cdtest-bar.o tmpdir/c
        verbose "$exec_output" 1
        fail $test1
     } else {
-       send_log "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat\n"
-       verbose "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat"
-       catch "exec diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat" exec_output
+       send_log "diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat\n"
+       verbose "diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat"
+       catch "exec diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat" exec_output
        set exec_output [prune_system_crud $host_triplet $exec_output]
 
        if [string match "" $exec_output] then {
@@ -77,9 +83,9 @@ if ![ld_relocate $ld tmpdir/cdtest.o {-Ur tmpdir/cdtest-foo.o tmpdir/cdtest-bar.
            verbose "$exec_output" 1
            fail $test2
        } else {
-           send_log "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat\n"
-           verbose "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat"
-           catch "exec diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat" exec_output
+           send_log "diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat\n"
+           verbose "diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat"
+           catch "exec diff tmpdir/cdtest.out $srcdir/$subdir/cdtest.dat" exec_output
            set exec_output [prune_system_crud $host_triplet $exec_output]
 
            if [string match "" $exec_output] then {
index 97cb72ff59b794640a0a7e423ecca5a502d4794b..9f3866d56456856020f558e7d5ea66ae8b66fa1d 100644 (file)
@@ -38,15 +38,15 @@ if { [which $CC] == 0 } {
 # (by experimentation) to force the linker to relax twice--that is,
 # the first relaxation pass will force another call to be out of
 # range, requiring a second relaxation pass.
-if { ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/relax1.c tmpdir/relax1.o]
-     || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/relax2.c tmpdir/relax2.o]
-     || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/relax3.c tmpdir/relax3.o]
-     || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/relax4.c tmpdir/relax4.o] } {
+if { ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/relax1.c tmpdir/relax1.o]
+     || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/relax2.c tmpdir/relax2.o]
+     || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/relax3.c tmpdir/relax3.o]
+     || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/relax4.c tmpdir/relax4.o] } {
     unresolved $testname
     return
 }
 
-if ![ld_simple_link $ld tmpdir/relax "--relax -T $srcdir$subdir/relax.t tmpdir/relax1.o tmpdir/relax2.o tmpdir/relax3.o tmpdir/relax4.o"] {
+if ![ld_simple_link $ld tmpdir/relax "--relax -T $srcdir/$subdir/relax.t tmpdir/relax1.o tmpdir/relax2.o tmpdir/relax3.o tmpdir/relax4.o"] {
     fail $testname
 } else {
     # Check that the relaxation produced the correct result.  Check
@@ -227,9 +227,9 @@ set testname "run embedded PIC code"
 
 # Compile the program which will run the test.  This code must be
 # compiled for the host, not the target.
-send_log "$CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir$subdir/run.c\n"
-verbose "$CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir$subdir/run.c"
-catch "exec $CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir$subdir/run.c" exec_output
+send_log "$CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir/$subdir/run.c\n"
+verbose "$CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir/$subdir/run.c"
+catch "exec $CC_FOR_HOST $CFLAGS_FOR_HOST -o tmpdir/run $srcdir/$subdir/run.c" exec_output
 if ![string match "" $exec_output] {
     send_log "$exec_output\n"
     verbose "$exec_output"
@@ -238,9 +238,9 @@ if ![string match "" $exec_output] {
 }
 
 # Compile and link the test.
-if { ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/runtesti.s tmpdir/runtesti.o]
-     || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/runtest1.c tmpdir/runtest1.o]
-     || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir$subdir/runtest2.c tmpdir/runtest2.o] } {
+if { ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/runtesti.s tmpdir/runtesti.o]
+     || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/runtest1.c tmpdir/runtest1.o]
+     || ![ld_compile "$CC $CFLAGS -membedded-pic" $srcdir/$subdir/runtest2.c tmpdir/runtest2.o] } {
     unresolved $testname
     return
 }
diff --git a/ld/testsuite/ld-sh/sh.exp b/ld/testsuite/ld-sh/sh.exp
new file mode 100644 (file)
index 0000000..45c8727
--- /dev/null
@@ -0,0 +1,143 @@
+# Expect script for ld-sh tests
+#   Copyright (C) 1995, 1996 Free Software Foundation
+#
+# This file 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.
+#
+# Written by Ian Lance Taylor (ian@cygnus.com)
+#
+
+# Test SH relaxing.  This tests the compiler and assembler as well as
+# the linker.
+
+if ![istarget sh*-*-*] {
+    return
+}
+
+set testsimple "SH simple relaxing"
+
+if ![ld_assemble $as "-relax $srcdir/$subdir/sh1.s" tmpdir/sh1.o] {
+    unresolved $testsimple
+} else { if ![ld_simple_link $ld tmpdir/sh1 "-relax tmpdir/sh1.o"] {
+    fail $testsimple
+} else {
+    if ![ld_nm $nm tmpdir/sh1] {
+       unresolved $testsimple
+    } else {
+       if {![info exists nm_output(bar)] \
+            || ![info exists nm_output(foo)]} {
+           send_log "bad output from nm\n"
+           verbose "bad output from nm"
+           fail $testsimple
+       } else {
+           if {$nm_output(bar) != $nm_output(foo) + 4} {
+               send_log "foo == $nm_output(foo)\n"
+               verbose "foo == $nm_output(foo)"
+               send_log "bar == $nm_output(bar)\n"
+               verbose "bar == $nm_output(bar)"
+               fail $testsimple
+           } else {
+               pass $testsimple
+           }
+       }
+    }
+} }
+
+set testsrec "SH relaxing to S-records"
+
+if ![ld_simple_link $ld tmpdir/sh1.s1 "-relax -oformat srec tmpdir/sh1.o"] {
+    fail $testsrec
+} else {
+    # The file name is embedded in the S-records, so create both
+    # files with the same name.
+    catch "exec rm -f tmpdir/sh1.s2" exec_output
+    send_log "mv tmpdir/sh1.s1 tmpdir/sh1.s2\n"
+    verbose "mv tmpdir/sh1.s1 tmpdir/sh1.s2"
+    catch "exec mv tmpdir/sh1.s1 tmpdir/sh1.s2" exec_output
+    if ![string match "" $exec_output] {
+       send_log "$exec_output\n"
+       verbose "$exec_output"
+       unresolved $testsrec
+    } else {
+       send_log "$objcopy -O srec tmpdir/sh1 tmpdir/sh1.s1"
+       verbose "$objcopy -O srec tmpdir/sh1 tmpdir/sh1.s1"
+       catch "exec $objcopy -O srec tmpdir/sh1 tmpdir/sh1.s1" exec_output
+       if ![string match "" $exec_output] {
+           send_log "$exec_output\n"
+           verbose "$exec_output"
+           unresolved $testsrec
+       } else {
+           send_log "cmp tmpdir/sh1.s1 tmpdir/sh1.s2\n"
+           verbose "cmp tmpdir/sh1.s1 tmpdir/sh1.s2"
+           catch "exec cmp tmpdir/sh1.s1 tmpdir/sh1.s2" exec_output
+           set exec_output [prune_system_crud $host_triplet $exec_output]
+           if ![string match "" $exec_output] {
+               send_log "$exec_output\n"
+               verbose "$exec_output"
+               fail $testsrec
+           } else {
+               pass $testsrec
+           }
+       }
+    }
+}
+
+set testlink "SH relaxing"
+set testjsr "SH confirm relaxing"
+set testrun "SH relaxing execution"
+
+if { [which $CC] == 0 } {
+    untested $testlink
+    untested $testjsr
+    untested $testrun
+    return
+}
+
+if {![ld_assemble $as "-relax $srcdir/$subdir/start.s" tmpdir/start.o] \
+     || ![ld_compile $CC "-O -mrelax $srcdir/$subdir/sh2.c" tmpdir/sh2.o]} {
+    unresolved $testlink
+    unresolved $testjsr
+    unresolved $testrun
+    return
+}
+
+if ![ld_simple_link $ld tmpdir/sh2 "-relax tmpdir/start.o tmpdir/sh2.o"] {
+    fail $testlink
+    unresolved $testjsr
+    unresolved $testrun
+    return
+}
+
+pass $testlink
+
+send_log "$objdump -d tmpdir/sh2\n"
+verbose "$objdump -d tmpdir/sh2"
+catch "exec $objdump -d tmpdir/sh2" exec_output
+if [string match "*jsr*" $exec_output] {
+    fail $testjsr
+} else {
+    pass $testjsr
+}
+
+if { ![info exists SIM] || [which $SIM] == 0 } {
+    untested $testrun
+    return
+}
+
+set status [catch "exec $SIM tmpdir/sh2" exec_output]
+if { $status == 0 } {
+    pass $testrun
+} else {
+    fail $testrun
+}
index 849a6d84afe139550d6dccfb3c187c5a31dfa126..6fd9829e8ad813c12a9123c63505ef7828f58158 100644 (file)
@@ -124,9 +124,9 @@ proc default_ld_compile { cc source object } {
 
     catch "exec rm -f $object" exec_output
 
-    verbose -log "$cc -I$srcdir$subdir -c $CFLAGS $source -o $object"
+    verbose -log "$cc -I$srcdir/$subdir -c $CFLAGS $source -o $object"
 
-    catch "exec $cc -I$srcdir$subdir -c $CFLAGS $source -o $object" exec_output
+    catch "exec $cc -I$srcdir/$subdir -c $CFLAGS $source -o $object" exec_output
     set exec_output [prune_system_crud $host_triplet $exec_output]
     if [string match "" $exec_output] then {
        if {![file exists $object]} then {