This is the mail archive of the 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

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

Changelog entry:

2002-12-31  Steven O'Brien  <>

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


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, 
   if (tty >= 0)
-      close (tty);
       dup2 (ostdin, 0);
       dup2 (ostdout, 1);
       dup2 (ostderr, 2);

Unsubscribe info:
Bug reporting:

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