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: Eli Zaretskii <eliz at gnu dot org>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: palves at redhat dot com, gdb-patches at sourceware dot org, yao at codesourcery dot com
- Date: Tue, 13 Aug 2013 21:08:38 +0300
- 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> <20130731034045 dot GA5565 at ednor dot casa dot cgf dot cx> <20130812211105 dot GA11128 at adacore dot com>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> Date: Mon, 12 Aug 2013 14:11:05 -0700
> From: Joel Brobecker <brobecker@adacore.com>
>
> > 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. :-)
>
> FWIW, many frontends also implements communication with GDB using
> pipes on Windows, and running MinGW-gdb inside cygwin window/shell
> is just a very very common practice, regardless of whether officially
> supported or not. How does Emacs do, for instance? IIRC when I looked
> at the code, that's what it did.
Yes, Emacs does that. But it is never a problem in that case, because
it's the user who looks at the results, not a program that wants to
interpret them.
> Having the stdout/stderr output mixed up is very confusing and breaks
> testing as well, so we applied the same approach as Yao's at AdaCore.
Making GDB output unbuffered is not a good idea for Emacs, because it
will cause it read single characters, which is (a) inefficient, and
(b) error-prone, because a single CR character could dupe the text
decoding routines into thinking the EOL format is from Mac.
I think this problem is only relevant to the test suite, where a
program tries to interpret the output and trips on extraneous
characters. Let's not make the solution so much wider than the
problem. With Yao's patch, you now have this in a Cygwin terminal;
can we leave all the other types alone, please?