From 0fba9aa255008780fa0638908dd683122186b502 Mon Sep 17 00:00:00 2001
From: Stan Shebs <shebs@codesourcery.com>
Date: Wed, 8 Jun 1994 19:25:43 +0000
Subject: Wed Jun  8 12:12:17 1994  Stan Shebs  (shebs@andros.cygnus.com)

	* config/udi-gdb.exp, config/unix-gdb.exp: Call default_gdb_start.
	* lib/gdb.exp (default_gdb_start): Define.
---
 gdb/testsuite/ChangeLog           | 11 ++++++
 gdb/testsuite/config/udi-gdb.exp  | 45 ++-----------------------
 gdb/testsuite/config/unix-gdb.exp | 70 +++------------------------------------
 gdb/testsuite/lib/gdb.exp         | 69 ++++++++++++++++++++++++++++++++++++--
 4 files changed, 84 insertions(+), 111 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 8230dd5..d5444ae 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+Wed Jun  8 12:12:17 1994  Stan Shebs  (shebs@andros.cygnus.com)
+
+	* config/udi-gdb.exp, config/unix-gdb.exp: Call default_gdb_start.
+	* lib/gdb.exp (default_gdb_start): Define.
+	* gdb.base/bitfields.exp, gdb.base/break.exp, gdb.base/exprs.exp,
+	gdb.base/funcargs.exp, gdb.base/opaque.exp,
+	gdb.base/printcmds.exp, gdb.base/ptype.exp, gdb.base/recurse.exp,
+	gdb.base/scope.exp, gdb.base/setvar.exp, gdb.base/watchpoint.exp,
+	gdb.c++/classes.exp, gdb.c++/misc.exp, gdb.c++/virtfunc.exp:
+	Don't call gdb_target_udi in between tests.
+
 Tue Jun  7 08:30:15 1994  Jim Kingdon  (kingdon@lioth.cygnus.com)
 
 	* gdb.c++/demangle.exp: Use gdb_test_exact, rather than demangle
diff --git a/gdb/testsuite/config/udi-gdb.exp b/gdb/testsuite/config/udi-gdb.exp
index 5d44efc..0914446 100644
--- a/gdb/testsuite/config/udi-gdb.exp
+++ b/gdb/testsuite/config/udi-gdb.exp
@@ -1,5 +1,5 @@
 # Test Framework Driver for GDB driving Universal Debug Interface on 29K
-#   Copyright 1988, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
+#   Copyright 1988, 1990, 1991, 1992, 1993, 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
@@ -24,13 +24,6 @@
 # NOTE: these test assume that there is a udi_soc file in th
 #
 
-# these need to be initialized only if site.exp doesn't set them
-set prompt "\(gdb\)"
-
-if ![info exists prompt] then {
-    set prompt "\(gdb\)"
-}
-
 load_lib gdb.exp
 load_lib udi.exp
 
@@ -101,42 +94,8 @@ proc gdb_load { arg } {
 #              UDICONF enviroment variable is set.
 #
 proc gdb_start { } {
-    global GDB
-    global GDBFLAGS
-    global spawn_id
-    global prompt
-    global verbose
-
-    set GDB [which $GDB]
-    # start GDB
-    if [ llength $GDBFLAGS ] then {
-	spawn $GDB $GDBFLAGS
-    } else {
-	spawn $GDB
-    }
-    expect  {
-	-re "GDB.*$prompt $"   {
-	    verbose "$GDB initialized for cross mode\n"
-	}
-	-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 $" {}
-
+    default_gdb_start
     verbose "Setting up target, Please wait..."
-
     gdb_target_udi
 }
 
diff --git a/gdb/testsuite/config/unix-gdb.exp b/gdb/testsuite/config/unix-gdb.exp
index 1edda20..886a0e6 100644
--- a/gdb/testsuite/config/unix-gdb.exp
+++ b/gdb/testsuite/config/unix-gdb.exp
@@ -1,4 +1,4 @@
-#   Copyright (C) 1988, 1990, 1991, 1992 Free Software Foundation, Inc.
+#   Copyright (C) 1988, 1990, 1991, 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
@@ -60,72 +60,10 @@ proc gdb_load { arg } {
     return [gdb_file_cmd $arg]
 }
 
-#
-# start gdb -- start gdb running
-#
-
-proc gdb_start {} {
-    global verbose
-    global GDB
-    global GDBFLAGS
-    global prompt
-    global spawn_id
-    global timeout
-    verbose "Spawning $GDB $GDBFLAGS"
-    
-    set oldtimeout $timeout
-    set timeout [expr "$timeout + 60"]
-    if [ llength $GDBFLAGS ] then {
-	if {[which $GDB] != 0} then {
-	    spawn $GDB $GDBFLAGS
-	} else {
-	    perror "$GDB does not exist."
-	    exit 1
-	}
-    } else {
-	if {[which $GDB] != 0} then {
-	    spawn $GDB
-	} else {
-	    perror "$GDB does not exist."
-	    exit 1
-	}
-    }
-    expect {
-	-re ".*\r\n$prompt $" {
-	    verbose "GDB initialized for native mode"
-	}
-	-re "$prompt $"	{
-	    perror "GDB never initialized."
-	    return -1
-	}
-	timeout		{
-	    perror "(timeout) GDB never initialized."
-	    return -1
-	}
-    }
-    set timeout $oldtimeout
-    # force the height to "unlimited", so no pagers get used
-    send "set height 0\n"
-    expect {
-	-re ".*$prompt $" { 
-	    verbose "Setting height to 0." 2
-	}
-	timeout {
-	    warning "Couldn't set the height to 0."
-	}
-    }
-    # force the width to "unlimited", so no wraparound occurs
-    send "set width 0\n"
-    expect {
-	-re ".*$prompt $" {
-	    verbose "Seting width to 0." 2
-	}
-	timeout {
-	    warning "Couldn't set the width to 0."
-	}
-    }
+proc gdb_start { } {
+    default_gdb_start
 }
-
+  
 proc gdb_exit { } {
     catch default_gdb_exit
 }
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 35ac4e1..9e42606 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1992 Free Software Foundation, Inc.
+# 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
@@ -25,7 +25,7 @@
 
 global GDB
 if ![info exists GDB] then {
-    set GDB [transform gdb]
+    set GDB [findfile $base_dir/../gdb "gdb" [transform gdb ]]
 }
 
 global GDBFLAGS
@@ -396,6 +396,71 @@ oaded."
 }
 
 #
+# start gdb -- start gdb running, default procedure
+#
+proc default_gdb_start { } {
+    global verbose
+    global GDB
+    global GDBFLAGS
+    global prompt
+    global spawn_id
+    global timeout
+    verbose "Spawning $GDB $GDBFLAGS"
+    
+    set oldtimeout $timeout
+    set timeout [expr "$timeout + 60"]
+    if [ llength $GDBFLAGS ] then {
+	if {[which $GDB] != 0} then {
+	    spawn $GDB $GDBFLAGS
+	} else {
+	    perror "$GDB does not exist."
+	    exit 1
+	}
+    } else {
+	if {[which $GDB] != 0} then {
+	    spawn $GDB
+	} else {
+	    perror "$GDB does not exist."
+	    exit 1
+	}
+    }
+    expect {
+	-re ".*\r\n$prompt $" {
+	    verbose "GDB initialized for native mode"
+	}
+	-re "$prompt $"	{
+	    perror "GDB never initialized."
+	    return -1
+	}
+	timeout		{
+	    perror "(timeout) GDB never initialized."
+	    return -1
+	}
+    }
+    set timeout $oldtimeout
+    # force the height to "unlimited", so no pagers get used
+    send "set height 0\n"
+    expect {
+	-re ".*$prompt $" { 
+	    verbose "Setting height to 0." 2
+	}
+	timeout {
+	    warning "Couldn't set the height to 0."
+	}
+    }
+    # force the width to "unlimited", so no wraparound occurs
+    send "set width 0\n"
+    expect {
+	-re ".*$prompt $" {
+	    verbose "Seting width to 0." 2
+	}
+	timeout {
+	    warning "Couldn't set the width to 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.
-- 
cgit v1.1