This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin 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]

[PATCH] fix broken tty command on cygwin


Hi
The gdb tty option and command is broken on cygwin. After setting a tty
for the inferior, the first run seems OK, but the second sometimes fails
and the third may cause gdb to hang or enter an infinite loop. The fix
is to close the (redundant) tty fd *before* launching the inferior
process instead of after.
This fix is necessary to support anjuta and other gdb interfaces on
cygwin.

Changelog entry:

2002-12-31  Steven O'Brien  <steven.obrien2@ntlworld.com>

	* gdb/win32-nat.c (child_create_inferior): close tty fd before
	launching the inferior process.


Patch:

Index: win32-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/win32-nat.c,v
retrieving revision 1.66
diff -u -p -r1.66 win32-nat.c
--- win32-nat.c	23 Nov 2002 02:49:45 -0000	1.66
+++ win32-nat.c	31 Dec 2002 09:47:00 -0000
@@ -1614,6 +1614,7 @@ child_create_inferior (char *exec_file, 
 	  dup2 (tty, 0);
 	  dup2 (tty, 1);
 	  dup2 (tty, 2);
+	  close (tty);
 	}
     }
 
@@ -1629,7 +1630,6 @@ child_create_inferior (char *exec_file, 
 		       &pi);
   if (tty >= 0)
     {
-      close (tty);
       dup2 (ostdin, 0);
       dup2 (ostdout, 1);
       dup2 (ostderr, 2);

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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