2000-11-03 Michael Snyder <msnyder@cleaver.cygnus.com>
authorMichael Snyder <msnyder@vmware.com>
Tue, 14 Nov 2000 22:19:02 +0000 (22:19 +0000)
committerMichael Snyder <msnyder@vmware.com>
Tue, 14 Nov 2000 22:19:02 +0000 (22:19 +0000)
        * config/monitor.exp (gdb_target_cmd): Abstracts some of the
        code from gdb_target_monitor, so it can be used independantly
        for gdbserver.  Also comment out an unnecessary PUTS.

gdb/testsuite/ChangeLog
gdb/testsuite/config/monitor.exp

index 45efe3738f5a0317b1b8c1b6bcfe334f01a8a023..7dd18b02f7eda6f200943e0f71392381f83ce07c 100644 (file)
@@ -1,3 +1,9 @@
+2000-11-03  Michael Snyder  <msnyder@cleaver.cygnus.com>
+
+       * config/monitor.exp (gdb_target_cmd): Abstracts some of the
+       code from gdb_target_monitor, so it can be used independantly
+       for gdbserver.  Also comment out an unnecessary PUTS.
+       
 2000-11-03  Michael Snyder  <msnyder@cleaver.cygnus.com>
 
        * gdb.base/a2-run.exp: Use gdb_skip_stdio_test.
index b4824807ef08d4a8da411bb2db9f7ecf4316ee3f..0b94ad326b74e088a5249fc34d77b74a8ee36c0b 100644 (file)
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
 
 load_lib gdb.exp
-puts "***** DID USE MONITOR ******"
+# puts "***** DID USE MONITOR ******"
+
+#
+# gdb_target_cmd
+# Send gdb the "target" command
+#
+proc gdb_target_cmd { targetname serialport } {
+    global gdb_prompt
+
+    for {set i 1} {$i <= 3} {incr i} {
+       send_gdb "target $targetname $serialport\n"
+       gdb_expect 60 {
+           -re "A program is being debugged already.*ill it.*y or n. $" {
+               send_gdb "y\n";
+               exp_continue;
+           }
+           -re "Couldn't establish connection to remote.*$gdb_prompt" {
+               verbose "Connection failed";
+           }
+           -re "Remote MIPS debugging.*$gdb_prompt" {
+               verbose "Set target to $targetname";
+               return 0;
+           }
+           -re "Remote debugging using .*$serialport.*$gdb_prompt" {
+               verbose "Set target to $targetname";
+               return 0;
+           }
+           -re "Remote target $targetname connected to.*$gdb_prompt" {
+               verbose "Set target to $targetname";
+               return 0;
+           }
+           -re "Connected to.*$gdb_prompt" { 
+               verbose "Set target to $targetname";
+               return 0;
+           }
+           -re "Ending remote.*$gdb_prompt" { }
+           -re "Connection refused.*$gdb_prompt" {
+               verbose "Connection refused by remote target.  Pausing, and trying again."
+               sleep 30
+               continue
+           }
+           -re "Timeout reading from remote system.*$gdb_prompt" {
+               verbose "Got timeout error from gdb.";
+           }
+           timeout {
+               send_gdb "\ 3";
+               break
+           }
+       }
+    }
+}
+
+
+
 #
 # gdb_target_monitor
 # Set gdb to target the monitor
@@ -55,47 +108,7 @@ proc gdb_target_monitor { exec_file } {
     for {set j 1} {$j <= 2} {incr j} {
        if [gdb_file_cmd $exec_file] { return -1; }
 
-       for {set i 1} {$i <= 3} {incr i} {
-           send_gdb "target $targetname $serialport\n"
-           gdb_expect 60 {
-               -re "A program is being debugged already.*ill it.*y or n. $" {
-                   send_gdb "y\n";
-                   exp_continue;
-               }
-               -re "Couldn't establish connection to remote.*$gdb_prompt" {
-                   verbose "Connection failed";
-               }
-               -re "Remote MIPS debugging.*$gdb_prompt" {
-                   verbose "Set target to $targetname";
-                   return 0;
-               }
-               -re "Remote debugging using .*$serialport.*$gdb_prompt" {
-                   verbose "Set target to $targetname";
-                   return 0;
-               }
-               -re "Remote target $targetname connected to.*$gdb_prompt" {
-                   verbose "Set target to $targetname";
-                   return 0;
-               }
-               -re "Connected to.*$gdb_prompt" { 
-                   verbose "Set target to $targetname";
-                   return 0;
-               }
-               -re "Ending remote.*$gdb_prompt" { }
-               -re "Connection refused.*$gdb_prompt" {
-                   verbose "Connection refused by remote target.  Pausing, and trying again."
-                   sleep 30
-                   continue
-               }
-               -re "Timeout reading from remote system.*$gdb_prompt" {
-                   verbose "Got timeout error from gdb.";
-               }
-               timeout {
-                   send_gdb "\ 3";
-                   break
-               }
-           }
-       }
+       gdb_target_cmd $targetname $serialport;
 
        gdb_target_exec;