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/mi-testsuite] Re: MI and remote debugging


On Wed, Feb 13, 2002 at 01:41:13AM -0500, Daniel Jacobowitz wrote:
> On Wed, Feb 13, 2002 at 01:26:04AM -0500, Andrew Cagney wrote:
> > >Any remote config (like gdbserver, or even monitor, I think...) that
> > >overrides gdb_target_cmd/gdb_file_cmd loses because of the static mi 
> > >version
> > >in mi-support.exp.  This leads to almost a day's worth of timeouts.  I've
> > >tried to cobble together a gdbserver version of mi_gdb_file_cmd and an
> > >mi-aware mi_gdb_target_cmd; I can't do it.
> > >
> > >Andrew, any thoughts?
> > 
> > For targets other than ``target remote'' I don't think we need to be too 
> > concerned.  However, ``target remote'' variants should work.  I know it 
> > works for SID (a remote simulator).
> > 
> > Can you expand a little.
> 
> For target remote it does not necessarily work.  Look at
> config/gdbserver.exp to see what you need to do to spawn a gdbserver on
> load; mi overrides that function entirely.  The comment
> "# ``gdb_file_cmd''" in mi_gdb_file_cmd appears to be as close as we
> come to thinking about this.

Well, since no one else had any helpful comments, I eventually sat down
and fixed this :)  I still get some timeouts running the MI testsuite,
but they appear to be somewhat legitimate.  GDB crashes trying to do
some varobj tests for the remote target (mi-var-cmd.exp, while stepping
at do_locals_tests).

#0  0x080b74b8 in check_typedef (type=0x5d0) at ../../src/gdb/gdbtypes.c:1267
#1  0x08074972 in allocate_value (type=0x5d0) at ../../src/gdb/values.c:83
#2  0x08107c7a in read_var_value (var=0x82dbbd0, frame=0x0) at ../../src/gdb/findvar.c:418
#3  0x0807d7d8 in value_of_variable (var=0x82dbbd0, b=0x0) at ../../src/gdb/valops.c:846
#4  0x08077966 in evaluate_subexp_standard (expect_type=0x0, exp=0x82c5338, pos=0xbfffea68, 
    noside=EVAL_NORMAL) at ../../src/gdb/eval.c:439
#5  0x08076b50 in evaluate_subexp (expect_type=0x0, exp=0x82c5338, pos=0xbfffea68, noside=EVAL_NORMAL)
    at ../../src/gdb/eval.c:69

That aside, which I'll look at next, this patch makes the MI testsuite
run with gdbserver, and is the next step to my being able to test
anything useful remotely.

There's a pending bug.  If you run tests as "runtest --target_board
'linux-gdbserver unix'" then everything will go haywire; it will
continue trying to spawn gdbservers.  I thought I had introduced it and
spent a long time trying fixes, only to find that it is inherent in the
way our config/*.exp files are written.  We exploit TCL's binding
behaviour to override gdb_load.  That's not safe, because gdb.exp is
not reloaded between targets.  The proper way to do this would be to
set a hook in config/*.exp files, but to require it to be set in all
such config files.  That's for later.

The reason I moved the include of mi-support.exp was because I needed
to override a function in it, given the current organization of such
things.

Andrew, Fernando, any thoughts on this patch?  Is it OK?  I reran the
native testsuite with it applied and got no new problems, in MI or
non-MI tests.

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

2002-02-20  Daniel Jacobowitz  <drow@mvista.com>

	* config/gdbserver.exp: Clear $use_default_mi_gdb_load.
	(gdbserver_gdb_load): Renamed from gdb_load.  Add MI support.
	(gdb_load): New function.
	(mi_gdb_load): New function.
	* config/monitor.exp (mi_gdb_target_cmd): New function.
	* lib/gdb.exp: Always load mi-support.exp.
	* 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: testsuite/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
--- testsuite/config/gdbserver.exp	2001/05/10 19:33:13	1.4
+++ testsuite/config/gdbserver.exp	2002/02/21 05:24:55
@@ -89,11 +89,12 @@ global server_exec;
 global portnum;
 set portnum "2345";
 
-proc gdb_load { args } {
+proc gdbserver_gdb_load { mi args } {
     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,21 +134,36 @@ proc gdb_load { args } {
     # Export the host:port pair.
     set gdbport $debughost$portnum;
 
-    if { $args == "" || $args == "{}" } {
+    # FIXME: Why does {{}} appear here?
+    if { $args == "" || $args == "{}" || $args == "{{}}"} {
 	if [info exists server_exec] {
 	    set args $server_exec;
 	} else {
 	    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 args $expect_out(1,string);
+			exp_continue;
+		    }
+		    -re "Local exec file:\[\r\n\]+\[ \t\]*`(\[^'\]+)'," {
+			set args $expect_out(1,string);
+			exp_continue;
+		    }
+		    -re "$gdb_prompt $" { }
+		}
+	    } else {
+		gdb_expect 30 {
+		    -re "~\"Symbols from \\\\\"(\[^\"\]+)\\\\\"\." {
+			set args $expect_out(1,string);
+			exp_continue;
+		    }
+		    -re "~\"Local exec file:\\\\n\"\[\r\n\]+~\"\\\\t`(\[^'\]+)'," {
+			set args $expect_out(1,string);
+			exp_continue;
+		    }
+		    -re "$mi_gdb_prompt$" { }
 		}
-		-re "$gdb_prompt $" { }
 	    }
 	}
     }
@@ -174,39 +190,70 @@ proc gdb_load { args } {
     sleep 2
 
     # tell gdb what file we are debugging
-    if [gdb_file_cmd $args] {
-	return -1;
+    if { $mi == 0 } {
+	if [gdb_file_cmd $args] {
+	    return -1;
+	}
+    } else {
+	if [mi_gdb_file_cmd $args] {
+	    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 $arg 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 $arg."
+		    }
+		}
+	    }
+	} else {
+	    gdb_expect {
+		-re ".*$mi_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
+		}
+		timeout {
+		    if $verbose>1 then {
+			perror "Timed out trying to load $arg."
+		    }
+		}
+	    }
+	}
     }
 
     return 0;
+}
+
+proc gdb_load { args } {
+    gdbserver_gdb_load 0 $args
+}
+
+proc mi_gdb_load { args } {
+    gdbserver_gdb_load 1 $args
 }
Index: testsuite/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
--- testsuite/config/monitor.exp	2001/03/15 21:46:57	1.5
+++ testsuite/config/monitor.exp	2002/02/21 05:24:55
@@ -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: testsuite/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
--- testsuite/gdb.mi/mi-basics.exp	2001/06/27 17:27:07	1.6
+++ testsuite/gdb.mi/mi-basics.exp	2002/02/21 05:24:55
@@ -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: testsuite/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
--- testsuite/gdb.mi/mi-break.exp	2001/06/27 17:27:07	1.5
+++ testsuite/gdb.mi/mi-break.exp	2002/02/21 05:24:55
@@ -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: testsuite/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
--- testsuite/gdb.mi/mi-console.exp	2001/08/19 01:23:43	1.7
+++ testsuite/gdb.mi/mi-console.exp	2002/02/21 05:24:55
@@ -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: testsuite/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
--- testsuite/gdb.mi/mi-disassemble.exp	2001/08/19 01:23:43	1.10
+++ testsuite/gdb.mi/mi-disassemble.exp	2002/02/21 05:24:55
@@ -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: testsuite/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
--- testsuite/gdb.mi/mi-eval.exp	2001/08/19 01:23:43	1.6
+++ testsuite/gdb.mi/mi-eval.exp	2002/02/21 05:24:55
@@ -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: testsuite/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
--- testsuite/gdb.mi/mi-hack-cli.exp	2001/10/28 00:29:50	1.5
+++ testsuite/gdb.mi/mi-hack-cli.exp	2002/02/21 05:24:55
@@ -20,7 +20,6 @@
 
 # Some basic checks for the CLI.
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: testsuite/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
--- testsuite/gdb.mi/mi-read-memory.exp	2001/08/19 01:23:43	1.7
+++ testsuite/gdb.mi/mi-read-memory.exp	2002/02/21 05:24:55
@@ -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: testsuite/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
--- testsuite/gdb.mi/mi-regs.exp	2002/02/05 23:58:45	1.10
+++ testsuite/gdb.mi/mi-regs.exp	2002/02/21 05:24:55
@@ -26,7 +26,6 @@
 #
 
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: testsuite/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
--- testsuite/gdb.mi/mi-return.exp	2001/08/19 01:23:43	1.7
+++ testsuite/gdb.mi/mi-return.exp	2002/02/21 05:24:55
@@ -26,7 +26,6 @@
 # the correct output response to MI operations.  
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: testsuite/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
--- testsuite/gdb.mi/mi-simplerun.exp	2001/11/11 20:11:03	1.9
+++ testsuite/gdb.mi/mi-simplerun.exp	2002/02/21 05:24:55
@@ -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: testsuite/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
--- testsuite/gdb.mi/mi-stack.exp	2001/08/19 01:23:43	1.8
+++ testsuite/gdb.mi/mi-stack.exp	2002/02/21 05:24:55
@@ -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: testsuite/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
--- testsuite/gdb.mi/mi-stepi.exp	2001/08/19 01:23:43	1.7
+++ testsuite/gdb.mi/mi-stepi.exp	2002/02/21 05:24:55
@@ -26,7 +26,6 @@
 # the correct output response to MI operations.  
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: testsuite/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
--- testsuite/gdb.mi/mi-until.exp	2001/08/19 01:23:43	1.7
+++ testsuite/gdb.mi/mi-until.exp	2002/02/21 05:24:55
@@ -26,7 +26,6 @@
 # the correct output response to MI operations.  
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: testsuite/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
--- testsuite/gdb.mi/mi-var-block.exp	2001/08/19 01:23:43	1.6
+++ testsuite/gdb.mi/mi-var-block.exp	2002/02/21 05:24:55
@@ -23,7 +23,6 @@
 #
 
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: testsuite/gdb.mi/mi-var-child.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-var-child.exp,v
retrieving revision 1.8
diff -u -p -r1.8 mi-var-child.exp
--- testsuite/gdb.mi/mi-var-child.exp	2002/02/05 23:56:45	1.8
+++ testsuite/gdb.mi/mi-var-child.exp	2002/02/21 05:24:55
@@ -23,7 +23,6 @@
 #
 
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: testsuite/gdb.mi/mi-var-cmd.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-var-cmd.exp,v
retrieving revision 1.8
diff -u -p -r1.8 mi-var-cmd.exp
--- testsuite/gdb.mi/mi-var-cmd.exp	2001/11/11 20:11:03	1.8
+++ testsuite/gdb.mi/mi-var-cmd.exp	2002/02/21 05:24:55
@@ -23,7 +23,6 @@
 #
 
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: testsuite/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
--- testsuite/gdb.mi/mi-var-display.exp	2001/12/19 22:57:46	1.7
+++ testsuite/gdb.mi/mi-var-display.exp	2002/02/21 05:24:55
@@ -23,7 +23,6 @@
 #
 
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
 gdb_exit
Index: testsuite/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
--- testsuite/gdb.mi/mi-watch.exp	2001/08/19 01:23:43	1.8
+++ testsuite/gdb.mi/mi-watch.exp	2002/02/21 05:24:55
@@ -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: testsuite/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
--- testsuite/gdb.mi/mi0-basics.exp	2001/06/23 21:47:09	1.3
+++ testsuite/gdb.mi/mi0-basics.exp	2002/02/21 05:24:55
@@ -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: testsuite/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
--- testsuite/gdb.mi/mi0-break.exp	2001/06/23 21:47:09	1.3
+++ testsuite/gdb.mi/mi0-break.exp	2002/02/21 05:24:55
@@ -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: testsuite/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
--- testsuite/gdb.mi/mi0-console.exp	2001/08/19 01:23:43	1.5
+++ testsuite/gdb.mi/mi0-console.exp	2002/02/21 05:24:55
@@ -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: testsuite/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
--- testsuite/gdb.mi/mi0-disassemble.exp	2001/08/19 01:23:43	1.4
+++ testsuite/gdb.mi/mi0-disassemble.exp	2002/02/21 05:24:55
@@ -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: testsuite/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
--- testsuite/gdb.mi/mi0-eval.exp	2001/08/19 01:23:43	1.4
+++ testsuite/gdb.mi/mi0-eval.exp	2002/02/21 05:24:55
@@ -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: testsuite/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
--- testsuite/gdb.mi/mi0-hack-cli.exp	2001/10/28 00:29:50	1.4
+++ testsuite/gdb.mi/mi0-hack-cli.exp	2002/02/21 05:24:55
@@ -20,7 +20,6 @@
 
 # Some basic checks for the CLI.
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: testsuite/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
--- testsuite/gdb.mi/mi0-read-memory.exp	2001/08/19 01:23:43	1.4
+++ testsuite/gdb.mi/mi0-read-memory.exp	2002/02/21 05:24:55
@@ -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: testsuite/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
--- testsuite/gdb.mi/mi0-regs.exp	2002/02/05 23:58:45	1.5
+++ testsuite/gdb.mi/mi0-regs.exp	2002/02/21 05:24:55
@@ -26,7 +26,6 @@
 #
 
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: testsuite/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
--- testsuite/gdb.mi/mi0-return.exp	2001/08/19 01:23:43	1.5
+++ testsuite/gdb.mi/mi0-return.exp	2002/02/21 05:24:55
@@ -26,7 +26,6 @@
 # the correct output response to MI operations.  
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: testsuite/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
--- testsuite/gdb.mi/mi0-simplerun.exp	2001/11/11 20:11:03	1.6
+++ testsuite/gdb.mi/mi0-simplerun.exp	2002/02/21 05:24:55
@@ -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: testsuite/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
--- testsuite/gdb.mi/mi0-stack.exp	2001/08/19 01:23:43	1.4
+++ testsuite/gdb.mi/mi0-stack.exp	2002/02/21 05:24:55
@@ -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: testsuite/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
--- testsuite/gdb.mi/mi0-stepi.exp	2001/08/19 01:23:43	1.5
+++ testsuite/gdb.mi/mi0-stepi.exp	2002/02/21 05:24:55
@@ -26,7 +26,6 @@
 # the correct output response to MI operations.  
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: testsuite/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
--- testsuite/gdb.mi/mi0-until.exp	2001/08/19 01:23:43	1.5
+++ testsuite/gdb.mi/mi0-until.exp	2002/02/21 05:24:55
@@ -26,7 +26,6 @@
 # the correct output response to MI operations.  
 #
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: testsuite/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
--- testsuite/gdb.mi/mi0-var-block.exp	2001/08/19 01:23:43	1.4
+++ testsuite/gdb.mi/mi0-var-block.exp	2002/02/21 05:24:55
@@ -23,7 +23,6 @@
 #
 
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: testsuite/gdb.mi/mi0-var-child.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi0-var-child.exp,v
retrieving revision 1.5
diff -u -p -r1.5 mi0-var-child.exp
--- testsuite/gdb.mi/mi0-var-child.exp	2002/02/05 23:56:45	1.5
+++ testsuite/gdb.mi/mi0-var-child.exp	2002/02/21 05:24:55
@@ -23,7 +23,6 @@
 #
 
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: testsuite/gdb.mi/mi0-var-cmd.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi0-var-cmd.exp,v
retrieving revision 1.6
diff -u -p -r1.6 mi0-var-cmd.exp
--- testsuite/gdb.mi/mi0-var-cmd.exp	2001/11/11 20:11:03	1.6
+++ testsuite/gdb.mi/mi0-var-cmd.exp	2002/02/21 05:24:55
@@ -23,7 +23,6 @@
 #
 
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: testsuite/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
--- testsuite/gdb.mi/mi0-var-display.exp	2001/12/19 22:57:46	1.6
+++ testsuite/gdb.mi/mi0-var-display.exp	2002/02/21 05:24:55
@@ -23,7 +23,6 @@
 #
 
 
-load_lib mi-support.exp
 set MIFLAGS "-i=mi0"
 
 gdb_exit
Index: testsuite/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
--- testsuite/gdb.mi/mi0-watch.exp	2001/08/19 01:23:43	1.4
+++ testsuite/gdb.mi/mi0-watch.exp	2002/02/21 05:24:55
@@ -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: testsuite/lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.14
diff -u -p -r1.14 gdb.exp
--- testsuite/lib/gdb.exp	2001/10/02 19:42:10	1.14
+++ testsuite/lib/gdb.exp	2002/02/21 05:24:55
@@ -25,6 +25,7 @@
 # or by passing arguments.
 
 load_lib libgloss.exp
+load_lib mi-support.exp
 
 global GDB
 global CHILL_LIB
Index: testsuite/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
--- testsuite/lib/mi-support.exp	2001/11/12 19:44:28	1.13
+++ testsuite/lib/mi-support.exp	2002/02/21 05:24:55
@@ -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]