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: Pedro Alves <palves at redhat dot com>
- Cc: gdb-patches at sourceware dot org, brobecker at adacore dot com, yao at codesourcery dot com
- Date: Fri, 16 Aug 2013 17:44:55 +0300
- Subject: Re: [PATCH] Unbuffer stdout and stderr on windows
- References: <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> <8361v9piop dot fsf at gnu dot org> <20130815173618 dot GA6955 at ednor dot casa dot cgf dot cx> <83eh9uonlg dot fsf at gnu dot org> <20130815175940 dot GD6955 at ednor dot casa dot cgf dot cx> <520E1109 dot 7000304 at redhat dot com> <83y581n5ag dot fsf at gnu dot org> <520E296C dot 8090906 at redhat dot com> <83siy9n44r dot fsf at gnu dot org> <520E339D dot 3020209 at redhat dot com>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> Date: Fri, 16 Aug 2013 15:13:49 +0100
> From: Pedro Alves <palves@redhat.com>
> CC: gdb-patches@sourceware.org, brobecker@adacore.com, yao@codesourcery.com
>
> > Right now, the amount of such "broken"
> > outputs is usually very small, and the fact that GDB flushes its
> > stdout probably makes it negligibly small. If we cause more of these
> > instances to happen, the probability of a failure in a given session
> > will go up.
>
> Not sure what you mean by causing more instances to happen?
I mean by that having more smaller chunks of text come out of GDB's
end of the pipe.
> It seems to me the mixing is a direct consequence of buffering.
> With buffering of stdout and stderr, the runtime will push chunks
> of lines to both stdout and stderr when the internal buffers are full,
> with no regard to line endings. IOW, if gdb does:
>
> "line1\nline2\n" -> stdout
> "LINE3\nLINE4\n" -> stderr
>
> then depending on when is the internal stdout and stderr
> buffers filled, the runtime may well flush it like:
>
> "line1\nliNE3\nLINE4\nn", and then "e2\n"
Yes, but since we flush stdout, the above shouldn't happen.
> > Maybe we should dig deeper in the original problem as well, because I
> > still have only a very vague notion of why would GDB, which is a
> > single-threaded program, cause mixing when it flushes stdout
> > regularly. What am I missing?
>
> I think so too. A paste of the mixed output would be good
> to start.
Agreed.