All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: peter.maydell@linaro.org, rth@twiddle.net, pbonzini@redhat.com
Cc: qemu-devel@nongnu.org, mttcg@listserver.greensocs.com,
	fred.konrad@greensocs.com, a.rigo@virtualopensystems.com,
	cota@braap.org, bobby.prani@gmail.com, nikunj@linux.vnet.ibm.com,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"open list:ARM cores" <qemu-arm@nongnu.org>
Subject: [Qemu-devel] [PATCH v2 11/11] hw/intc/arm_gic: modernise the DPRINTF
Date: Thu,  2 Mar 2017 19:53:37 +0000	[thread overview]
Message-ID: <20170302195337.31558-12-alex.bennee@linaro.org> (raw)
In-Reply-To: <20170302195337.31558-1-alex.bennee@linaro.org>

While I was debugging the icount issues I realised a bunch of the
messages look quite similar. I've fixed this by including __func__ in
the debug print. At the same time I move the a modern if (GATE) style
printf which ensures the compiler can check for format string errors
even if the code gets optimised away in the non-DEBUG_GIC case.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 hw/intc/arm_gic.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c
index 8e5a9d8a3e..b305d9032a 100644
--- a/hw/intc/arm_gic.c
+++ b/hw/intc/arm_gic.c
@@ -26,15 +26,20 @@
 #include "qemu/log.h"
 #include "trace.h"
 
-//#define DEBUG_GIC
+/* #define DEBUG_GIC */
 
 #ifdef DEBUG_GIC
-#define DPRINTF(fmt, ...) \
-do { fprintf(stderr, "arm_gic: " fmt , ## __VA_ARGS__); } while (0)
+#define DEBUG_GIC_GATE 1
 #else
-#define DPRINTF(fmt, ...) do {} while(0)
+#define DEBUG_GIC_GATE 0
 #endif
 
+#define DPRINTF(fmt, ...) do {                                          \
+        if (DEBUG_GIC_GATE) {                                           \
+            fprintf(stderr, "%s: " fmt, __func__, ## __VA_ARGS__);      \
+        }                                                               \
+    } while (0)
+
 static const uint8_t gic_id_11mpcore[] = {
     0x00, 0x00, 0x00, 0x00, 0x90, 0x13, 0x04, 0x00, 0x0d, 0xf0, 0x05, 0xb1
 };
-- 
2.11.0

  parent reply	other threads:[~2017-03-02 19:53 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-02 19:53 [Qemu-devel] [PATCH v2 00/11] MTTCG fixups for 2.9 Alex Bennée
2017-03-02 19:53 ` [Qemu-devel] [PATCH v2 01/11] vl/cpus: be smarter with icount and MTTCG Alex Bennée
2017-03-02 19:53 ` [Qemu-devel] [PATCH v2 02/11] target/i386/cpu.h: declare TCG_GUEST_DEFAULT_MO Alex Bennée
2017-03-03 19:28   ` Eduardo Habkost
2017-03-02 19:53 ` [Qemu-devel] [PATCH v2 03/11] cpus.c: add additional error_report when !TARGET_SUPPORT_MTTCG Alex Bennée
2017-03-02 19:53 ` [Qemu-devel] [PATCH v2 04/11] translate: downgrade IRQ BQL asserts to tcg_debug_assert Alex Bennée
2017-03-03 10:08   ` Peter Maydell
2017-03-03 11:05     ` Alex Bennée
2017-03-03 11:19       ` Peter Maydell
2017-03-03 19:35         ` Richard Henderson
2017-03-03 19:47           ` Eric Blake
2017-03-03 19:48             ` Eric Blake
2017-03-03 11:49     ` Paolo Bonzini
2017-03-02 19:53 ` [Qemu-devel] [PATCH v2 05/11] translate-all: exit cpu_restore_state early if translating Alex Bennée
2017-03-02 21:46   ` Richard Henderson
2017-03-03 10:03     ` Alex Bennée
2017-03-03 19:50       ` Richard Henderson
2017-03-02 19:53 ` [Qemu-devel] [PATCH v2 06/11] sparc/sparc64: grab BQL before calling cpu_check_irqs Alex Bennée
2017-03-03 11:47   ` Paolo Bonzini
2017-03-06 10:28     ` Alex Bennée
2017-03-06 13:22       ` Paolo Bonzini
2017-03-02 19:53 ` [Qemu-devel] [PATCH v2 07/11] s390x/misc_helper.c: wrap IO instructions in BQL Alex Bennée
2017-03-02 19:53 ` [Qemu-devel] [PATCH v2 08/11] target/xtensa: hold BQL for interrupt processing Alex Bennée
2017-03-07  0:15   ` Max Filippov
2017-03-02 19:53 ` [Qemu-devel] [PATCH v2 09/11] target/mips/op_helper: hold BQL before calling cpu_mips_get_count Alex Bennée
2017-03-03 11:18   ` Yongbok Kim
2017-03-03 12:54     ` Alex Bennée
2017-03-03 13:00       ` Yongbok Kim
2017-03-02 19:53 ` [Qemu-devel] [PATCH v2 10/11] target/arm/helper: make it clear the EC field is also in hex Alex Bennée
2017-03-03 17:07   ` Frederic Konrad
2017-03-03 18:10   ` Peter Maydell
2017-03-02 19:53 ` Alex Bennée [this message]
2017-03-03 17:05   ` [Qemu-devel] [PATCH v2 11/11] hw/intc/arm_gic: modernise the DPRINTF Frederic Konrad
2017-03-03 17:09     ` Peter Maydell
2017-03-03 18:09   ` Peter Maydell
2017-03-03 17:38 ` [Qemu-devel] [PATCH v2 00/11] MTTCG fixups for 2.9 Frederic Konrad
2017-03-06  9:43   ` Alex Bennée
2017-03-06 10:45     ` Frederic Konrad

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170302195337.31558-12-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=a.rigo@virtualopensystems.com \
    --cc=bobby.prani@gmail.com \
    --cc=cota@braap.org \
    --cc=fred.konrad@greensocs.com \
    --cc=mttcg@listserver.greensocs.com \
    --cc=nikunj@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.