From cf304b56ca48631836bdc4035134b5b5ec3b9d49 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 24 Jun 2015 01:00:16 +0545 Subject: sim: trace: add set of system helpers Some code paths trace on a system instance and not a cpu instance (like the events code), so add some helpers for those cases. --- sim/common/ChangeLog | 7 +++++++ sim/common/sim-trace.h | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+) (limited to 'sim/common') diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 21a3fe3..63978bf 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,5 +1,12 @@ 2015-06-24 Mike Frysinger + * sim-trace.h (STRACE, STRACE_INSN, STRACE_DECODE, STRACE_EXTRACT, + STRACE_LINENUM, STRACE_MEMORY, STRACE_MODEL, STRACE_ALU, STRACE_CORE, + STRACE_EVENTS, STRACE_FPU, STRACE_VPU, STRACE_BRANCH, STRACE_SYSCALL, + STRACE_DEBUG): Define. + +2015-06-24 Mike Frysinger + * sim-trace.c (trace_options): Update help text for trace-alu, trace-fpu, trace-vpu, and trace-semantics. * sim-trace.h (TRACE_ALU_IDX): Update comment text. diff --git a/sim/common/sim-trace.h b/sim/common/sim-trace.h index 0fa44ff..4ef2584 100644 --- a/sim/common/sim-trace.h +++ b/sim/common/sim-trace.h @@ -211,6 +211,27 @@ typedef struct _trace_data { #define STRACE_BRANCH_P(sd) STRACE_P (sd, TRACE_BRANCH_IDX) #define STRACE_SYSCALL_P(sd) STRACE_P (sd, TRACE_SYSCALL_IDX) #define STRACE_DEBUG_P(sd) STRACE_P (sd, TRACE_DEBUG_IDX) + +/* Helper functions for printing messages. */ +#define STRACE(sd, idx, fmt, args...) \ + do { \ + if (STRACE_P (sd, idx)) \ + trace_generic (sd, NULL, idx, fmt, ## args); \ + } while (0) +#define STRACE_INSN(sd, fmt, args...) STRACE (sd, TRACE_INSN_IDX, fmt, ## args) +#define STRACE_DECODE(sd, fmt, args...) STRACE (sd, TRACE_DECODE_IDX, fmt, ## args) +#define STRACE_EXTRACT(sd, fmt, args...) STRACE (sd, TRACE_EXTRACT_IDX, fmt, ## args) +#define STRACE_LINENUM(sd, fmt, args...) STRACE (sd, TRACE_LINENUM_IDX, fmt, ## args) +#define STRACE_MEMORY(sd, fmt, args...) STRACE (sd, TRACE_MEMORY_IDX, fmt, ## args) +#define STRACE_MODEL(sd, fmt, args...) STRACE (sd, TRACE_MODEL_IDX, fmt, ## args) +#define STRACE_ALU(sd, fmt, args...) STRACE (sd, TRACE_ALU_IDX, fmt, ## args) +#define STRACE_CORE(sd, fmt, args...) STRACE (sd, TRACE_CORE_IDX, fmt, ## args) +#define STRACE_EVENTS(sd, fmt, args...) STRACE (sd, TRACE_EVENTS_IDX, fmt, ## args) +#define STRACE_FPU(sd, fmt, args...) STRACE (sd, TRACE_FPU_IDX, fmt, ## args) +#define STRACE_VPU(sd, fmt, args...) STRACE (sd, TRACE_VPU_IDX, fmt, ## args) +#define STRACE_BRANCH(sd, fmt, args...) STRACE (sd, TRACE_BRANCH_IDX, fmt, ## args) +#define STRACE_SYSCALL(sd, fmt, args...) STRACE (sd, TRACE_SYSCALL_IDX, fmt, ## args) +#define STRACE_DEBUG(sd, fmt, args...) STRACE (sd, TRACE_DEBUG_IDX, fmt, ## args) /* CPU tracing support. */ -- cgit v1.1