From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wlnex-0006gs-K3 for qemu-devel@nongnu.org; Sat, 17 May 2014 19:05:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wlneo-00045e-FG for qemu-devel@nongnu.org; Sat, 17 May 2014 19:04:55 -0400 Received: from mail-we0-x22e.google.com ([2a00:1450:400c:c03::22e]:55300) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wlneo-00045O-8d for qemu-devel@nongnu.org; Sat, 17 May 2014 19:04:46 -0400 Received: by mail-we0-f174.google.com with SMTP id k48so3990615wev.19 for ; Sat, 17 May 2014 16:04:45 -0700 (PDT) From: =?UTF-8?q?Marc=20Mar=C3=AD?= Date: Sun, 18 May 2014 01:03:38 +0200 Message-Id: <1400367823-32610-12-git-send-email-marc.mari.barcelo@gmail.com> In-Reply-To: <1400367823-32610-1-git-send-email-marc.mari.barcelo@gmail.com> References: <1400367823-32610-1-git-send-email-marc.mari.barcelo@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH v3 11/16] rc4030: Convert debug printfs to QEMU_DPRINTF List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc=20Mar=C3=AD?= , Stefan Hajnoczi , Peter Crosthwaite , =?UTF-8?q?Andreas=20F=C3=A4rber?= Modify debug macros to have the same format through the codebase and use regular ifs instead of ifdef. Change the output of debug messages from stdout to stderr. Remove header in debug printfs, as QEMU_DPRINTF already adds it. Signed-off-by: Marc MarĂ­ --- hw/dma/rc4030.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c index af26632..54885cc 100644 --- a/hw/dma/rc4030.c +++ b/hw/dma/rc4030.c @@ -32,17 +32,18 @@ //#define DEBUG_RC4030 //#define DEBUG_RC4030_DMA -#ifdef DEBUG_RC4030 -#define DPRINTF(fmt, ...) \ -do { printf("rc4030: " fmt , ## __VA_ARGS__); } while (0) static const char* irq_names[] = { "parallel", "floppy", "sound", "video", "network", "scsi", "keyboard", "mouse", "serial0", "serial1" }; +#ifdef DEBUG_RC4030 +#define DEBUG_RC4030_ENABLED 1 #else -#define DPRINTF(fmt, ...) +#define DEBUG_RC4030_ENABLED 0 #endif +#define DPRINTF(fmt, ...) \ + QEMU_DPRINTF(DEBUG_RC4030_ENABLED, "rc4030", fmt, ## __VA_ARGS__) #define RC4030_ERROR(fmt, ...) \ -do { fprintf(stderr, "rc4030 ERROR: %s: " fmt, __func__ , ## __VA_ARGS__); } while (0) + QEMU_DPRINTF(1, "rc4030 ERROR", fmt, ## __VA_ARGS__) /********************************************************/ /* rc4030 emulation */ @@ -442,13 +443,13 @@ static void update_jazz_irq(rc4030State *s) DPRINTF("pending irqs:"); for (irq = 0; irq < ARRAY_SIZE(irq_names); irq++) { if (s->isr_jazz & (1 << irq)) { - printf(" %s", irq_names[irq]); + fprintf(stderr, " %s", irq_names[irq]); if (!(s->imr_jazz & (1 << irq))) { - printf("(ignored)"); + fprintf(stderr, "(ignored)"); } } } - printf("\n"); + fprintf(stderr, "\n"); } #endif @@ -741,7 +742,7 @@ static void rc4030_do_dma(void *opaque, int n, uint8_t *buf, int len, int is_wri #ifdef DEBUG_RC4030_DMA { int i, j; - printf("rc4030 dma: Copying %d bytes %s host %p\n", + DPRINTF("Copying %d bytes %s host %p\n", len, is_write ? "from" : "to", buf); for (i = 0; i < len; i += 16) { int n = 16; @@ -749,13 +750,13 @@ static void rc4030_do_dma(void *opaque, int n, uint8_t *buf, int len, int is_wri n = len - i; } for (j = 0; j < n; j++) - printf("%02x ", buf[i + j]); + fprintf(stderr, "%02x ", buf[i + j]); while (j++ < 16) - printf(" "); - printf("| "); + fprintf(stderr, " "); + fprintf(stderr , "| "); for (j = 0; j < n; j++) - printf("%c", isprint(buf[i + j]) ? buf[i + j] : '.'); - printf("\n"); + fprintf(stderr, "%c", isprint(buf[i + j]) ? buf[i + j] : '.'); + fprintf(stderr, "\n"); } } #endif -- 1.7.10.4