From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11373 invoked by alias); 29 Jul 2013 19:26:11 -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 11348 invoked by uid 89); 29 Jul 2013 19:26:11 -0000 X-Spam-SWARE-Status: No, score=-49.2 required=5.0 tests=AWL,BAYES_50,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE,RDNS_NONE autolearn=no version=3.3.1 Received: from Unknown (HELO mho-02-ewr.mailhop.org) (204.13.248.72) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 29 Jul 2013 19:26:10 +0000 Received: from pool-173-48-46-190.bstnma.fios.verizon.net ([173.48.46.190] helo=cgf.cx) by mho-02-ewr.mailhop.org with esmtpa (Exim 4.72) (envelope-from ) id 1V3t4z-000BZr-5m; Mon, 29 Jul 2013 19:26:01 +0000 Received: from localhost (ednor.casa.cgf.cx [192.168.187.5]) by cgf.cx (Postfix) with ESMTP id 944516013F; Mon, 29 Jul 2013 15:25:59 -0400 (EDT) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX19UMAfdj1pzuaASAXVX8Som Date: Mon, 29 Jul 2013 19:26:00 -0000 From: Christopher Faylor To: gdb-patches@sourceware.org, Yao Qi , Eli Zaretskii Subject: Re: [PATCH] Unbuffer stdout and stderr on windows Message-ID: <20130729192559.GA5348@ednor.casa.cgf.cx> Mail-Followup-To: gdb-patches@sourceware.org, Yao Qi , Eli Zaretskii References: <1374462417-7961-1-git-send-email-yao@codesourcery.com> <838v0yy556.fsf@gnu.org> <51EE23F8.1070905@codesourcery.com> <83wqohw4ee.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83wqohw4ee.fsf@gnu.org> User-Agent: Mutt/1.5.20 (2009-06-14) X-SW-Source: 2013-07/txt/msg00738.txt.bz2 On Tue, Jul 23, 2013 at 08:51:53PM +0300, Eli Zaretskii wrote: >> Date: Tue, 23 Jul 2013 14:34:32 +0800 >> From: Yao Qi >> CC: >> >> On 07/22/2013 11:40 PM, Eli Zaretskii wrote: >> > This is wrong, stdout should be line-buffered by default. >> > >> >> stdout is line-buffered if it can be detected to connect to an >> interactive device, otherwise it is fully buffered. Cygwin emulates pty >> with pipes, and native win32 apps blindly assume all pipes are >> non-interactive. > >Sorry, I was unclear: I meant that stdout should be line-buffered, not >unbuffered, when it is connected to a console (which is the default). >I was under the impression that you were changing stdout to be >unbuffered even in that default case, i.e. even when stdout is >connected to a console. If that's not so, i.e. if you were changing >the buffering only when stdout is not connected to a console, I >apologize for my misunderstanding. > >> > Also, this punishes batch mode with stdout redirected to a file: its >> > stdout buffering (and perhaps also that of stderr, although that's >> > less important) will now always be line-buffered, i.e. less efficient. >> >> Yeah, this patch hurts the performance, but gets the outputs in the >> correct order, so that testsuite can be run to get a reasonable test result. > >I don't think it's right to penalize users for the benefit of the test >suite. > >> > Is it possible to detect the "Cygwin ssh session", whatever that >> > means, and only do this then? I don't think it's right to change >> >> Unfortunately, I am unable to find a heuristics to tell "GDB is in >> cygwin session". There are some differences on env variables between >> cygwin and Windows cmd.exe console, but I am afraid that they are not >> reliable. > >Then how about introducing a special option which will cause the >buffering to be what you want? The test suite could use that option, >and the other users will not suffer any penalty. > >> > behavior of a native w32 GDB just because it misbehaves when mixed >> >> This patch is to change the buffered output to unbuffered, so the >> behaviour of GDB is not changed, IMO. > >Of course it's changed: buffering is user-visible behavior. > >> In the last resort, we may add an option "--cygwin-tty" > >I think this is the best alternative. > >> which I don't really like. > >Why not? 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. This obviously wouldn't be something that Cygwin itself would need. How about a "--buffer-output" option instead, which defaults to true? cgf