This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFA (testsuite, mi testsuite): Support testing gdbserver


If this patch looks familiar, it's not because you're imagining things. 
I've posted it I believe four times now, and filed a PR about it (it's
gdb/440), and never gotten a single comment.  I'd appreciate it if one of
our busy maintainers could look over it, as I'm tired of carrying it around
locally.  Is either our primary testsuite maintainer or his stand-in still
here?  The last thing I saw from Fernando was his statement on May 1st that
he'd be gone until the 21st, and the last thing I saw from Michael Chastain
was on June 1st...

The changes in this patch:
  - Run gdbserver, a target binary, on the target instead of the host
  - Load mi-support.exp from lib/gdb.exp instead of from the MI tests,
   so that config/* have a chance to override it.
  - Add support for MI in config/gdbserver.exp and config/monitor.exp,
   which required some substantial changes in mi-support.exp.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

2002-07-09  Daniel Jacobowitz  <drow@mvista.com>

        * config/gdbserver.exp: Clear $use_default_mi_gdb_load.
        (gdbserver_gdb_load): Renamed from gdb_load.  Add MI support.
        Do not rerun gdb_file_cmd if $arg is "".  Download binary to
	target.  Run gdbserver on the target.  Close old gdbserver
	connections properly.
        (gdb_load): New function.
        (mi_gdb_load): New function.
	(gdb_start): New function.
        * config/monitor.exp (mi_gdb_target_cmd): New function.
        * lib/gdb.exp: Always load mi-support.exp.
	(default_gdb_exit): Send GDB a quit message before closing it.
        * lib/mi-support.exp (mi_gdb_file_cmd): New function, broken
        out from mi_gdb_load.
        (mi_gdb_load): Call mi_gdb_file_cmd.
        (mi_run_cmd): Expect an MI style result from 000-exec-continue.

        * mi-basics.exp: Remove load of mi-support.exp.
        * mi-break.exp: Likewise.
        * mi-console.exp: Likewise.
        * mi-disassemble.exp: Likewise.
        * mi-eval.exp: Likewise.
        * mi-hack-cli.exp: Likewise.
        * mi-read-memory.exp: Likewise.
        * mi-regs.exp: Likewise.
        * mi-return.exp: Likewise.
        * mi-simplerun.exp: Likewise.
        * mi-stack.exp: Likewise.
        * mi-stepi.exp: Likewise.
        * mi-until.exp: Likewise.
        * mi-var-block.exp: Likewise.
        * mi-var-child.exp: Likewise.
        * mi-var-cmd.exp: Likewise.
        * mi-var-display.exp: Likewise.
        * mi-watch.exp: Likewise.
        * mi0-basics.exp: Likewise.
        * mi0-break.exp: Likewise.
        * mi0-console.exp: Likewise.
        * mi0-disassemble.exp: Likewise.
        * mi0-eval.exp: Likewise.
        * mi0-hack-cli.exp: Likewise.
        * mi0-read-memory.exp: Likewise.
        * mi0-regs.exp: Likewise.
        * mi0-return.exp: Likewise.
        * mi0-simplerun.exp: Likewise.
        * mi0-stack.exp: Likewise.
        * mi0-stepi.exp: Likewise.
        * mi0-until.exp: Likewise.
        * mi0-var-block.exp: Likewise.
        * mi0-var-child.exp: Likewise.
        * mi0-var-cmd.exp: Likewise.
        * mi0-var-display.exp: Likewise.
        * mi0-watch.exp: Likewise.

Index: config/gdbserver.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/config/gdbserver.exp,v
retrieving revision 1.4
diff -u -p -r1.4 gdbserver.exp
--- config/gdbserver.exp	10 May 2001 19:33:13 -0000	1.4
+++ config/gdbserver.exp	9 Jul 2002 15:15:40 -0000
@@ -89,11 +89,12 @@ global server_exec;
 global portnum;
 set portnum "2345";
 
-proc gdb_load { args } {
+proc gdbserver_gdb_load { mi arg } {
     global server_exec;
     global portnum;
     global verbose;
     global gdb_prompt;
+    global mi_gdb_prompt;
 
     # Port id -- either specified in baseboard file, or managed here.
     if [target_info exists gdb,socketport] {
@@ -133,80 +134,145 @@ proc gdb_load { args } {
     # Export the host:port pair.
     set gdbport $debughost$portnum;
 
-    if { $args == "" || $args == "{}" } {
-	if [info exists server_exec] {
-	    set args $server_exec;
-	} else {
+
+    # remember new exec file 
+    if { $arg == "" } {
+	if { ! [info exists server_exec] } {
 	    send_gdb "info files\n";
-	    gdb_expect 30 {
-		-re "Symbols from \"(\[^\"\]+)\"" {
-		    set args $expect_out(1,string);
-		    exp_continue;
-		}
-		-re "Local exec file:\[\r\n\]+\[ \t\]*`(\[^'\]+)'," {
-		    set args $expect_out(1,string);
-		    exp_continue;
+	    if { $mi == 0 } {
+		gdb_expect 30 {
+		    -re "Symbols from \"(\[^\"\]+)\"" {
+			set server_exec $expect_out(1,string);
+			exp_continue;
+		    }
+		    -re "Local exec file:\[\r\n\]+\[ \t\]*`(\[^'\]+)'," {
+			set server_exec $expect_out(1,string);
+			exp_continue;
+		    }
+		    -re "$gdb_prompt $" { }
+		}
+	    } else {
+		gdb_expect 30 {
+		    -re "~\"Symbols from \\\\\"(\[^\"\]+)\\\\\"\." {
+			set server_exec $expect_out(1,string);
+			exp_continue;
+		    }
+		    -re "~\"Local exec file:\\\\n\"\[\r\n\]+~\"\\\\t`(\[^'\]+)'," {
+			set server_exec $expect_out(1,string);
+			exp_continue;
+		    }
+		    -re "$mi_gdb_prompt$" { }
 		}
-		-re "$gdb_prompt $" { }
 	    }
+	    if { ! [info exists server_exec] } {
+		# None?
+		set server_exec ""
+	    }
+	}
+    } else {
+	if [is_remote target] {
+		set server_exec [remote_download target $arg]
+	} else {
+		set server_exec $arg
 	}
     }
 
-    # remember new exec file 
-    set server_exec $args;
-
     # Fire off the debug agent
     if [target_info exists gdb_server_args] {
         # This flavour of gdbserver takes as arguments those specified
         # in the board configuration file
         set custom_args [target_info gdb_server_args];
-        remote_spawn host \
+        set server_spawn_id [remote_spawn target \
                "$gdbserver $custom_args >& /dev/null < /dev/null &" \
-               writeonly
+               writeonly]
     } else {
         # This flavour of gdbserver takes as arguments the port information
         # and the name of the executable file to be debugged.
-        remote_spawn host \
-	    "$gdbserver $sockethost$portnum $args >& /dev/null < /dev/null &" \
-	    writeonly 
+	set server_spawn_id [remote_spawn target \
+	    "$gdbserver $sockethost$portnum $server_exec >& /dev/null < /dev/null &" \
+               writeonly]
     } 
+
+    wait -i $server_spawn_id
+    close -i $server_spawn_id
+
     # Give it a little time to establish
-    sleep 2
+    sleep 1
 
     # tell gdb what file we are debugging
-    if [gdb_file_cmd $args] {
-	return -1;
+    if { $arg != "" } {
+	if { $mi == 0 } {
+	    if [gdb_file_cmd $arg] {
+		return -1;
+	    }
+	} else {
+	    if [mi_gdb_file_cmd $arg] {
+		return -1;
+	    }
+	}
     }
 
     # attach to the "serial port"
-    gdb_target_cmd $protocol $gdbport;
+    if { $mi == 0 } {
+	gdb_target_cmd $protocol $gdbport
+    } else {
+	mi_gdb_target_cmd $protocol $gdbport
+    }
 
     # do the real load if needed
     if [target_info exists gdb_server_do_load] {
         send_gdb "load\n"
         set timeout 2400
         verbose "Timeout is now $timeout seconds" 2
-        gdb_expect {
-            -re ".*$gdb_prompt $" {
-                if $verbose>1 then {
-                    send_user "Loaded $arg into $GDB\n"
-                }
-                set timeout 30
-                verbose "Timeout is now $timeout seconds" 2
-                return 1
-            }
-            -re "$gdb_prompt $"     {
-                if $verbose>1 then {
-                    perror "GDB couldn't load."
-                }
-            }
-            timeout {
-                if $verbose>1 then {
-                    perror "Timed out trying to load $arg."
-                }
-            }
-        }
+	if { $mi == 0 } {
+	    gdb_expect {
+		-re ".*$gdb_prompt $" {
+		    if $verbose>1 then {
+			send_user "Loaded $server_exec into $GDB\n"
+		    }
+		    set timeout 30
+		    verbose "Timeout is now $timeout seconds" 2
+		    return 1
+		}
+		timeout {
+		    if $verbose>1 then {
+			perror "Timed out trying to load $server_exec."
+		    }
+		}
+	    }
+	} else {
+	    gdb_expect {
+		-re ".*$mi_gdb_prompt$" {
+		    if $verbose>1 then {
+			send_user "Loaded $server_exec into $GDB\n"
+		    }
+		    set timeout 30
+		    verbose "Timeout is now $timeout seconds" 2
+		    return 1
+		}
+		timeout {
+		    if $verbose>1 then {
+			perror "Timed out trying to load $server_exec."
+		    }
+		}
+	    }
+	}
     }
 
     return 0;
+}
+
+proc gdb_load { arg } {
+    gdbserver_gdb_load 0 $arg
+}
+
+proc mi_gdb_load { arg } {
+    gdbserver_gdb_load 1 $arg
+}
+
+proc gdb_start { } {
+    default_gdb_start
+    if [target_info exists gdb_start_hook] {
+	catch [target_info gdb_start_hook]
+    }
 }
Index: config/monitor.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/config/monitor.exp,v
retrieving revision 1.5
diff -u -p -r1.5 monitor.exp
--- config/monitor.exp	15 Mar 2001 21:46:57 -0000	1.5
+++ config/monitor.exp	9 Jul 2002 15:15:40 -0000
@@ -71,6 +71,55 @@ proc gdb_target_cmd { targetname serialp
 }
 
 
+# Much the same, but for MI.
+proc mi_gdb_target_cmd { targetname serialport } {
+    global mi_gdb_prompt
+
+    for {set i 1} {$i <= 3} {incr i} {
+	send_gdb "target $targetname $serialport\n"
+	gdb_expect 60 {
+	    -re "Couldn't establish connection to remote.*$mi_gdb_prompt" {
+		verbose "Connection failed";
+	    }
+	    -re "Remote MIPS debugging.*$mi_gdb_prompt" {
+		verbose "Set target to $targetname";
+		return 0;
+	    }
+	    -re "Remote debugging using .*$serialport.*$mi_gdb_prompt" {
+		verbose "Set target to $targetname";
+		return 0;
+	    }
+	    -re "Remote target $targetname connected to.*$mi_gdb_prompt" {
+		verbose "Set target to $targetname";
+		return 0;
+	    }
+	    -re "Connected to.*$mi_gdb_prompt" { 
+		verbose "Set target to $targetname";
+		return 0;
+	    }
+	    -re "Ending remote.*$mi_gdb_prompt" { }
+	    -re "Connection refused.*$mi_gdb_prompt" {
+		verbose "Connection refused by remote target.  Pausing, and trying again."
+		sleep 30
+		continue
+	    }
+	    -re "Timeout reading from remote system.*$mi_gdb_prompt" {
+		verbose "Got timeout error from gdb.";
+	    }
+	    -re "\\^done,.*$mi_gdb_prompt$" {
+		verbose "Set target to $targetname"
+		return 0
+	    }
+	    timeout {
+		send_gdb "";
+		break
+	    }
+	}
+    }
+    return 1
+}
+
+
 
 #
 # gdb_target_monitor
Index: gdb.mi/mi-basics.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-basics.exp,v
retrieving revision 1.6
diff -u -p -r1.6 mi-basics.exp
--- gdb.mi/mi-basics.exp	27 Jun 2001 17:27:07 -0000	1.6
+++ gdb.mi/mi-basics.exp	9 Jul 2002 15:15:41 -0000
@@ -29,7 +29,6 @@
 # but the command syntax and correct output response to MI operations.
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: gdb.mi/mi-break.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-break.exp,v
retrieving revision 1.5
diff -u -p -r1.5 mi-break.exp
--- gdb.mi/mi-break.exp	27 Jun 2001 17:27:07 -0000	1.5
+++ gdb.mi/mi-break.exp	9 Jul 2002 15:15:41 -0000
@@ -28,7 +28,6 @@
 # but to verify the correct output response to MI operations.
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: gdb.mi/mi-console.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-console.exp,v
retrieving revision 1.7
diff -u -p -r1.7 mi-console.exp
--- gdb.mi/mi-console.exp	19 Aug 2001 01:23:43 -0000	1.7
+++ gdb.mi/mi-console.exp	9 Jul 2002 15:15:41 -0000
@@ -32,7 +32,6 @@
 # through GDB.  Check that we're either talking to a simulator or a
 # remote target.
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: gdb.mi/mi-disassemble.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-disassemble.exp,v
retrieving revision 1.10
diff -u -p -r1.10 mi-disassemble.exp
--- gdb.mi/mi-disassemble.exp	19 Aug 2001 01:23:43 -0000	1.10
+++ gdb.mi/mi-disassemble.exp	9 Jul 2002 15:15:41 -0000
@@ -24,7 +24,6 @@
 # but to verify the correct output response to MI operations.
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: gdb.mi/mi-eval.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-eval.exp,v
retrieving revision 1.6
diff -u -p -r1.6 mi-eval.exp
--- gdb.mi/mi-eval.exp	19 Aug 2001 01:23:43 -0000	1.6
+++ gdb.mi/mi-eval.exp	9 Jul 2002 15:15:41 -0000
@@ -26,7 +26,6 @@
 # but to verify the correct output response to MI operations.
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: gdb.mi/mi-hack-cli.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-hack-cli.exp,v
retrieving revision 1.5
diff -u -p -r1.5 mi-hack-cli.exp
--- gdb.mi/mi-hack-cli.exp	28 Oct 2001 00:29:50 -0000	1.5
+++ gdb.mi/mi-hack-cli.exp	9 Jul 2002 15:15:41 -0000
@@ -20,7 +20,6 @@
 
 # Some basic checks for the CLI.
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: gdb.mi/mi-read-memory.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-read-memory.exp,v
retrieving revision 1.7
diff -u -p -r1.7 mi-read-memory.exp
--- gdb.mi/mi-read-memory.exp	19 Aug 2001 01:23:43 -0000	1.7
+++ gdb.mi/mi-read-memory.exp	9 Jul 2002 15:15:41 -0000
@@ -29,7 +29,6 @@
 # but the command syntax and correct output response to MI operations.
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: gdb.mi/mi-regs.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-regs.exp,v
retrieving revision 1.10
diff -u -p -r1.10 mi-regs.exp
--- gdb.mi/mi-regs.exp	5 Feb 2002 23:58:45 -0000	1.10
+++ gdb.mi/mi-regs.exp	9 Jul 2002 15:15:41 -0000
@@ -26,7 +26,6 @@
 #
 
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: gdb.mi/mi-return.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-return.exp,v
retrieving revision 1.7
diff -u -p -r1.7 mi-return.exp
--- gdb.mi/mi-return.exp	19 Aug 2001 01:23:43 -0000	1.7
+++ gdb.mi/mi-return.exp	9 Jul 2002 15:15:41 -0000
@@ -26,7 +26,6 @@
 # the correct output response to MI operations.  
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: gdb.mi/mi-simplerun.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-simplerun.exp,v
retrieving revision 1.9
diff -u -p -r1.9 mi-simplerun.exp
--- gdb.mi/mi-simplerun.exp	11 Nov 2001 20:11:03 -0000	1.9
+++ gdb.mi/mi-simplerun.exp	9 Jul 2002 15:15:41 -0000
@@ -28,7 +28,6 @@
 # but to verify the correct output response to MI operations.
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: gdb.mi/mi-stack.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-stack.exp,v
retrieving revision 1.8
diff -u -p -r1.8 mi-stack.exp
--- gdb.mi/mi-stack.exp	19 Aug 2001 01:23:43 -0000	1.8
+++ gdb.mi/mi-stack.exp	9 Jul 2002 15:15:41 -0000
@@ -26,7 +26,6 @@
 # but to verify the correct output response to MI operations.
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: gdb.mi/mi-stepi.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-stepi.exp,v
retrieving revision 1.7
diff -u -p -r1.7 mi-stepi.exp
--- gdb.mi/mi-stepi.exp	19 Aug 2001 01:23:43 -0000	1.7
+++ gdb.mi/mi-stepi.exp	9 Jul 2002 15:15:41 -0000
@@ -26,7 +26,6 @@
 # the correct output response to MI operations.  
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: gdb.mi/mi-until.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-until.exp,v
retrieving revision 1.7
diff -u -p -r1.7 mi-until.exp
--- gdb.mi/mi-until.exp	19 Aug 2001 01:23:43 -0000	1.7
+++ gdb.mi/mi-until.exp	9 Jul 2002 15:15:41 -0000
@@ -26,7 +26,6 @@
 # the correct output response to MI operations.  
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: gdb.mi/mi-var-block.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-var-block.exp,v
retrieving revision 1.6
diff -u -p -r1.6 mi-var-block.exp
--- gdb.mi/mi-var-block.exp	19 Aug 2001 01:23:43 -0000	1.6
+++ gdb.mi/mi-var-block.exp	9 Jul 2002 15:15:41 -0000
@@ -23,7 +23,6 @@
 #
 
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: gdb.mi/mi-var-child.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-var-child.exp,v
retrieving revision 1.9
diff -u -p -r1.9 mi-var-child.exp
--- gdb.mi/mi-var-child.exp	9 May 2002 18:29:33 -0000	1.9
+++ gdb.mi/mi-var-child.exp	9 Jul 2002 15:15:41 -0000
@@ -23,7 +23,6 @@
 #
 
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: gdb.mi/mi-var-cmd.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-var-cmd.exp,v
retrieving revision 1.9
diff -u -p -r1.9 mi-var-cmd.exp
--- gdb.mi/mi-var-cmd.exp	5 Mar 2002 19:48:17 -0000	1.9
+++ gdb.mi/mi-var-cmd.exp	9 Jul 2002 15:15:41 -0000
@@ -23,7 +23,6 @@
 #
 
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: gdb.mi/mi-var-display.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-var-display.exp,v
retrieving revision 1.7
diff -u -p -r1.7 mi-var-display.exp
--- gdb.mi/mi-var-display.exp	19 Dec 2001 22:57:46 -0000	1.7
+++ gdb.mi/mi-var-display.exp	9 Jul 2002 15:15:41 -0000
@@ -23,7 +23,6 @@
 #
 
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: gdb.mi/mi-watch.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-watch.exp,v
retrieving revision 1.8
diff -u -p -r1.8 mi-watch.exp
--- gdb.mi/mi-watch.exp	19 Aug 2001 01:23:43 -0000	1.8
+++ gdb.mi/mi-watch.exp	9 Jul 2002 15:15:41 -0000
@@ -28,7 +28,6 @@
 # but to verify the correct output response to MI operations.
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: gdb.mi/mi0-basics.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi0-basics.exp,v
retrieving revision 1.3
diff -u -p -r1.3 mi0-basics.exp
--- gdb.mi/mi0-basics.exp	23 Jun 2001 21:47:09 -0000	1.3
+++ gdb.mi/mi0-basics.exp	9 Jul 2002 15:15:41 -0000
@@ -29,7 +29,6 @@
 # but the command syntax and correct output response to MI operations.
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: gdb.mi/mi0-break.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi0-break.exp,v
retrieving revision 1.3
diff -u -p -r1.3 mi0-break.exp
--- gdb.mi/mi0-break.exp	23 Jun 2001 21:47:09 -0000	1.3
+++ gdb.mi/mi0-break.exp	9 Jul 2002 15:15:41 -0000
@@ -28,7 +28,6 @@
 # but to verify the correct output response to MI operations.
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: gdb.mi/mi0-console.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi0-console.exp,v
retrieving revision 1.5
diff -u -p -r1.5 mi0-console.exp
--- gdb.mi/mi0-console.exp	19 Aug 2001 01:23:43 -0000	1.5
+++ gdb.mi/mi0-console.exp	9 Jul 2002 15:15:41 -0000
@@ -32,7 +32,6 @@
 # through GDB.  Check that we're either talking to a simulator or a
 # remote target.
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: gdb.mi/mi0-disassemble.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi0-disassemble.exp,v
retrieving revision 1.4
diff -u -p -r1.4 mi0-disassemble.exp
--- gdb.mi/mi0-disassemble.exp	19 Aug 2001 01:23:43 -0000	1.4
+++ gdb.mi/mi0-disassemble.exp	9 Jul 2002 15:15:41 -0000
@@ -24,7 +24,6 @@
 # but to verify the correct output response to MI operations.
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: gdb.mi/mi0-eval.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi0-eval.exp,v
retrieving revision 1.4
diff -u -p -r1.4 mi0-eval.exp
--- gdb.mi/mi0-eval.exp	19 Aug 2001 01:23:43 -0000	1.4
+++ gdb.mi/mi0-eval.exp	9 Jul 2002 15:15:41 -0000
@@ -26,7 +26,6 @@
 # but to verify the correct output response to MI operations.
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: gdb.mi/mi0-hack-cli.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi0-hack-cli.exp,v
retrieving revision 1.4
diff -u -p -r1.4 mi0-hack-cli.exp
--- gdb.mi/mi0-hack-cli.exp	28 Oct 2001 00:29:50 -0000	1.4
+++ gdb.mi/mi0-hack-cli.exp	9 Jul 2002 15:15:41 -0000
@@ -20,7 +20,6 @@
 
 # Some basic checks for the CLI.
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: gdb.mi/mi0-read-memory.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi0-read-memory.exp,v
retrieving revision 1.4
diff -u -p -r1.4 mi0-read-memory.exp
--- gdb.mi/mi0-read-memory.exp	19 Aug 2001 01:23:43 -0000	1.4
+++ gdb.mi/mi0-read-memory.exp	9 Jul 2002 15:15:41 -0000
@@ -29,7 +29,6 @@
 # but the command syntax and correct output response to MI operations.
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: gdb.mi/mi0-regs.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi0-regs.exp,v
retrieving revision 1.5
diff -u -p -r1.5 mi0-regs.exp
--- gdb.mi/mi0-regs.exp	5 Feb 2002 23:58:45 -0000	1.5
+++ gdb.mi/mi0-regs.exp	9 Jul 2002 15:15:41 -0000
@@ -26,7 +26,6 @@
 #
 
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: gdb.mi/mi0-return.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi0-return.exp,v
retrieving revision 1.5
diff -u -p -r1.5 mi0-return.exp
--- gdb.mi/mi0-return.exp	19 Aug 2001 01:23:43 -0000	1.5
+++ gdb.mi/mi0-return.exp	9 Jul 2002 15:15:41 -0000
@@ -26,7 +26,6 @@
 # the correct output response to MI operations.  
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: gdb.mi/mi0-simplerun.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi0-simplerun.exp,v
retrieving revision 1.6
diff -u -p -r1.6 mi0-simplerun.exp
--- gdb.mi/mi0-simplerun.exp	11 Nov 2001 20:11:03 -0000	1.6
+++ gdb.mi/mi0-simplerun.exp	9 Jul 2002 15:15:41 -0000
@@ -28,7 +28,6 @@
 # but to verify the correct output response to MI operations.
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: gdb.mi/mi0-stack.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi0-stack.exp,v
retrieving revision 1.4
diff -u -p -r1.4 mi0-stack.exp
--- gdb.mi/mi0-stack.exp	19 Aug 2001 01:23:43 -0000	1.4
+++ gdb.mi/mi0-stack.exp	9 Jul 2002 15:15:41 -0000
@@ -26,7 +26,6 @@
 # but to verify the correct output response to MI operations.
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: gdb.mi/mi0-stepi.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi0-stepi.exp,v
retrieving revision 1.5
diff -u -p -r1.5 mi0-stepi.exp
--- gdb.mi/mi0-stepi.exp	19 Aug 2001 01:23:43 -0000	1.5
+++ gdb.mi/mi0-stepi.exp	9 Jul 2002 15:15:41 -0000
@@ -26,7 +26,6 @@
 # the correct output response to MI operations.  
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: gdb.mi/mi0-until.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi0-until.exp,v
retrieving revision 1.5
diff -u -p -r1.5 mi0-until.exp
--- gdb.mi/mi0-until.exp	19 Aug 2001 01:23:43 -0000	1.5
+++ gdb.mi/mi0-until.exp	9 Jul 2002 15:15:41 -0000
@@ -26,7 +26,6 @@
 # the correct output response to MI operations.  
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: gdb.mi/mi0-var-block.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi0-var-block.exp,v
retrieving revision 1.4
diff -u -p -r1.4 mi0-var-block.exp
--- gdb.mi/mi0-var-block.exp	19 Aug 2001 01:23:43 -0000	1.4
+++ gdb.mi/mi0-var-block.exp	9 Jul 2002 15:15:41 -0000
@@ -23,7 +23,6 @@
 #
 
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: gdb.mi/mi0-var-child.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi0-var-child.exp,v
retrieving revision 1.6
diff -u -p -r1.6 mi0-var-child.exp
--- gdb.mi/mi0-var-child.exp	9 May 2002 18:29:33 -0000	1.6
+++ gdb.mi/mi0-var-child.exp	9 Jul 2002 15:15:42 -0000
@@ -23,7 +23,6 @@
 #
 
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: gdb.mi/mi0-var-cmd.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi0-var-cmd.exp,v
retrieving revision 1.7
diff -u -p -r1.7 mi0-var-cmd.exp
--- gdb.mi/mi0-var-cmd.exp	5 Mar 2002 19:48:18 -0000	1.7
+++ gdb.mi/mi0-var-cmd.exp	9 Jul 2002 15:15:42 -0000
@@ -23,7 +23,6 @@
 #
 
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: gdb.mi/mi0-var-display.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi0-var-display.exp,v
retrieving revision 1.6
diff -u -p -r1.6 mi0-var-display.exp
--- gdb.mi/mi0-var-display.exp	19 Dec 2001 22:57:46 -0000	1.6
+++ gdb.mi/mi0-var-display.exp	9 Jul 2002 15:15:42 -0000
@@ -23,7 +23,6 @@
 #
 
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: gdb.mi/mi0-watch.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi0-watch.exp,v
retrieving revision 1.4
diff -u -p -r1.4 mi0-watch.exp
--- gdb.mi/mi0-watch.exp	19 Aug 2001 01:23:43 -0000	1.4
+++ gdb.mi/mi0-watch.exp	9 Jul 2002 15:15:42 -0000
@@ -28,7 +28,6 @@
 # but to verify the correct output response to MI operations.
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.20
diff -u -p -r1.20 gdb.exp
--- lib/gdb.exp	11 Jun 2002 20:37:05 -0000	1.20
+++ lib/gdb.exp	9 Jul 2002 15:15:42 -0000
@@ -25,6 +25,7 @@
 # or by passing arguments.
 
 load_lib libgloss.exp
+load_lib mi-support.exp
 
 global GDB
 global CHILL_LIB
@@ -746,7 +747,7 @@ proc default_gdb_exit {} {
 
     verbose "Quitting $GDB $GDBFLAGS"
 
-    if { [is_remote host] && [board_info host exists fileid] } {
+    if { [board_info host exists fileid] } {
 	send_gdb "quit\n";
 	gdb_expect 10 {
 	    -re "y or n" {
Index: lib/mi-support.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/mi-support.exp,v
retrieving revision 1.13
diff -u -p -r1.13 mi-support.exp
--- lib/mi-support.exp	12 Nov 2001 19:44:28 -0000	1.13
+++ lib/mi-support.exp	9 Jul 2002 15:15:42 -0000
@@ -253,10 +253,10 @@ proc mi_gdb_reinitialize_dir { subdir } 
 }
 
 #
-# load a file into the debugger.
+# load a file into the debugger (file command only).
 # return a -1 if anything goes wrong.
 #
-proc mi_gdb_load { arg } {
+proc mi_gdb_file_cmd { arg } {
     global verbose
     global loadpath
     global loadfile
@@ -264,16 +264,21 @@ proc mi_gdb_load { arg } {
     global mi_gdb_prompt
     upvar timeout timeout
 
-    # ``gdb_unload''
+    if [is_remote host] {
+	set arg [remote_download host $arg];
+	if { $arg == "" } {
+	    error "download failed"
+	    return -1;
+	}
+    }
 
-    # ``gdb_file_cmd''
 # FIXME: Several of these patterns are only acceptable for console
 # output.  Queries are an error for mi.
     send_gdb "105-file-exec-and-symbols $arg\n"
     gdb_expect 120 {
         -re "Reading symbols from.*done.*$mi_gdb_prompt$" {
             verbose "\t\tLoaded $arg into the $GDB"
-            # All OK
+            return 0
         }
         -re "has no symbol-table.*$mi_gdb_prompt$" {
             perror "$arg wasn't compiled with \"-g\""
@@ -302,14 +307,15 @@ proc mi_gdb_load { arg } {
             return -1
         }
         -re "105-file-exec-and-symbols .*\r\n105\\\^done\r\n$mi_gdb_prompt$" {
-            # We are just giving the prompt back for now
-	    # All OK
-            }
+            # We (MI) are just giving the prompt back for now, instead of giving
+	    # some acknowledgement.
+	    return 0
+	}
         timeout {
             perror "couldn't load $arg into $GDB (timed out)."
             return -1
         }
-        eof {
+	eof {
             # This is an attempt to detect a core dump, but seems not to
             # work.  Perhaps we need to match .* followed by eof, in which
             # gdb_expect does not seem to have a way to do that.
@@ -317,7 +323,24 @@ proc mi_gdb_load { arg } {
             return -1
         }
     }
-    
+}
+
+#
+# load a file into the debugger.
+# return a -1 if anything goes wrong.
+#
+proc mi_gdb_load { arg } {
+    global verbose
+    global loadpath
+    global loadfile
+    global GDB
+    global mi_gdb_prompt
+    upvar timeout timeout
+
+    # ``gdb_unload''
+
+    mi_gdb_file_cmd $arg
+
     # ``load''
     if { [info procs send_target_sid] != "" } {
 	# For SID, things get complex
@@ -580,7 +603,7 @@ proc mi_run_cmd {args} {
 	    }
 	    send_gdb "000-exec-continue\n";
 	    gdb_expect 60 {
-		-re "Continu\[^\r\n\]*\[\r\n\]" {}
+		-re "000\\^running\[\r\n\]+$mi_gdb_prompt$" {}
 		default {}
 	    }
 	    return;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]