From: Mike Frysinger Date: Tue, 23 Jun 2015 19:15:16 +0000 (+0545) Subject: sim: trace: add set of system helpers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cf304b56ca48631836bdc4035134b5b5ec3b9d49;p=binutils-gdb.git 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. --- diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 21a3fe31f45..63978bf6410 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,10 @@ +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, diff --git a/sim/common/sim-trace.h b/sim/common/sim-trace.h index 0fa44fff2a3..4ef2584151c 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. */