From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4801 invoked by alias); 16 Aug 2013 14:44:26 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 4790 invoked by uid 89); 16 Aug 2013 14:44:26 -0000 X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_NO,SPF_SOFTFAIL autolearn=no version=3.3.2 Received: from mtaout20.012.net.il (HELO mtaout20.012.net.il) (80.179.55.166) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 16 Aug 2013 14:44:25 +0000 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0MRM00I00OJZV900@a-mtaout20.012.net.il> for gdb-patches@sourceware.org; Fri, 16 Aug 2013 17:44:22 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MRM00I2FOXYF5C0@a-mtaout20.012.net.il>; Fri, 16 Aug 2013 17:44:22 +0300 (IDT) Date: Fri, 16 Aug 2013 14:44:00 -0000 From: Eli Zaretskii Subject: Re: [PATCH] Unbuffer stdout and stderr on windows In-reply-to: <520E339D.3020209@redhat.com> To: Pedro Alves Cc: gdb-patches@sourceware.org, brobecker@adacore.com, yao@codesourcery.com Reply-to: Eli Zaretskii Message-id: <83pptdn194.fsf@gnu.org> References: <51EE23F8.1070905@codesourcery.com> <83wqohw4ee.fsf@gnu.org> <20130729192559.GA5348@ednor.casa.cgf.cx> <83d2q1xiyv.fsf@gnu.org> <51F6C7B2.3020400@redhat.com> <20130731034045.GA5565@ednor.casa.cgf.cx> <20130812211105.GA11128@adacore.com> <8361v9piop.fsf@gnu.org> <20130815173618.GA6955@ednor.casa.cgf.cx> <83eh9uonlg.fsf@gnu.org> <20130815175940.GD6955@ednor.casa.cgf.cx> <520E1109.7000304@redhat.com> <83y581n5ag.fsf@gnu.org> <520E296C.8090906@redhat.com> <83siy9n44r.fsf@gnu.org> <520E339D.3020209@redhat.com> X-SW-Source: 2013-08/txt/msg00434.txt.bz2 > Date: Fri, 16 Aug 2013 15:13:49 +0100 > From: Pedro Alves > 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.