From patchwork Sun Jan 27 13:32:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 2051651 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 82C40DFE86 for ; Sun, 27 Jan 2013 13:33:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756757Ab3A0NdH (ORCPT ); Sun, 27 Jan 2013 08:33:07 -0500 Received: from cantor2.suse.de ([195.135.220.15]:48523 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756045Ab3A0NdG (ORCPT ); Sun, 27 Jan 2013 08:33:06 -0500 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 1670BA525C; Sun, 27 Jan 2013 14:33:05 +0100 (CET) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , Richard Henderson (maintainer:S390), Alexander Graf (maintainer:S390), Gleb Natapov (supporter:Overall), Marcelo Tosatti (supporter:Overall), kvm@vger.kernel.org (open list:Overall) Subject: [RFC 17/19] target-s390x: Refactor debug output macros Date: Sun, 27 Jan 2013 14:32:15 +0100 Message-Id: <1359293537-8251-18-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1359293537-8251-1-git-send-email-afaerber@suse.de> References: <1359293537-8251-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Make debug output compile-testable even if disabled. Inline S390X_DEBUG_DISAS in translate.c. Signed-off-by: Andreas Färber --- target-s390x/cc_helper.c | 13 +++++++------ target-s390x/fpu_helper.c | 13 +++++++------ target-s390x/helper.c | 42 ++++++++++++++++++------------------------ target-s390x/int_helper.c | 13 +++++++------ target-s390x/kvm.c | 9 ++------- target-s390x/mem_helper.c | 13 +++++++------ target-s390x/misc_helper.c | 13 +++++++------ target-s390x/translate.c | 18 ++++++++---------- 8 Dateien geändert, 63 Zeilen hinzugefügt(+), 71 Zeilen entfernt(-) diff --git a/target-s390x/cc_helper.c b/target-s390x/cc_helper.c index a6d60bf..a6fad6a 100644 --- a/target-s390x/cc_helper.c +++ b/target-s390x/cc_helper.c @@ -22,12 +22,13 @@ #include "helper.h" #include "qemu/host-utils.h" -/* #define DEBUG_HELPER */ -#ifdef DEBUG_HELPER -#define HELPER_LOG(x...) qemu_log(x) -#else -#define HELPER_LOG(x...) -#endif +#define DEBUG_HELPER 0 + +#define HELPER_LOG(...) G_STMT_START \ + if (DEBUG_HELPER) { \ + qemu_log(__VA_ARGS__); \ + } \ + G_STMT_END static uint32_t cc_calc_ltgt_32(int32_t src, int32_t dst) { diff --git a/target-s390x/fpu_helper.c b/target-s390x/fpu_helper.c index 94375b6..aba5e2c 100644 --- a/target-s390x/fpu_helper.c +++ b/target-s390x/fpu_helper.c @@ -25,12 +25,13 @@ #include "exec/softmmu_exec.h" #endif -/* #define DEBUG_HELPER */ -#ifdef DEBUG_HELPER -#define HELPER_LOG(x...) qemu_log(x) -#else -#define HELPER_LOG(x...) -#endif +#define DEBUG_HELPER 0 + +#define HELPER_LOG(...) G_STMT_START \ + if (DEBUG_HELPER) { \ + qemu_log(__VA_ARGS__); \ + } \ + G_STMT_END #define RET128(F) (env->retxl = F.low, F.high) diff --git a/target-s390x/helper.c b/target-s390x/helper.c index 76fd558..90d62db 100644 --- a/target-s390x/helper.c +++ b/target-s390x/helper.c @@ -25,30 +25,24 @@ #include "sysemu/sysemu.h" #endif -//#define DEBUG_S390 -//#define DEBUG_S390_PTE -//#define DEBUG_S390_STDOUT - -#ifdef DEBUG_S390 -#ifdef DEBUG_S390_STDOUT -#define DPRINTF(fmt, ...) \ - do { fprintf(stderr, fmt, ## __VA_ARGS__); \ - qemu_log(fmt, ##__VA_ARGS__); } while (0) -#else -#define DPRINTF(fmt, ...) \ - do { qemu_log(fmt, ## __VA_ARGS__); } while (0) -#endif -#else -#define DPRINTF(fmt, ...) \ - do { } while (0) -#endif - -#ifdef DEBUG_S390_PTE -#define PTE_DPRINTF DPRINTF -#else -#define PTE_DPRINTF(fmt, ...) \ - do { } while (0) -#endif +#define DEBUG_S390 0 +#define DEBUG_S390_PTE 0 +#define DEBUG_S390_STDOUT 0 + +#define DPRINTF(fmt, ...) G_STMT_START \ + if (DEBUG_S390) { \ + if (DEBUG_S390_STDOUT) { \ + fprintf(stderr, fmt, ## __VA_ARGS__); \ + } \ + qemu_log(fmt, ## __VA_ARGS__); \ + } \ + G_STMT_END + +#define PTE_DPRINTF(fmt, ...) G_STMT_START \ + if (DEBUG_S390_PTE) { \ + DPRINTF(fmt, ## __VA_ARGS__); \ + } \ + G_STMT_END #ifndef CONFIG_USER_ONLY void s390x_tod_timer(void *opaque) diff --git a/target-s390x/int_helper.c b/target-s390x/int_helper.c index 6858301..acf2de0 100644 --- a/target-s390x/int_helper.c +++ b/target-s390x/int_helper.c @@ -22,12 +22,13 @@ #include "qemu/host-utils.h" #include "helper.h" -/* #define DEBUG_HELPER */ -#ifdef DEBUG_HELPER -#define HELPER_LOG(x...) qemu_log(x) -#else -#define HELPER_LOG(x...) -#endif +#define DEBUG_HELPER 0 + +#define HELPER_LOG(...) G_STMT_START \ + if (DEBUG_HELPER) { \ + qemu_log(__VA_ARGS__); \ + } \ + G_STMT_END /* 64/64 -> 128 unsigned multiplication */ uint64_t HELPER(mul128)(CPUS390XState *env, uint64_t v1, uint64_t v2) diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index add6a58..ee4c7f9 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -35,15 +35,10 @@ #include "cpu.h" #include "sysemu/device_tree.h" -/* #define DEBUG_KVM */ +#define DEBUG_KVM 0 -#ifdef DEBUG_KVM #define dprintf(fmt, ...) \ - do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) -#else -#define dprintf(fmt, ...) \ - do { } while (0) -#endif + do { if (DEBUG_KVM) { fprintf(stderr, fmt, ## __VA_ARGS__); } } while (0) #define IPA0_DIAG 0x8300 #define IPA0_SIGP 0xae00 diff --git a/target-s390x/mem_helper.c b/target-s390x/mem_helper.c index 372334b..99e3d45 100644 --- a/target-s390x/mem_helper.c +++ b/target-s390x/mem_helper.c @@ -61,12 +61,13 @@ void tlb_fill(CPUS390XState *env, target_ulong addr, int is_write, int mmu_idx, #endif -/* #define DEBUG_HELPER */ -#ifdef DEBUG_HELPER -#define HELPER_LOG(x...) qemu_log(x) -#else -#define HELPER_LOG(x...) -#endif +#define DEBUG_HELPER 0 + +#define HELPER_LOG(...) G_STMT_START \ + if (DEBUG_HELPER) { \ + qemu_log(__VA_ARGS__); \ + } \ + G_STMT_END #ifndef CONFIG_USER_ONLY static void mvc_fast_memset(CPUS390XState *env, uint32_t l, uint64_t dest, diff --git a/target-s390x/misc_helper.c b/target-s390x/misc_helper.c index 09301d0..72dbdc1 100644 --- a/target-s390x/misc_helper.c +++ b/target-s390x/misc_helper.c @@ -34,12 +34,13 @@ #include "sysemu/sysemu.h" #endif -/* #define DEBUG_HELPER */ -#ifdef DEBUG_HELPER -#define HELPER_LOG(x...) qemu_log(x) -#else -#define HELPER_LOG(x...) -#endif +#define DEBUG_HELPER 0 + +#define HELPER_LOG(...) G_STMT_START \ + if (DEBUG_HELPER) { \ + qemu_log(__VA_ARGS__); \ + } \ + G_STMT_END /* Raise an exception dynamically from a helper function. */ void QEMU_NORETURN runtime_exception(CPUS390XState *env, int excp, diff --git a/target-s390x/translate.c b/target-s390x/translate.c index a57296c..d72f9e0 100644 --- a/target-s390x/translate.c +++ b/target-s390x/translate.c @@ -19,14 +19,14 @@ */ /* #define DEBUG_INLINE_BRANCHES */ -#define S390X_DEBUG_DISAS -/* #define S390X_DEBUG_DISAS_VERBOSE */ +#define S390X_DEBUG_DISAS 1 +#define S390X_DEBUG_DISAS_VERBOSE 0 -#ifdef S390X_DEBUG_DISAS_VERBOSE -# define LOG_DISAS(...) qemu_log(__VA_ARGS__) -#else -# define LOG_DISAS(...) do { } while (0) -#endif +#define LOG_DISAS(...) G_STMT_START \ + if (S390X_DEBUG_DISAS_VERBOSE) { \ + qemu_log(__VA_ARGS__); \ + } \ + G_STMT_END #include "cpu.h" #include "disas/disas.h" @@ -4859,13 +4859,11 @@ static inline void gen_intermediate_code_internal(CPUS390XState *env, tb->icount = num_insns; } -#if defined(S390X_DEBUG_DISAS) - if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { + if (S390X_DEBUG_DISAS && qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("IN: %s\n", lookup_symbol(pc_start)); log_target_disas(env, pc_start, dc.pc - pc_start, 1); qemu_log("\n"); } -#endif } void gen_intermediate_code (CPUS390XState *env, struct TranslationBlock *tb)