This is the mail archive of the
mailing list for the GDB project.
[mingw32] stdin redirection
- From: Jerome Guitton <guitton at adacore dot com>
- To: gdb at sourceware dot org
- Date: Wed, 11 Apr 2007 15:42:19 +0200
- Subject: [mingw32] stdin redirection
We noticed that a migw32-hosted GDB would freeze if commands are sent
through stdin (e.g. gdb < send.gdb).
It appears that it keeps waiting on WaitForMultipleObjects, in
We also noticed that this bug only happens if a call to PeekNamedPipe
(in fd_is_pipe, in ser-mingw.c), with the file descriptor of stdin In
this particular case, this call always return 0; so we have added the
following kludge in our sources, to "fix" this issue:
RCS file: /cvs/src/src/gdb/ser-mingw.c,v
retrieving revision 1.8
diff -u -r1.8 ser-mingw.c
--- ser-mingw.c 8 Apr 2007 15:20:07 -0000 1.8
+++ ser-mingw.c 11 Apr 2007 12:58:04 -0000
@@ -447,6 +447,7 @@
fd_is_pipe (int fd)
+ return 0;
if (PeekNamedPipe ((HANDLE) _get_osfhandle (fd), NULL, 0, NULL, NULL, NULL))
...and, with this patch, the problem does not appear anymore.
So: apparently, using PeekNamedPipe on a fd which is not a pipe makes
the debugger freeze on WaitForMultipleObjects. Is it a known problem?
Would anyone know how to implement fd_is_pipe in such a way that we
would avoid this "limitation"? I have not seen anything promising in
the MSDN so far (the other functions to deal with pipes bring about
the same behavior).