qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Ayaz Akram <aaqemu@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] printf in qemu
Date: Thu, 30 Jan 2014 10:08:50 +0100	[thread overview]
Message-ID: <20140130090850.GB7619@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <CAC0+NVaONKuxevS33Ua6h_AUT+gkXFffP8HyZmsiJyypsMN2Sw@mail.gmail.com>

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

      reply	other threads:[~2014-01-30  9:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-30  7:16 [Qemu-devel] printf in qemu Ayaz Akram
2014-01-30  9:08 ` Stefan Hajnoczi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140130090850.GB7619@stefanha-thinkpad.redhat.com \
    --to=stefanha@gmail.com \
    --cc=aaqemu@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).