From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13155 invoked by alias); 13 Apr 2006 09:25:46 -0000 Received: (qmail 13124 invoked by uid 22791); 13 Apr 2006 09:25:45 -0000 X-Spam-Check-By: sourceware.org Received: from nitzan.inter.net.il (HELO nitzan.inter.net.il) (192.114.186.20) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 13 Apr 2006 09:25:42 +0000 Received: from HOME-C4E4A596F7 (IGLD-83-130-205-75.inter.net.il [83.130.205.75]) by nitzan.inter.net.il (MOS 3.7.3-GA) with ESMTP id DDC28347 (AUTH halo1); Thu, 13 Apr 2006 12:25:38 +0300 (IDT) Date: Thu, 13 Apr 2006 16:04:00 -0000 Message-Id: From: Eli Zaretskii To: Vladimir Prus CC: gdb@sources.redhat.com In-reply-to: <200604131201.58613.ghost@cs.msu.su> (message from Vladimir Prus on Thu, 13 Apr 2006 12:01:57 +0400) Subject: Re: printfs output in wrong order in MI Reply-to: Eli Zaretskii References: <200604131201.58613.ghost@cs.msu.su> 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-04/txt/msg00157.txt.bz2 > From: Vladimir Prus > Date: Thu, 13 Apr 2006 12:01:57 +0400 > Cc: gdb@sources.redhat.com > > > > (that is, adding "\n"), fixes the problem. Still looks like a bug to me, > > > though. > > > > I think it's expected behavior: printf uses buffered output, > > Where in documentation is it stated that 'printf' uses buffered output? I'll welcome patches to document that, TIA. > Isn't it possible to auto-flush the buffer at the end of "-interpreter-exec > console" execution it's possible to flush the buffers? It is usually a performance tradeoff: GDB has no idea whether a single printf command is all you will want to print, or a part of a block of commands that your front end feeds one after the other. In the latter case, flushing the buffers will be a performance hit. The current code assumes that \n marks the end of the values you want to see output, so line buffering generally does The Right Thing (because, at least in interactive CLI usage, no one in their right mind will want to print strings unterminated by a newline: it would cause the next GDB prompt to not be the first thing on the line). > I think it's reasonable to expect that *all* output of command > wrapped in "-interpreter-exec console" would appears before the > "^done" marker. Is it? I wouldn't know; I'll let other front-end gurus to comment on that.