[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 01/14] dma: Convert conditional compilation of debug
From: |
Marc Marí |
Subject: |
[Qemu-devel] [PATCH 01/14] dma: Convert conditional compilation of debug printfs to regular ifs |
Date: |
Mon, 28 Apr 2014 10:26:02 +0200 |
From: Marc Marí <address@hidden>
Modify debug macros as explained in
https://lists.gnu.org/archive/html/qemu-devel/2014-04/msg03642.html
Signed-off-by: Marc Marí <address@hidden>
---
hw/dma/i82374.c | 17 ++++++++++-------
hw/dma/i8257.c | 24 +++++++++++++++++-------
hw/dma/rc4030.c | 13 +++++++++----
3 files changed, 36 insertions(+), 18 deletions(-)
diff --git a/hw/dma/i82374.c b/hw/dma/i82374.c
index dc7a767..fff4e6f 100644
--- a/hw/dma/i82374.c
+++ b/hw/dma/i82374.c
@@ -24,15 +24,18 @@
#include "hw/isa/isa.h"
-//#define DEBUG_I82374
+//#define DEBUG_I82374 1
-#ifdef DEBUG_I82374
-#define DPRINTF(fmt, ...) \
-do { fprintf(stderr, "i82374: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) \
-do {} while (0)
+#ifndef DEBUG_I82374
+#define DEBUG_I82374 0
#endif
+
+#define DPRINTF(fmt, ...) \
+ do { \
+ if(DEBUG_I82374) { \
+ fprintf(stderr, "I82374: " fmt, ## __VA_ARGS__); \
+ } \
+ } while (0)
#define BADF(fmt, ...) \
do { fprintf(stderr, "i82374 ERROR: " fmt , ## __VA_ARGS__); } while (0)
diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c
index 4490372..ac38d7b 100644
--- a/hw/dma/i8257.c
+++ b/hw/dma/i8257.c
@@ -25,17 +25,27 @@
#include "hw/isa/isa.h"
#include "qemu/main-loop.h"
-/* #define DEBUG_DMA */
+/* #define DEBUG_DMA 1*/
#define dolog(...) fprintf (stderr, "dma: " __VA_ARGS__)
-#ifdef DEBUG_DMA
-#define linfo(...) fprintf (stderr, "dma: " __VA_ARGS__)
-#define ldebug(...) fprintf (stderr, "dma: " __VA_ARGS__)
-#else
-#define linfo(...)
-#define ldebug(...)
+#ifndef DEBUG_DMA
+#define DEBUG_DMA 0
#endif
+#define linfo(...) \
+ do { \
+ if(DEBUG_DMA) { \
+ fprintf(stderr, "dma: " __VA_ARGS__); \
+ } \
+ } while (0)
+
+#define ldebug(...) \
+ do { \
+ if(DEBUG_DMA) { \
+ fprintf(stderr, "dma: " __VA_ARGS__); \
+ } \
+ } while (0)
+
struct dma_regs {
int now[2];
uint16_t base[2];
diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c
index af26632..217b3f3 100644
--- a/hw/dma/rc4030.c
+++ b/hw/dma/rc4030.c
@@ -29,18 +29,23 @@
/********************************************************/
/* debug rc4030 */
-//#define DEBUG_RC4030
+//#define DEBUG_RC4030 1
//#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" };
#else
-#define DPRINTF(fmt, ...)
+#define DEBUG_RC4030 0
#endif
+#define DPRINTF(fmt, ...) \
+ do { \
+ if(DEBUG_RC4030) { \
+ printf("rc4030: " fmt, ## __VA_ARGS__); \
+ } \
+ } while (0)
+
#define RC4030_ERROR(fmt, ...) \
do { fprintf(stderr, "rc4030 ERROR: %s: " fmt, __func__ , ## __VA_ARGS__); }
while (0)
--
1.7.10.4
- [Qemu-devel] [PATCH 01/14] dma: Convert conditional compilation of debug printfs to regular ifs,
Marc Marí <=
- [Qemu-devel] [PATCH 02/14] i386: Convert conditional compilation of debug printfs to regular ifs, Marc Marí, 2014/04/28
- [Qemu-devel] [PATCH 03/14] net: Convert conditional compilation of debug printfs to regular ifs, Marc Marí, 2014/04/28
- [Qemu-devel] [PATCH 04/14] isa: Convert conditional compilation of debug printfs to regular ifs, Marc Marí, 2014/04/28
- [Qemu-devel] [PATCH 05/14] pci-host: Convert conditional compilation of debug printfs to regular ifs, Marc Marí, 2014/04/28
- [Qemu-devel] [PATCH 06/14] s390x: Convert conditional compilation of debug printfs to regular ifs, Marc Marí, 2014/04/28
- [Qemu-devel] [PATCH 09/14] tpm: Convert conditional compilation of debug printfs to regular ifs, Marc Marí, 2014/04/28
- [Qemu-devel] [PATCH 07/14] scsi: Convert conditional compilation of debug printfs to regular ifs, Marc Marí, 2014/04/28