This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Unbuffer stdout and stderr on windows
- From: Christopher Faylor <cgf-use-the-mailinglist-please at sourceware dot org>
- To: Pedro Alves <palves at redhat dot com>, gdb-patches at sourceware dot org, yao at codesourcery dot com, Eli Zaretskii <eliz at gnu dot org>
- Date: Tue, 30 Jul 2013 23:40:45 -0400
- Subject: Re: [PATCH] Unbuffer stdout and stderr on windows
- References: <1374462417-7961-1-git-send-email-yao at codesourcery dot com> <838v0yy556 dot fsf at gnu dot org> <51EE23F8 dot 1070905 at codesourcery dot com> <83wqohw4ee dot fsf at gnu dot org> <20130729192559 dot GA5348 at ednor dot casa dot cgf dot cx> <83d2q1xiyv dot fsf at gnu dot org> <51F6C7B2 dot 3020400 at redhat dot com>
On Mon, Jul 29, 2013 at 08:51:14PM +0100, Pedro Alves wrote:
>On 07/29/2013 08:30 PM, Eli Zaretskii wrote:
>>> Date: Mon, 29 Jul 2013 15:25:59 -0400
>>> From: Christopher Faylor <cgf-use-the-mailinglist-please@sourceware.org>
>>>
>>> Note that this is only a problem for non-Cygwin versions of gdb. It
>>> sounds like someone is using mingw-built versions of gdb in a cygwin
>>> pty session.
>>
>> Yes. Specifically, an attempt to run a MinGW GDB through the test
>> suite using Cygwin expect.
>
>IMO, the ultimate solution is to run the testsuite with a small
>netcat-like wrapper program that creates a console, redirects
>the child's stdin/stdout/stderr to the console, and bridges data
>between the cygwin pipes and the console.
>
> cygwin (io=tty/pipe) <-> [ pipe <-> console ] <-> gdb (io=console)
>
>The testsuite would then spawn "wrapper.exe gdb.exe ..." instead of
>"gdb.exe".
>
>GDB would then see a regular console for stdin/stdout/stderr, and
>work out of the box. PR15791 points at winpty, an open source
>tool that from the description does that (and more). It'd be nice
>if that path would be investigated.
We had a somewhat heated debate in the cygwin list about using the
techniques in winpty and eventually abandoned the idea because the way
things like winpty create consoles is not foolproof. Since it relies on
polling, it is theoretically possible to lose data.
I'll bet that, in practice you'd never see any data loss, though.
And, from that observation, you can see which side of the argument
I was on. :-)
cgf