From 847e232af6adf4d21eb51ee396f914de1395da7e Mon Sep 17 00:00:00 2001
From: Bob Manson <manson@cygnus>
Date: Sat, 1 Mar 1997 04:50:01 +0000
Subject: 	* config/monitor.exp: Detect the "Couldn't establish
 connection" 	message from GDB.

one of many, presumably.
---
 gdb/testsuite/ChangeLog          | 45 ++++++++++++++++++++++++++++++++++++++--
 gdb/testsuite/config/monitor.exp | 36 ++++++++++++++++----------------
 2 files changed, 61 insertions(+), 20 deletions(-)

(limited to 'gdb')

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 8760331196a..7fb7986553f 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,7 +1,48 @@
+Fri Feb 28 20:47:39 1997  Bob Manson  <manson@charmed.cygnus.com>
+
+	* config/monitor.exp: Detect the "Couldn't establish connection"
+	message from GDB.
+
+Tue Feb 25 14:08:55 1997  Bob Manson  <manson@charmed.cygnus.com>
+
+	* gdb.base/bitfields.exp: Use runto instead of explicit
+	gdb_run_cmd/gdb_expect sequences.
+
+	* gdb.base/break.exp(text_next_with_recursion): Add match for
+	gdb_expect call.
+
+	* config/monitor.exp(gdb_target_monitor): Calling exit loses big.
+	We also need to handle the "A program is being debugged already"
+	prompt from gdb. Use gdb_test to set the baud rate.
+
+	* lib/gdb.exp(gdb_init): Increase the default expect buffer size
+	to 20000. Really. I mean it.
+
 Mon Feb 24 13:23:26 1997  Bob Manson  <manson@charmed.cygnus.com>
 
-	* lib/gdb.exp(gdb_test): Generate a FAIL message when
-	send_gdb fails.
+	* lib/gdb.exp(gdb_test): Generate a FAIL message when send_gdb
+ 	fails. If suppress_flag is set, skip perror message about not
+ 	being able to send to GDB.
+	(send_gdb): If suppress_flag is set, don't try to send commands to
+ 	GDB.
+	(gdb_expect): If suppress_flag is set, always fail immediately.
+	(gdb_suppress_tests, gdb_stop_suppressing_tests): New functions.
+	(gdb_init): Call gdb_stop_suppressing_tests.
+	(default_gdb_exit): Ditto.
+	(default_gdb_start): Ditto.
+
+	* gdb.base/bitfields.exp: Call gdb_suppress_tests and
+ 	gdb_stop_suppressing_tests as appropriate.
+	* gdb.base/break.exp: Ditto.
+ 	* gdb.base/callfuncs.exp: Ditto.
+	* gdb.base/commands.exp: Ditto.
+	* gdb.base/exprs.exp: Ditto.
+ 	* gdb.base/funcargs.exp: Ditto.
+	* gdb.base/list.exp: Ditto.
+	* gdb.base/recurse.exp: Ditto.
+ 	* gdb.base/scope.exp:  Ditto.
+	* gdb.base/structs.exp: Ditto.
+	* gdb.c++/inherit.exp: Ditto.
 
 Sun Feb 23 19:56:02 1997  Bob Manson  <manson@charmed.cygnus.com>
 
diff --git a/gdb/testsuite/config/monitor.exp b/gdb/testsuite/config/monitor.exp
index facb5bea1b8..a2863b2b1a2 100644
--- a/gdb/testsuite/config/monitor.exp
+++ b/gdb/testsuite/config/monitor.exp
@@ -36,7 +36,7 @@ proc gdb_target_monitor { } {
 	return -1;
     }
     if [target_info exists baud] {
-	send_gdb "set remotebaud [target_info baud]\n"
+	gdb_test "set remotebaud [target_info baud]" "" ""
     }
     if [target_info exists netport] {
 	set serialport "[target_info netport]"
@@ -47,25 +47,33 @@ proc gdb_target_monitor { } {
     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.*" {
+	    gdb_expect {
+		-re "A program is being debugged already.*ill it.*y or n. $" {
+		    send_gdb "y\n";
+		    exp_continue;
+		}
+		-re ".*Couldn't establish connection to remote.*$gdb_prompt" {
+		    verbose "Connection failed"
+		}
+		-re "Remote MIPS debugging.*$gdb_prompt" {
 		    verbose "Set target to $targetname"
 		    return
 		}
-		-re "Remote debugging using $serialport.*" {
+		-re "Remote debugging using $serialport.*$gdb_prompt" {
 		    verbose "Set target to $targetname"
 		    return
 		}
-		-re "Remote target $targetname connected to.*"	{
+		-re "Remote target $targetname connected to.*$gdb_prompt" {
 		    verbose "Set target to $targetname"
 		    return
 		}
-		-re "Connection refused" {
+		-re "Connection refused.*$gdb_prompt" {
 		    verbose "Connection refused by remote target.  Pausing, and trying again."
 		    sleep 30
 		    continue
 		}
-		timeout { 
+		timeout {
+		    send_gdb "";
 		    break
 		}
 	    }
@@ -76,8 +84,7 @@ proc gdb_target_monitor { } {
     }
 
     perror "Couldn't set target for $targetname, port is $serialport."
-    cleanup
-    exit $exit_status
+    return -1;
 }
 
 #
@@ -107,18 +114,11 @@ proc gdb_load { arg } {
     send_gdb "load $arg\n"
     set timeout 1000
     verbose "Timeout is now $timeout seconds" 2
-    expect {
+    gdb_expect {
 	-re ".*$gdb_prompt $" {
-	    if { $verbose > 1 } {
-		send_user "Loaded $arg into $GDB\n"
-	    }
+	    verbose "Loaded $arg into $GDB\n"
 	    return 1
 	}
-	-re "$gdb_prompt $"     {
-	    if { $verbose > 1 } {
-		perror "GDB couldn't load."
-	    }
-	}
 	timeout {
 	    if { $verbose > 1 } {
 		perror "Timed out trying to load $arg."
-- 
cgit v1.2.1