[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] 答复: [RFC 19/19] target-uni core32: Refactor debug output ma
From: |
Guan Xuetao |
Subject: |
[Qemu-devel] 答复: [RFC 19/19] target-uni core32: Refactor debug output macros |
Date: |
Tue, 29 Jan 2013 17:23:58 +0800 |
> -----邮件原件-----
> 发件人: Andreas Färber [mailto:address@hidden
> 发送时间: Sunday, January 27, 2013 21:32
> 收件人: address@hidden
> 抄送: Andreas Färber; Guan Xuetao (maintainer:UniCore32)
> 主题: [RFC 19/19] target-unicore32: Refactor debug output macros
>
> Make debug output compile-testable even if disabled.
>
> Signed-off-by: Andreas Färber <address@hidden>
The patch could work, but I don't think it's a good idea.
Perhaps tracetools can be better.
Guan Xuetao
> ---
> target-unicore32/helper.c | 12 ++++++------
> target-unicore32/softmmu.c | 12 ++++++------
> 2 Dateien geändert, 12 Zeilen hinzugefügt(+), 12 Zeilen entfernt(-)
>
> diff --git a/target-unicore32/helper.c b/target-unicore32/helper.c index
> 5359538..688c985 100644
> --- a/target-unicore32/helper.c
> +++ b/target-unicore32/helper.c
> @@ -17,13 +17,13 @@
> #include "ui/console.h"
> #endif
>
> -#undef DEBUG_UC32
> +#define DEBUG_UC32 0
>
> -#ifdef DEBUG_UC32
> -#define DPRINTF(fmt, ...) printf("%s: " fmt , __func__, ## __VA_ARGS__)
> -#else
> -#define DPRINTF(fmt, ...) do {} while (0) -#endif
> +#define DPRINTF(fmt, ...) G_STMT_START \
> + if (DEBUG_UC32) { \
> + printf("%s: " fmt , __func__, ## __VA_ARGS__); \
> + } \
> + G_STMT_END
>
> CPUUniCore32State *uc32_cpu_init(const char *cpu_model) { diff --git
> a/target-unicore32/softmmu.c b/target-unicore32/softmmu.c index
> fc27100..2ce30d9 100644
> --- a/target-unicore32/softmmu.c
> +++ b/target-unicore32/softmmu.c
> @@ -14,13 +14,13 @@
>
> #include <cpu.h>
>
> -#undef DEBUG_UC32
> +#define DEBUG_UC32 0
>
> -#ifdef DEBUG_UC32
> -#define DPRINTF(fmt, ...) printf("%s: " fmt , __func__, ## __VA_ARGS__)
> -#else
> -#define DPRINTF(fmt, ...) do {} while (0) -#endif
> +#define DPRINTF(fmt, ...) G_STMT_START \
> + if (DEBUG_UC32) { \
> + printf("%s: " fmt , __func__, ## __VA_ARGS__); \
> + } \
> + G_STMT_END
>
> #define SUPERPAGE_SIZE (1 << 22)
> #define UC32_PAGETABLE_READ (1 << 8)
> --
> 1.7.10.4
- Re: [Qemu-devel] [RFC 16/19] target-ppc: Refactor debug output macros, (continued)
[Qemu-devel] [PATCH RESEND for-1.4? 08/19] target-cris/helper.c: Update Coding Style, Andreas Färber, 2013/01/27
[Qemu-devel] [PATCH for-1.4 04/19] target-ppc: Fix build for PPC_DEBUG_DISAS, Andreas Färber, 2013/01/27
[Qemu-devel] [RFC 11/19] target-cris: Refactor debug output macros, Andreas Färber, 2013/01/27
[Qemu-devel] [RFC 13/19] target-lm32: Refactor debug output macros, Andreas Färber, 2013/01/27
[Qemu-devel] [RFC 12/19] target-i386: Refactor debug output macros, Andreas Färber, 2013/01/27
[Qemu-devel] [RFC 18/19] target-sparc: Refactor debug output macros, Andreas Färber, 2013/01/27
[Qemu-devel] [RFC 15/19] target-openrisc: Refactor debug output macros, Andreas Färber, 2013/01/27
[Qemu-devel] [RFC 19/19] target-unicore32: Refactor debug output macros, Andreas Färber, 2013/01/27
- [Qemu-devel] 答复: [RFC 19/19] target-uni core32: Refactor debug output macros,
Guan Xuetao <=