[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [Qemu-devel] [PATCH 4/4] debugcon: use fprintf(stderr
From: |
Andreas Färber |
Subject: |
Re: [Qemu-trivial] [Qemu-devel] [PATCH 4/4] debugcon: use fprintf(stderr...) instead of printf |
Date: |
Fri, 24 May 2013 13:55:49 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 |
Am 24.05.2013 04:47, schrieb liguang:
> suggested by Andreas Färber <address@hidden>
>
> Signed-off-by: liguang <address@hidden>
> ---
> 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
- [Qemu-trivial] [PATCH 0/4] debugcon: fix some bugs when DEBUG_DEBUGCON, liguang, 2013/05/23
- [Qemu-trivial] [PATCH 1/4] debugcon: fix always print "addr=0x0, val=0x0" bug when use DEBUG_DEBUGCON, liguang, 2013/05/23
- [Qemu-trivial] [PATCH 3/4] debugcon: fix compiler warning when open DEBUG_DEBUGCON, liguang, 2013/05/23
- [Qemu-trivial] [PATCH 2/4] debugcon: make debug message more readable, liguang, 2013/05/23
- [Qemu-trivial] [PATCH 4/4] debugcon: use fprintf(stderr...) instead of printf, liguang, 2013/05/23
- Re: [Qemu-trivial] [Qemu-devel] [PATCH 4/4] debugcon: use fprintf(stderr...) instead of printf,
Andreas Färber <=
- Re: [Qemu-trivial] [PATCH 0/4] debugcon: fix some bugs when DEBUG_DEBUGCON, Michael Tokarev, 2013/05/25
Re: [Qemu-trivial] [PATCH 0/4] debugcon: fix some bugs when DEBUG_DEBUGCON, Gerd Hoffmann, 2013/05/27