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

[mingw32] stdin redirection

Hi all,

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:

Index: ser-mingw.c
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 @@
 static int
 fd_is_pipe (int fd)
+  return 0;
   if (PeekNamedPipe ((HANDLE) _get_osfhandle (fd), NULL, 0, NULL, NULL, NULL))
     return 1;

...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).


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