aboutsummaryrefslogtreecommitdiff
path: root/sim/common/sim-trace.h
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-06-11 18:28:25 +0800
committerMike Frysinger <vapier@gentoo.org>2015-06-12 06:34:20 -0400
commitbb11f3ed2bd9eeddca84cc3a80c3643ddae517f3 (patch)
tree12dba53f4b4234217584f24d345980060c93271a /sim/common/sim-trace.h
parent29bc024d07fe480cd37f36097f23d5585b15e71c (diff)
downloadgdb-bb11f3ed2bd9eeddca84cc3a80c3643ddae517f3.zip
gdb-bb11f3ed2bd9eeddca84cc3a80c3643ddae517f3.tar.gz
gdb-bb11f3ed2bd9eeddca84cc3a80c3643ddae517f3.tar.bz2
sim: trace: add common macros for logging info
The Blackfin port had some TRACE_xxx macros for easily logging trace data. Use these as a base for common ones that have a simple form and match the existing sets of helper macros.
Diffstat (limited to 'sim/common/sim-trace.h')
-rw-r--r--sim/common/sim-trace.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/sim/common/sim-trace.h b/sim/common/sim-trace.h
index 822940b..c5a04c1 100644
--- a/sim/common/sim-trace.h
+++ b/sim/common/sim-trace.h
@@ -236,6 +236,27 @@ typedef struct _trace_data {
#define TRACE_BRANCH_P(cpu) TRACE_P (cpu, TRACE_BRANCH_IDX)
#define TRACE_SYSCALL_P(cpu) TRACE_P (cpu, TRACE_SYSCALL_IDX)
#define TRACE_DEBUG_P(cpu) TRACE_P (cpu, TRACE_DEBUG_IDX)
+
+/* Helper functions for printing messages. */
+#define TRACE(cpu, idx, fmt, args...) \
+ do { \
+ if (TRACE_P (cpu, idx)) \
+ trace_generic (CPU_STATE (cpu), cpu, idx, fmt, ## args); \
+ } while (0)
+#define TRACE_INSN(cpu, fmt, args...) TRACE (cpu, TRACE_INSN_IDX, fmt, ## args)
+#define TRACE_DECODE(cpu, fmt, args...) TRACE (cpu, TRACE_DECODE_IDX, fmt, ## args)
+#define TRACE_EXTRACT(cpu, fmt, args...) TRACE (cpu, TRACE_EXTRACT_IDX, fmt, ## args)
+#define TRACE_LINENUM(cpu, fmt, args...) TRACE (cpu, TRACE_LINENUM_IDX, fmt, ## args)
+#define TRACE_MEMORY(cpu, fmt, args...) TRACE (cpu, TRACE_MEMORY_IDX, fmt, ## args)
+#define TRACE_MODEL(cpu, fmt, args...) TRACE (cpu, TRACE_MODEL_IDX, fmt, ## args)
+#define TRACE_ALU(cpu, fmt, args...) TRACE (cpu, TRACE_ALU_IDX, fmt, ## args)
+#define TRACE_CORE(cpu, fmt, args...) TRACE (cpu, TRACE_CORE_IDX, fmt, ## args)
+#define TRACE_EVENTS(cpu, fmt, args...) TRACE (cpu, TRACE_EVENTS_IDX, fmt, ## args)
+#define TRACE_FPU(cpu, fmt, args...) TRACE (cpu, TRACE_FPU_IDX, fmt, ## args)
+#define TRACE_VPU(cpu, fmt, args...) TRACE (cpu, TRACE_VPU_IDX, fmt, ## args)
+#define TRACE_BRANCH(cpu, fmt, args...) TRACE (cpu, TRACE_BRANCH_IDX, fmt, ## args)
+#define TRACE_SYSCALL(cpu, fmt, args...) TRACE (cpu, TRACE_SYSCALL_IDX, fmt, ## args)
+#define TRACE_DEBUG(cpu, fmt, args...) TRACE (cpu, TRACE_DEBUG_IDX, fmt, ## args)
/* Tracing functions. */