aboutsummaryrefslogtreecommitdiff
path: root/sim/common/sim-trace.h
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-06-10 15:58:03 +0800
committerMike Frysinger <vapier@gentoo.org>2015-06-11 10:28:58 -0400
commit9b9c712cebc08f4242fdcf3b12c057f57bd1b589 (patch)
tree6bf34f0c606396ee9da95a03ccc99bb07db02635 /sim/common/sim-trace.h
parent66a19e2f815060e69d2e38f9319ed827fce67399 (diff)
downloadgdb-9b9c712cebc08f4242fdcf3b12c057f57bd1b589.zip
gdb-9b9c712cebc08f4242fdcf3b12c057f57bd1b589.tar.gz
gdb-9b9c712cebc08f4242fdcf3b12c057f57bd1b589.tar.bz2
sim: trace: create a common WITH_TRACE_P macro
This way we can use the IDX macros everywhere and not worry about the encoding of the WITH_TRACE define in multiple places.
Diffstat (limited to 'sim/common/sim-trace.h')
-rw-r--r--sim/common/sim-trace.h35
1 files changed, 17 insertions, 18 deletions
diff --git a/sim/common/sim-trace.h b/sim/common/sim-trace.h
index 3f78744..df995a6 100644
--- a/sim/common/sim-trace.h
+++ b/sim/common/sim-trace.h
@@ -111,20 +111,21 @@ enum {
#define TRACE_debug (1 << TRACE_DEBUG_IDX)
/* Preprocessor macros to simplify tests of WITH_TRACE. */
-#define WITH_TRACE_INSN_P (WITH_TRACE & TRACE_insn)
-#define WITH_TRACE_DECODE_P (WITH_TRACE & TRACE_decode)
-#define WITH_TRACE_EXTRACT_P (WITH_TRACE & TRACE_extract)
-#define WITH_TRACE_LINENUM_P (WITH_TRACE & TRACE_linenum)
-#define WITH_TRACE_MEMORY_P (WITH_TRACE & TRACE_memory)
-#define WITH_TRACE_MODEL_P (WITH_TRACE & TRACE_model)
-#define WITH_TRACE_ALU_P (WITH_TRACE & TRACE_alu)
-#define WITH_TRACE_CORE_P (WITH_TRACE & TRACE_core)
-#define WITH_TRACE_EVENTS_P (WITH_TRACE & TRACE_events)
-#define WITH_TRACE_FPU_P (WITH_TRACE & TRACE_fpu)
-#define WITH_TRACE_VPU_P (WITH_TRACE & TRACE_vpu)
-#define WITH_TRACE_BRANCH_P (WITH_TRACE & TRACE_branch)
-#define WITH_TRACE_SYSCALL_P (WITH_TRACE & TRACE_syscall)
-#define WITH_TRACE_DEBUG_P (WITH_TRACE & TRACE_debug)
+#define WITH_TRACE_P(idx) (WITH_TRACE & (1 << idx))
+#define WITH_TRACE_INSN_P WITH_TRACE_P (TRACE_INSN_IDX)
+#define WITH_TRACE_DECODE_P WITH_TRACE_P (TRACE_DECODE_IDX)
+#define WITH_TRACE_EXTRACT_P WITH_TRACE_P (TRACE_EXTRACT_IDX)
+#define WITH_TRACE_LINENUM_P WITH_TRACE_P (TRACE_LINENUM_IDX)
+#define WITH_TRACE_MEMORY_P WITH_TRACE_P (TRACE_MEMORY_IDX)
+#define WITH_TRACE_MODEL_P WITH_TRACE_P (TRACE_MODEL_IDX)
+#define WITH_TRACE_ALU_P WITH_TRACE_P (TRACE_ALU_IDX)
+#define WITH_TRACE_CORE_P WITH_TRACE_P (TRACE_CORE_IDX)
+#define WITH_TRACE_EVENTS_P WITH_TRACE_P (TRACE_EVENTS_IDX)
+#define WITH_TRACE_FPU_P WITH_TRACE_P (TRACE_FPU_IDX)
+#define WITH_TRACE_VPU_P WITH_TRACE_P (TRACE_VPU_IDX)
+#define WITH_TRACE_BRANCH_P WITH_TRACE_P (TRACE_BRANCH_IDX)
+#define WITH_TRACE_SYSCALL_P WITH_TRACE_P (TRACE_SYSCALL_IDX)
+#define WITH_TRACE_DEBUG_P WITH_TRACE_P (TRACE_DEBUG_IDX)
/* Tracing install handler. */
MODULE_INSTALL_FN trace_install;
@@ -192,8 +193,7 @@ typedef struct _trace_data {
/* Return non-zero if tracing of IDX is enabled for non-cpu specific
components. The "S" in "STRACE" refers to "System". */
#define STRACE_P(sd,idx) \
-((WITH_TRACE & (1 << (idx))) != 0 \
- && STATE_TRACE_FLAGS (sd)[idx] != 0)
+ (WITH_TRACE_P (idx) && STATE_TRACE_FLAGS (sd)[idx] != 0)
/* Non-zero if --trace-<xxxx> was specified for SD. */
#define STRACE_DEBUG_P(sd) STRACE_P (sd, TRACE_DEBUG_IDX)
@@ -204,8 +204,7 @@ typedef struct _trace_data {
/* Return non-zero if tracing of IDX is enabled for CPU. */
#define TRACE_P(cpu,idx) \
-((WITH_TRACE & (1 << (idx))) != 0 \
- && CPU_TRACE_FLAGS (cpu)[idx] != 0)
+ (WITH_TRACE_P (idx) && CPU_TRACE_FLAGS (cpu)[idx] != 0)
/* Non-zero if --trace-<xxxx> was specified for CPU. */
#define TRACE_ANY_P(cpu) ((WITH_TRACE) && (CPU_TRACE_DATA (cpu)->trace_any_p))