From: "Andreas Färber" <afaerber@suse.de>
To: liguang <lig.fnst@cn.fujitsu.com>
Cc: qemu-trivial@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
Anthony Liguori <aliguori@us.ibm.com>,
qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 4/4] debugcon: use fprintf(stderr...) instead of printf
Date: Fri, 24 May 2013 13:55:49 +0200 [thread overview]
Message-ID: <519F5545.2070906@suse.de> (raw)
In-Reply-To: <1369363654-7063-5-git-send-email-lig.fnst@cn.fujitsu.com>
Am 24.05.2013 04:47, schrieb liguang:
> suggested by Andreas Färber <afaerber@suse.de>
>
> Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
> ---
> hw/char/debugcon.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/hw/char/debugcon.c b/hw/char/debugcon.c
> index 3b0637d..be20ede 100644
> --- a/hw/char/debugcon.c
> +++ b/hw/char/debugcon.c
> @@ -55,7 +55,8 @@ static void debugcon_ioport_write(void *opaque, hwaddr addr, uint64_t val,
> unsigned char ch = val;
>
> #ifdef DEBUG_DEBUGCON
> - printf(" [debugcon: write addr=0x%04" HWADDR_PRIx " val=0x%02" PRIx64 "]\n", addr, val);
> + fprintf(stderr, " [debugcon: write addr=0x%04" HWADDR_PRIx
> + " val=0x%02" PRIx64 "]\n", addr, val);
> #endif
>
> qemu_chr_fe_write(s->chr, &ch, 1);
> @@ -67,7 +68,7 @@ static uint64_t debugcon_ioport_read(void *opaque, hwaddr addr, unsigned width)
> DebugconState *s = opaque;
>
> #ifdef DEBUG_DEBUGCON
> - printf("debugcon: read addr=0x%04" HWADDR_PRIx "\n", addr);
> + fprintf(stderr, "debugcon: read addr=0x%04" HWADDR_PRIx "\n", addr);
> #endif
>
> return s->readback;
>
Actually my suggestion was to make this a two-patch series:
1/2 debugcon: Fix debug format specifiers
2/2 debugcon: Separate debug console output from device debug output
The former would do both HWADDR_PRIx and PRIx64 in one go and not do a
lengthy example or "Oh, that's wrong" in the commit message.
The latter would change where/how the debug output is written, without
changing to " [...]".
Thinking more about this, I think it would be best to turn this into a
DPRINTF() macro or so, then the change can be made in one central
location and the inline #ifdefs can be dropped. Bonus points if the
macro were designed in such a way that even if DEBUG_DEBUGCON is not
defined the (f)printfs get tested, to avoid regressions. :)
Regards,
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
next prev parent reply other threads:[~2013-05-24 11:55 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-24 2:47 [Qemu-devel] [PATCH 0/4] debugcon: fix some bugs when DEBUG_DEBUGCON liguang
2013-05-24 2:47 ` [Qemu-devel] [PATCH 1/4] debugcon: fix always print "addr=0x0, val=0x0" bug when use DEBUG_DEBUGCON liguang
2013-05-24 2:47 ` [Qemu-devel] [PATCH 2/4] debugcon: make debug message more readable liguang
2013-05-24 2:47 ` [Qemu-devel] [PATCH 3/4] debugcon: fix compiler warning when open DEBUG_DEBUGCON liguang
2013-05-24 2:47 ` [Qemu-devel] [PATCH 4/4] debugcon: use fprintf(stderr...) instead of printf liguang
2013-05-24 11:55 ` Andreas Färber [this message]
2013-05-25 9:28 ` [Qemu-devel] [Qemu-trivial] [PATCH 0/4] debugcon: fix some bugs when DEBUG_DEBUGCON Michael Tokarev
2013-05-25 10:35 ` Andreas Färber
2013-05-25 10:42 ` Michael Tokarev
2013-05-27 1:40 ` li guang
2013-05-27 20:42 ` Michael Tokarev
2013-05-28 0:14 ` li guang
2013-05-27 9:13 ` [Qemu-devel] " Gerd Hoffmann
2013-05-28 0:31 ` li guang
2013-05-28 5:46 ` Gerd Hoffmann
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=519F5545.2070906@suse.de \
--to=afaerber@suse.de \
--cc=aliguori@us.ibm.com \
--cc=kraxel@redhat.com \
--cc=lig.fnst@cn.fujitsu.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@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).