Patchwork [v2,09/15] target-lm32: Refactor debug output macros

login
register
mail settings
Submitter Andreas Färber
Date Feb. 21, 2013, 4:25 a.m.
Message ID <1361420711-15698-10-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/222181/
State New
Headers show

Comments

Andreas Färber - Feb. 21, 2013, 4:25 a.m.
Already enabled and thus compile-tested, but align with other targets.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-lm32/translate.c |   14 ++++++++++++--
 1 Datei geändert, 12 Zeilen hinzugefügt(+), 2 Zeilen entfernt(-)

Patch

diff --git a/target-lm32/translate.c b/target-lm32/translate.c
index 6b87340..45a7d8c 100644
--- a/target-lm32/translate.c
+++ b/target-lm32/translate.c
@@ -29,11 +29,21 @@ 
 
 #define DISAS_LM32 1
 #if DISAS_LM32
-#  define LOG_DIS(...) qemu_log_mask(CPU_LOG_TB_IN_ASM, ## __VA_ARGS__)
+static const bool debug_disas = true;
 #else
-#  define LOG_DIS(...) do { } while (0)
+static const bool debug_disas;
 #endif
 
+static void GCC_FMT_ATTR(1, 2) LOG_DIS(const char *fmt, ...)
+{
+    if (debug_disas) {
+        va_list ap;
+        va_start(ap, fmt);
+        qemu_log_mask(CPU_LOG_TB_IN_ASM, fmt, ap);
+        va_end(ap);
+    }
+}
+
 #define EXTRACT_FIELD(src, start, end) \
             (((src) >> start) & ((1 << (end - start + 1)) - 1))