From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33124) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8ncN-0003rq-7h for qemu-devel@nongnu.org; Thu, 30 Jan 2014 04:09:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W8ncE-0002Rk-OQ for qemu-devel@nongnu.org; Thu, 30 Jan 2014 04:09:03 -0500 Received: from mail-ee0-x22f.google.com ([2a00:1450:4013:c00::22f]:42977) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8ncE-0002Rc-Hi for qemu-devel@nongnu.org; Thu, 30 Jan 2014 04:08:54 -0500 Received: by mail-ee0-f47.google.com with SMTP id d49so1417122eek.6 for ; Thu, 30 Jan 2014 01:08:53 -0800 (PST) Date: Thu, 30 Jan 2014 10:08:50 +0100 From: Stefan Hajnoczi Message-ID: <20140130090850.GB7619@stefanha-thinkpad.redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] printf in qemu List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ayaz Akram Cc: qemu-devel@nongnu.org On Thu, Jan 30, 2014 at 12:16:26PM +0500, Ayaz Akram wrote: > I observed that if i place printf in qemu at certain places like in > hw./serial.c file, I can see the printing when my guest OS is running on > qemu, while there are some other places like in pckbd.c (emulation of > keyboard), where if printf is used, I am not able to see any printing while > guest OS is running, but when I press ctrl+A and x i can see that > printing...... Any idea why this different behavior ?? Usually the problem is stdout buffering. See fflush(3) and use fprintf(stderr) instead for debugging. stderr is unbuffered by default on POSIX systems. I think on Windows you need to explicitly disable buffering for stderr. Stefan