From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24451 invoked by alias); 1 May 2006 17:11:50 -0000 Received: (qmail 24443 invoked by uid 22791); 1 May 2006 17:11:50 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Mon, 01 May 2006 17:11:49 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1Fabvt-0001zC-RG; Mon, 01 May 2006 13:11:37 -0400 Date: Mon, 01 May 2006 17:11:00 -0000 From: Daniel Jacobowitz To: Joel Brobecker Cc: gdb@sources.redhat.com Subject: Re: MinGW gdb run in non-DOS terminal Message-ID: <20060501171137.GA7482@nevyn.them.org> Mail-Followup-To: Joel Brobecker , gdb@sources.redhat.com References: <20060501170512.GD936@adacore.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060501170512.GD936@adacore.com> User-Agent: Mutt/1.5.8i X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-05/txt/msg00001.txt.bz2 On Mon, May 01, 2006 at 10:05:12AM -0700, Joel Brobecker wrote: > Hello, > > Starting to experiment a bit with MinGW-hosted debuggers, I noticed that > when it is run outside of the DOS window, the terminal handling is a bit > strange. The most obvious issue is when the debugger prints an error: > the actual printing on screen of the error message is delayed and only > finally printed after the next GDB prompt. > > This happens when in a DOS window running cygwin bash, when ssh'ing > from an xterm to the machine and then running GDB, or when running > GDB from GPS, which opens a pseudo-tty (I think!) to GDB. On the other > hand, it works great when run in a DOS window. > > Has anybody else seen this? Maybe there is a missing-flush issue > somewhere... Or maybe there is a workaround I don't know about? > Otherwise, I'll have a look at this next. It is roughly unsolvable. A cygwin "terminal" is in fact a Windows pipe; isatty() returns false, therefore the C library selects line-buffered mode, which is a pretty standard thing for C runtimes to do. I suppose that if the CLI is in use, you could automatically turn off buffering. But there may be plenty of other problems... I talked with Chris about somehow using Windows consoles for this instead of pipes (i.e. changing Cygwin), and I believe the outcome of that discussion was that it might be possible, or might not, but would definitely not be easy. -- Daniel Jacobowitz CodeSourcery