aboutsummaryrefslogtreecommitdiff
path: root/sim/common
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
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')
-rw-r--r--sim/common/ChangeLog7
-rw-r--r--sim/common/sim-trace.h21
2 files changed, 28 insertions, 0 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 403ba0f..bb26a2f 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,5 +1,12 @@
2015-06-12 Mike Frysinger <vapier@gentoo.org>
+ * sim-trace.h (TRACE, TRACE_INSN, TRACE_DECODE, TRACE_EXTRACT,
+ TRACE_LINENUM, TRACE_MEMORY, TRACE_MODEL, TRACE_ALU, TRACE_CORE,
+ TRACE_EVENTS, TRACE_FPU, TRACE_VPU, TRACE_BRANCH, TRACE_SYSCALL,
+ TRACE_DEBUG): Define.
+
+2015-06-12 Mike Frysinger <vapier@gentoo.org>
+
* sim-module.c (modules): Change WITH_TRACE to WITH_TRACE_ANY_P.
* sim-trace.c (trace_option_handler): Likewise.
* sim-trace.h (WITH_TRACE_ANY_P): Define.
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. */