This is the mail archive of the gdb-patches@sourceware.org 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]

Re: MI testsuite to use PTY for inferior


On Sat, Jul 30, 2005 at 09:21:11PM -0400, Daniel Jacobowitz wrote:
> On Sat, Jul 30, 2005 at 07:03:09PM -0400, Bob Rossi wrote:
> > However, since that's pretty ugly, I'll take your suggestion and always
> > create and assign inferior_pty a value. Then I'll check it for the value
> > of "true" before executing any code.
> 
> I recommend doing something different.  Make the argument a flag, i.e.
> "mi_gdb_start use-tty".  Or "no-tty" depending on what you want the
> default to be.

Here is an updated patch with all the suggestions made so far, except
for the ChangeLog suggestion Nick made. Nick, thanks for noticing the
problems with the original patch!

If preferred, I could add the separate-inferior-tty argument to
mi_gdb_start only in the tests that need that functionality to pass, 
instead of for all the mi-* tests. This would reduce the patch size
significantly.

Thanks,
Bob Rossi

Index: gdb/testsuite/ChangeLog
+2005-08-02  Bob Rossi  <bob@brasko.net>
+
+	* gdb.mi/gdb669.exp: Tell mi_gdb_start to use a PTY for inferior.
+	* gdb.mi/gdb680.exp: Ditto.
+	* gdb.mi/gdb701.exp: Ditto.
+	* gdb.mi/gdb792.exp: Ditto.
+	* gdb.mi/mi-break.exp: Ditto.
+	* gdb.mi/mi-cli.exp: Ditto.
+	* gdb.mi/mi-disassemble.exp: Ditto.
+	* gdb.mi/mi-eval.exp: Ditto.
+	* gdb.mi/mi-file.exp: Ditto.
+	* gdb.mi/mi-hack-cli.exp: Ditto.
+	* gdb.mi/mi-pthreads.exp: Ditto.
+	* gdb.mi/mi-read-memory.exp: Ditto.
+	* gdb.mi/mi-regs.exp: Ditto.
+	* gdb.mi/mi-return.exp: Ditto.
+	* gdb.mi/mi-simplerun.exp: Ditto.
+	* gdb.mi/mi-stack.exp: Ditto.
+	* gdb.mi/mi-stepi.exp: Ditto.
+	* gdb.mi/mi-until.exp: Ditto.
+	* gdb.mi/mi-var-block.exp: Ditto.
+	* gdb.mi/mi-var-child.exp: Ditto.
+	* gdb.mi/mi-var-cmd.exp: Ditto.
+	* gdb.mi/mi-var-display.exp: Ditto.
+	* gdb.mi/mi-watch.exp: Ditto.
+	* gdb.mi/mi-basics.exp: Ditto.
+	(test_setshow_inferior_tty): Add global mi_inferior_tty_name to scope.
+	(test_setshow_inferior_tty): Change tests to inferior-tty-set/show.
+	* gdb.mi/mi-console.exp: Ditto.
+	(47-exec-next): Use mi_gdb_test to get GDB and Inferior output.
+	* gdb.mi/mi-syn-frame.exp: Tell mi_gdb_start to use PTY for inferior.
+	(403-exec-continue): Use mi_gdb_test to get GDB and Inferior output.
+	(406-data-evaluate-expression have_a_very_merry_interrupt()): Ditto.
+	(410-data-evaluate-expression bar()): Ditto.
+	(408-exec-continue): Use mi_gdb_test to get GDB output.
+	* lib/mi-support.exp (mi_inferior_spawn_id): Add inferior PTY
+	descriptor.
+	(mi_inferior_tty_name): Add inferior PTY file name.
+	(mi_gdb_start): Add INFERIOR_PTY parameter.
+	(mi_gdb_test): Add IPATTERN parameter.

Index: gdb/testsuite/gdb.mi/gdb669.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/gdb669.exp,v
retrieving revision 1.5
diff -u -r1.5 gdb669.exp
--- gdb/testsuite/gdb.mi/gdb669.exp	13 Jan 2004 17:08:03 -0000	1.5
+++ gdb/testsuite/gdb.mi/gdb669.exp	3 Aug 2005 02:02:20 -0000
@@ -1,4 +1,4 @@
-# Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright 2002, 2003, 2004, 2005 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
@@ -30,7 +30,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if {[mi_gdb_start]} {
+if {[mi_gdb_start separate-inferior-tty]} {
     continue
 }
 
Index: gdb/testsuite/gdb.mi/gdb680.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/gdb680.exp,v
retrieving revision 1.1
diff -u -r1.1 gdb680.exp
--- gdb/testsuite/gdb.mi/gdb680.exp	3 Sep 2002 16:37:00 -0000	1.1
+++ gdb/testsuite/gdb.mi/gdb680.exp	3 Aug 2005 02:02:20 -0000
@@ -1,4 +1,4 @@
-# Copyright 2002 Free Software Foundation, Inc.
+# Copyright 2002, 2005 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 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start separate-inferior-tty] {
     continue
 }
 
Index: gdb/testsuite/gdb.mi/gdb701.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/gdb701.exp,v
retrieving revision 1.1
diff -u -r1.1 gdb701.exp
--- gdb/testsuite/gdb.mi/gdb701.exp	16 Sep 2002 19:01:43 -0000	1.1
+++ gdb/testsuite/gdb.mi/gdb701.exp	3 Aug 2005 02:02:20 -0000
@@ -1,4 +1,4 @@
-# Copyright 2002 Free Software Foundation, Inc.
+# Copyright 2002, 2005 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 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start separate-inferior-tty] {
     continue
 }
 
Index: gdb/testsuite/gdb.mi/gdb792.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/gdb792.exp,v
retrieving revision 1.4
diff -u -r1.4 gdb792.exp
--- gdb/testsuite/gdb.mi/gdb792.exp	9 Aug 2004 16:32:44 -0000	1.4
+++ gdb/testsuite/gdb.mi/gdb792.exp	3 Aug 2005 02:02:20 -0000
@@ -1,4 +1,4 @@
-# Copyright 2002, 2003 Free Software Foundation, Inc.
+# Copyright 2002, 2003, 2005 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
@@ -27,7 +27,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start separate-inferior-tty] {
     continue
 }
 
Index: gdb/testsuite/gdb.mi/mi-basics.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-basics.exp,v
retrieving revision 1.10
diff -u -r1.10 mi-basics.exp
--- gdb/testsuite/gdb.mi/mi-basics.exp	6 Jul 2005 14:54:37 -0000	1.10
+++ gdb/testsuite/gdb.mi/mi-basics.exp	3 Aug 2005 02:02:20 -0000
@@ -33,7 +33,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start separate-inferior-tty] {
     continue
 }
 
@@ -238,6 +238,7 @@
 
 proc test_setshow_inferior_tty {} {
     global mi_gdb_prompt
+    global mi_inferior_tty_name
 
     # Test that the commands,
     #   -inferior-tty-set
@@ -245,8 +246,8 @@
     # are setting/getting the same data in GDB.
 
     mi_gdb_test "301-inferior-tty-show" \
-		"301\\\^done" \
-		"initial tty is empty"
+		"301\\\^done,inferior_tty_terminal=\"$mi_inferior_tty_name\"" \
+		"initial tty is mi_inferior_tty_name"
 
     mi_gdb_test "302-inferior-tty-set /dev/pts/1" \
 		"302\\\^done" \
@@ -262,7 +263,15 @@
 
     mi_gdb_test "305-inferior-tty-show" \
 		"305\\\^done" \
-		"final tty is empty"
+		"make sure tty is empty"
+
+    mi_gdb_test "306-inferior-tty-set $mi_inferior_tty_name" \
+		"306\\\^done" \
+		"set tty to mi_inferior_tty_name (the way it was)"
+
+    mi_gdb_test "307-inferior-tty-show" \
+		"307\\\^done,inferior_tty_terminal=\"$mi_inferior_tty_name\"" \
+		"verify tty is correct"
 }
 
 if [test_mi_interpreter_selection] {
Index: gdb/testsuite/gdb.mi/mi-break.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-break.exp,v
retrieving revision 1.7
diff -u -r1.7 mi-break.exp
--- gdb/testsuite/gdb.mi/mi-break.exp	13 Aug 2004 16:21:29 -0000	1.7
+++ gdb/testsuite/gdb.mi/mi-break.exp	3 Aug 2005 02:02:20 -0000
@@ -1,4 +1,4 @@
-# Copyright 1999, 2001, 2004 Free Software Foundation, Inc.
+# Copyright 1999, 2001, 2004, 2005 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
@@ -29,7 +29,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start separate-inferior-tty] {
     continue
 }
 
Index: gdb/testsuite/gdb.mi/mi-cli.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-cli.exp,v
retrieving revision 1.4
diff -u -r1.4 mi-cli.exp
--- gdb/testsuite/gdb.mi/mi-cli.exp	18 May 2005 03:41:58 -0000	1.4
+++ gdb/testsuite/gdb.mi/mi-cli.exp	3 Aug 2005 02:02:20 -0000
@@ -24,7 +24,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start separate-inferior-tty] {
     continue
 }
 
Index: gdb/testsuite/gdb.mi/mi-console.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-console.exp,v
retrieving revision 1.14
diff -u -r1.14 mi-console.exp
--- gdb/testsuite/gdb.mi/mi-console.exp	27 Apr 2005 16:35:15 -0000	1.14
+++ gdb/testsuite/gdb.mi/mi-console.exp	3 Aug 2005 02:02:20 -0000
@@ -36,7 +36,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start separate-inferior-tty] {
     continue
 }
 
@@ -54,37 +54,10 @@
 mi_run_to_main
 
 # Next over the hello() call which will produce lots of output
-send_gdb "47-exec-next\n"
-gdb_expect {
-    -re "47\\^running\r\n$mi_gdb_prompt" {
-	pass "Started step over hello"
-    }
-    timeout {
-	fail "Started step over hello (timeout)"
-    }
-}
-
-if { ![target_info exists gdb,noinferiorio]}  {
-    gdb_expect {
-	-re "@\"H\"\r\n.*@\"e\"\r\n.*@\"l\"\r\n.*@\"l\"\r\n.*@\"o\"\r\n.*@\" \"\r\n.*@\"\\\\\\\\\"\r\n.*@\"\\\\\"\"\r\n.*@\"!\"\r\n.*@\"\\\\r\"\r\n.*@\"\\\\n\"\r\n" {
-	    pass "Hello message"
-	}
-	-re "Hello" {
-
-	    # Probably a native system where GDB doesn't have direct #
-	    # control over the inferior console.  # For this to work,
-	    # GDB would need to run the inferior process # under a PTY
-	    # and then use the even-loops ability to wait on #
-	    # multiple event sources to channel the output back
-	    # through the # MI.
-
-	    kfail "gdb/623" "Hello message"
-	}
-	timeout {
-	    fail "Hello message (timeout)"
-	}
-    }
-}
+mi_gdb_test "47-exec-next" \
+	    "47\\^running" \
+	    "Testing console output" \
+	    "Hello \\\\\"!\[\r\n\]+"
     
 gdb_expect {
     -re "47\\*stopped.*$mi_gdb_prompt$" {
Index: gdb/testsuite/gdb.mi/mi-disassemble.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-disassemble.exp,v
retrieving revision 1.13
diff -u -r1.13 mi-disassemble.exp
--- gdb/testsuite/gdb.mi/mi-disassemble.exp	15 Aug 2004 10:15:58 -0000	1.13
+++ gdb/testsuite/gdb.mi/mi-disassemble.exp	3 Aug 2005 02:02:20 -0000
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2004, 2005 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 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start separate-inferior-tty] {
     continue
 }
 
Index: gdb/testsuite/gdb.mi/mi-eval.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-eval.exp,v
retrieving revision 1.9
diff -u -r1.9 mi-eval.exp
--- gdb/testsuite/gdb.mi/mi-eval.exp	15 Aug 2004 10:15:58 -0000	1.9
+++ gdb/testsuite/gdb.mi/mi-eval.exp	3 Aug 2005 02:02:20 -0000
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2004, 2005 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
@@ -27,7 +27,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start separate-inferior-tty] {
     continue
 }
 
Index: gdb/testsuite/gdb.mi/mi-file.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-file.exp,v
retrieving revision 1.5
diff -u -r1.5 mi-file.exp
--- gdb/testsuite/gdb.mi/mi-file.exp	8 May 2005 13:42:03 -0000	1.5
+++ gdb/testsuite/gdb.mi/mi-file.exp	3 Aug 2005 02:02:20 -0000
@@ -1,4 +1,4 @@
-# Copyright 1999, 2003, 2004 Free Software Foundation, Inc.
+# Copyright 1999, 2003, 2004, 2005 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
@@ -29,7 +29,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start separate-inferior-tty] {
     continue
 }
 
Index: gdb/testsuite/gdb.mi/mi-hack-cli.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-hack-cli.exp,v
retrieving revision 1.6
diff -u -r1.6 mi-hack-cli.exp
--- gdb/testsuite/gdb.mi/mi-hack-cli.exp	9 Aug 2004 16:32:44 -0000	1.6
+++ gdb/testsuite/gdb.mi/mi-hack-cli.exp	3 Aug 2005 02:02:20 -0000
@@ -1,4 +1,4 @@
-# Copyright 1999, 2001 Free Software Foundation, Inc.
+# Copyright 1999, 2001, 2005 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,7 +24,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start separate-inferior-tty] {
     continue
 }
 
Index: gdb/testsuite/gdb.mi/mi-pthreads.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-pthreads.exp,v
retrieving revision 1.7
diff -u -r1.7 mi-pthreads.exp
--- gdb/testsuite/gdb.mi/mi-pthreads.exp	13 Jan 2004 17:08:03 -0000	1.7
+++ gdb/testsuite/gdb.mi/mi-pthreads.exp	3 Aug 2005 02:02:20 -0000
@@ -1,4 +1,4 @@
-# Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright 2002, 2003, 2004, 2005 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
@@ -32,7 +32,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if {[mi_gdb_start]} {
+if {[mi_gdb_start separate-inferior-tty]} {
     continue
 }
 
Index: gdb/testsuite/gdb.mi/mi-read-memory.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-read-memory.exp,v
retrieving revision 1.9
diff -u -r1.9 mi-read-memory.exp
--- gdb/testsuite/gdb.mi/mi-read-memory.exp	9 Aug 2004 16:32:44 -0000	1.9
+++ gdb/testsuite/gdb.mi/mi-read-memory.exp	3 Aug 2005 02:02:20 -0000
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2005 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
@@ -33,7 +33,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start separate-inferior-tty] {
     continue
 }
 
Index: gdb/testsuite/gdb.mi/mi-regs.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-regs.exp,v
retrieving revision 1.12
diff -u -r1.12 mi-regs.exp
--- gdb/testsuite/gdb.mi/mi-regs.exp	9 Aug 2004 16:32:44 -0000	1.12
+++ gdb/testsuite/gdb.mi/mi-regs.exp	3 Aug 2005 02:02:20 -0000
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2005 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
@@ -30,7 +30,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start separate-inferior-tty] {
     continue
 }
 
Index: gdb/testsuite/gdb.mi/mi-return.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-return.exp,v
retrieving revision 1.12
diff -u -r1.12 mi-return.exp
--- gdb/testsuite/gdb.mi/mi-return.exp	18 May 2005 03:41:59 -0000	1.12
+++ gdb/testsuite/gdb.mi/mi-return.exp	3 Aug 2005 02:02:20 -0000
@@ -27,7 +27,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start separate-inferior-tty] {
     continue
 }
 
Index: gdb/testsuite/gdb.mi/mi-simplerun.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-simplerun.exp,v
retrieving revision 1.12
diff -u -r1.12 mi-simplerun.exp
--- gdb/testsuite/gdb.mi/mi-simplerun.exp	15 Aug 2004 10:15:58 -0000	1.12
+++ gdb/testsuite/gdb.mi/mi-simplerun.exp	3 Aug 2005 02:02:20 -0000
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2004, 2005 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
@@ -29,7 +29,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start separate-inferior-tty] {
     continue
 }
 
Index: gdb/testsuite/gdb.mi/mi-stack.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-stack.exp,v
retrieving revision 1.18
diff -u -r1.18 mi-stack.exp
--- gdb/testsuite/gdb.mi/mi-stack.exp	31 Jul 2005 21:24:25 -0000	1.18
+++ gdb/testsuite/gdb.mi/mi-stack.exp	3 Aug 2005 02:02:20 -0000
@@ -27,7 +27,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start separate-inferior-tty] {
     continue
 }
 
Index: gdb/testsuite/gdb.mi/mi-stepi.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-stepi.exp,v
retrieving revision 1.11
diff -u -r1.11 mi-stepi.exp
--- gdb/testsuite/gdb.mi/mi-stepi.exp	18 May 2005 03:41:59 -0000	1.11
+++ gdb/testsuite/gdb.mi/mi-stepi.exp	3 Aug 2005 02:02:20 -0000
@@ -27,7 +27,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start separate-inferior-tty] {
     continue
 }
 
Index: gdb/testsuite/gdb.mi/mi-syn-frame.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-syn-frame.exp,v
retrieving revision 1.5
diff -u -r1.5 mi-syn-frame.exp
--- gdb/testsuite/gdb.mi/mi-syn-frame.exp	2 Aug 2005 14:21:01 -0000	1.5
+++ gdb/testsuite/gdb.mi/mi-syn-frame.exp	3 Aug 2005 02:02:21 -0000
@@ -38,7 +38,7 @@
 set my_mi_gdb_prompt "\\(gdb\\)\[ \]*\[\r\n\]*"
 
 mi_gdb_exit
-mi_gdb_start
+mi_gdb_start separate-inferior-tty
 mi_delete_breakpoints
 mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
@@ -60,16 +60,10 @@
 #
 # Continue back to main()
 #
-
-send_gdb "403-exec-continue\n"
-gdb_expect {
-  -re "403\\^running\[\r\n\]+${my_mi_gdb_prompt}hi in foo\[\r\n\]+403\\\*stopped\[\r\n\]+${my_mi_gdb_prompt}$" {
-    pass "403-exec-continue"
-  }
-  timeout {
-    fail "403-exec-continue"
-  }
-}
+mi_gdb_test "403-exec-continue" \
+  "403\\^running\[\r\n\]+${my_mi_gdb_prompt}403\\\*stopped" \
+  "testing exec continue" \
+  "hi in foo\[\r\n\]\+"
 
 mi_gdb_test "404-stack-list-frames 0 0" \
   "404\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \
@@ -85,8 +79,9 @@
   "insert breakpoint subroutine"
 
 mi_gdb_test "406-data-evaluate-expression have_a_very_merry_interrupt()" \
-  "Waiting to get a signal\[\r\n\]+\\&\"The program being debugged stopped while in a function called from GDB.\\\\n\"\[\r\n\]+\\&\"When the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\n\"\[\r\n\]+\\&\"stop \\(instead of continuing to evaluate the expression containing\\\\n\"\[\r\n\]+\\&\"the function call\\).\\\\n\"\[\r\n\]+406\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nWhen the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\nstop \\(instead of continuing to evaluate the expression containing\\\\nthe function call\\).\"" \
-  "evaluate expression have_a_very_merry_interrupt"
+  "\\&\"The program being debugged stopped while in a function called from GDB.\\\\n\"\[\r\n\]+\\&\"When the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\n\"\[\r\n\]+\\&\"stop \\(instead of continuing to evaluate the expression containing\\\\n\"\[\r\n\]+\\&\"the function call\\).\\\\n\"\[\r\n\]+406\\^error,msg=\"The program being debugged stopped while in a function called from GDB.\\\\nWhen the function \\(have_a_very_merry_interrupt\\) is done executing, GDB will silently\\\\nstop \\(instead of continuing to evaluate the expression containing\\\\nthe function call\\).\"" \
+  "data evaluate expression" \
+  "Waiting to get a signal\[\r\n\]+"
 
 # We should have both a signal handler and a call dummy frame
 # in this next output.
@@ -96,15 +91,8 @@
   "list stack frames"
 
 
-send_gdb "408-exec-continue\n"
-gdb_expect {
-  -re "408\\^running\[\r\n\]+${my_mi_gdb_prompt}408\\\*stopped\[\r\n\]+${my_mi_gdb_prompt}$" {
-    pass "408-exec-continue"
-  }
-  timeout {
-    fail "408-exec-continue"
-  }
-}
+mi_gdb_test "408-exec-continue" \
+  "408\\^running\[\r\n\]+${my_mi_gdb_prompt}408\\\*stopped"
 
 mi_gdb_test "409-stack-list-frames 0 0" \
   "409\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \
@@ -114,7 +102,10 @@
 # Call bar() by hand, which should get an exception while running.
 # 
 
-mi_gdb_test "410-data-evaluate-expression bar()" "hi in bar\[\r\n\]+\\&\"The program being debugged was signaled while in a function called from GDB.\\\\n\"\[\r\n\]+\\&\"GDB remains in the frame where the signal was received.\\\\n\"\[\r\n\]+\\&\"To change this behavior use \\\\\"set unwindonsignal on\\\\\"\\\\n\"\[\r\n\]+\\&\"Evaluation of the expression containing the function \\(bar\\) will be abandoned.\\\\n\"\[\r\n\]+410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\"\\\\nEvaluation of the expression containing the function \\(bar\\) will be abandoned.\"" "call inferior function which raises exception"
+mi_gdb_test "410-data-evaluate-expression bar()" \
+  "\\&\"The program being debugged was signaled while in a function called from GDB.\\\\n\"\[\r\n\]+\\&\"GDB remains in the frame where the signal was received.\\\\n\"\[\r\n\]+\\&\"To change this behavior use \\\\\"set unwindonsignal on\\\\\"\\\\n\"\[\r\n\]+\\&\"Evaluation of the expression containing the function \\(bar\\) will be abandoned.\\\\n\"\[\r\n\]+410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\"\\\\nEvaluation of the expression containing the function \\(bar\\) will be abandoned.\"" \
+  "call inferior function which raises exception" \
+  "hi in bar\[\r\n\]+"
 
 mi_gdb_test "411-stack-list-frames" "411\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"bar\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"}.*\\\]" "backtrace from inferior function at exception"
 
Index: gdb/testsuite/gdb.mi/mi-until.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-until.exp,v
retrieving revision 1.9
diff -u -r1.9 mi-until.exp
--- gdb/testsuite/gdb.mi/mi-until.exp	18 May 2005 03:41:59 -0000	1.9
+++ gdb/testsuite/gdb.mi/mi-until.exp	3 Aug 2005 02:02:21 -0000
@@ -30,7 +30,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start separate-inferior-tty] {
     continue
 }
 
Index: gdb/testsuite/gdb.mi/mi-var-block.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-var-block.exp,v
retrieving revision 1.11
diff -u -r1.11 mi-var-block.exp
--- gdb/testsuite/gdb.mi/mi-var-block.exp	17 Aug 2004 09:38:29 -0000	1.11
+++ gdb/testsuite/gdb.mi/mi-var-block.exp	3 Aug 2005 02:02:21 -0000
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2004, 2005 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,7 +24,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start separate-inferior-tty] {
     continue
 }
 
Index: gdb/testsuite/gdb.mi/mi-var-child.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-var-child.exp,v
retrieving revision 1.20
diff -u -r1.20 mi-var-child.exp
--- gdb/testsuite/gdb.mi/mi-var-child.exp	31 Jul 2005 22:10:53 -0000	1.20
+++ gdb/testsuite/gdb.mi/mi-var-child.exp	3 Aug 2005 02:02:21 -0000
@@ -24,7 +24,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start separate-inferior-tty] {
     continue
 }
 
Index: gdb/testsuite/gdb.mi/mi-var-cmd.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-var-cmd.exp,v
retrieving revision 1.18
diff -u -r1.18 mi-var-cmd.exp
--- gdb/testsuite/gdb.mi/mi-var-cmd.exp	14 Jan 2005 18:17:19 -0000	1.18
+++ gdb/testsuite/gdb.mi/mi-var-cmd.exp	3 Aug 2005 02:02:21 -0000
@@ -25,7 +25,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start separate-inferior-tty] {
     continue
 }
 
Index: gdb/testsuite/gdb.mi/mi-var-display.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-var-display.exp,v
retrieving revision 1.13
diff -u -r1.13 mi-var-display.exp
--- gdb/testsuite/gdb.mi/mi-var-display.exp	18 May 2005 03:41:59 -0000	1.13
+++ gdb/testsuite/gdb.mi/mi-var-display.exp	3 Aug 2005 02:02:21 -0000
@@ -25,7 +25,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start separate-inferior-tty] {
     continue
 }
 
Index: gdb/testsuite/gdb.mi/mi-watch.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-watch.exp,v
retrieving revision 1.12
diff -u -r1.12 mi-watch.exp
--- gdb/testsuite/gdb.mi/mi-watch.exp	18 May 2005 03:41:59 -0000	1.12
+++ gdb/testsuite/gdb.mi/mi-watch.exp	3 Aug 2005 02:02:22 -0000
@@ -30,7 +30,7 @@
 set MIFLAGS "-i=mi"
 
 gdb_exit
-if [mi_gdb_start] {
+if [mi_gdb_start separate-inferior-tty] {
     continue
 }
 
Index: gdb/testsuite/lib/mi-support.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/mi-support.exp,v
retrieving revision 1.28
diff -u -r1.28 mi-support.exp
--- gdb/testsuite/lib/mi-support.exp	2 Aug 2005 14:21:01 -0000	1.28
+++ gdb/testsuite/lib/mi-support.exp	3 Aug 2005 02:02:23 -0000
@@ -28,6 +28,9 @@
     set mi_gdb_prompt "\[(\]gdb\[)\] \r\n"
 }
 
+global mi_inferior_spawn_id
+global mi_inferior_tty_name
+
 set MIFLAGS "-i=mi"
 
 #
@@ -81,13 +84,17 @@
 }
 
 #
-# start gdb -- start gdb running, default procedure
+# start gdb INFERIOR_PTY -- start gdb running, default procedure
+#
+# INFERIOR_PTY should be set to separate-inferior-tty to have the inferior work 
+# with it's own PTY. If set to same-inferior-tty, the inferior shares GDB's PTY. 
+# The default value is same-inferior-tty.
 #
 # When running over NFS, particularly if running many simultaneous
 # tests on different hosts all using the same server, things can
 # get really slow.  Give gdb at least 3 minutes to start up.
 #
-proc mi_gdb_start { } {
+proc mi_gdb_start { args } {
     global verbose
     global GDB
     global GDBFLAGS
@@ -98,6 +105,13 @@
     global MIFLAGS
 
     gdb_stop_suppressing_tests;
+    set inferior_pty no-tty
+
+    if { [llength $args] == 1} {
+	set inferior_pty [lindex $args 0]
+    }
+
+    set separate_inferior_pty [string match $inferior_pty separate-inferior-tty]
 
     # Start SID.
     if { [info procs sid_start] != "" } {
@@ -117,6 +131,16 @@
 	    exit 1
 	}
     }
+
+    # create the new pty for the inferior process
+    if { $separate_inferior_pty } {
+	spawn -pty
+	global mi_inferior_spawn_id
+	global mi_inferior_tty_name
+	set mi_inferior_spawn_id $spawn_id
+	set mi_inferior_tty_name $spawn_out(slave,name)
+    }
+
     set res [remote_spawn host "$GDB -nw $GDBFLAGS $MIFLAGS [host_info gdb_opts]"];
     if { $res < 0 || $res == "" } {
 	perror "Spawning $GDB failed."
@@ -189,6 +213,19 @@
 	    warning "Couldn't set the width to 0."
 	}
     }
+    # If allowing the inferior to have it's own PTY then assign the inferior
+    # it's own terminal device here
+    if { $separate_inferior_pty } {
+	send_gdb "102-inferior-tty-set $mi_inferior_tty_name\n"
+	gdb_expect 10 {
+	    -re ".*102\\\^done\r\n$mi_gdb_prompt$" {
+		verbose "redirect inferior output to new terminal device."
+	    }
+	    timeout {
+	    	warning "Couldn't redirect inferior output." 2
+	    }
+    	}
+    }
 
     return 0;
 }
@@ -511,7 +548,8 @@
     return 0
 }
 
-# mi_gdb_test COMMAND PATTERN MESSAGE -- send a command to gdb; test the result.
+# mi_gdb_test COMMAND PATTERN MESSAGE IPATTERN -- send a command to gdb; 
+#   test the result.
 #
 # COMMAND is the command to execute, send to GDB with send_gdb.  If
 #   this is the null string no command is sent.
@@ -520,6 +558,9 @@
 # MESSAGE is the message to be printed.  (If this is the empty string, 
 #   then sometimes we don't call pass or fail at all; I don't 
 #   understand this at all.)
+# IPATTERN is the pattern to match for the inferior's output.  This parameter
+#   is optional.  If present, it will produce a PASS if the match is 
+#   successful, and a FAIL if unsuccessful.
 #
 # Returns:
 #    1 if the test failed,
@@ -536,6 +577,10 @@
     set pattern [lindex $args 1]
     set message [lindex $args 2]
 
+    if [llength $args]==4 {
+	set ipattern [lindex $args 3]
+    }
+
     if [llength $args]==5 {
 	set question_string [lindex $args 3];
 	set response_string [lindex $args 4];
@@ -686,6 +731,23 @@
 	    set result 1
 	}
     }
+
+    # if the GDB output matched, compare the inferior output
+    if { $result == 0 } {
+	if [ info exists ipattern ] {
+	    global mi_inferior_spawn_id
+	    expect {
+		-i $mi_inferior_spawn_id -re "$ipattern" {
+		    pass "inferior_output:$message"
+		}
+		timeout {
+		    fail "inferior output timeout"
+		    set result 1
+		}
+	    }
+        }
+    }
+
     return $result
 }
 


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