+2015-06-24 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c (trace_register): Delete.
+ * sim-main.h (trace_register, TRACE_REGISTER, TRACE_REG): Delete.
+
2015-06-23 Mike Frysinger <vapier@gentoo.org>
* configure: Regenerate.
TRACE_SYSCALL (cpu, "%s", _tbuf);
}
-void
-trace_register (SIM_DESC sd,
- sim_cpu *cpu,
- const char *fmt,
- ...)
-{
- va_list ap;
- trace_printf (sd, cpu, "%s %s",
- "reg: ",
- TRACE_PREFIX (CPU_TRACE_DATA (cpu)));
- va_start (ap, fmt);
- trace_vprintf (sd, cpu, fmt, ap);
- va_end (ap);
- trace_printf (sd, cpu, "\n");
-}
-
/* Execute a single instruction. */
static sim_cia
bfin_trace_queue (cpu, oldpc, newpc, hwloop); \
} while (0)
-extern void trace_register (SIM_DESC sd,
- sim_cpu *cpu,
- const char *fmt,
- ...)
- __attribute__((format (printf, 3, 4)));
-#define TRACE_REGISTER(cpu, fmt, ...) \
- do { \
- if (TRACE_CORE_P (cpu)) \
- trace_register (CPU_STATE (cpu), cpu, fmt, ## __VA_ARGS__); \
- } while (0)
-#define TRACE_REG(cpu, reg, val) TRACE_REGISTER (cpu, "wrote "#reg" = %#x", val)
-
/* Default memory size. */
#define BFIN_DEFAULT_MEM_SIZE (128 * 1024 * 1024)
2015-06-24 Mike Frysinger <vapier@gentoo.org>
+ * sim-trace.c (OPTION_TRACE_REGISTER): New enum.
+ (trace_options): Add trace-register option.
+ (trace_option_handler): Handle OPTION_TRACE_REGISTER case.
+ (trace_idx_to_str): Handle TRACE_REGISTER_IDX case and re-indent.
+ * sim-trace.h (TRACE_REGISTER_IDX): New enum.
+ (TRACE_register, WITH_TRACE_REGISTER_P, STRACE_REGISTER_P,
+ TRACE_REGISTER_P, TRACE_REGISTER): Define.
+
+2015-06-24 Mike Frysinger <vapier@gentoo.org>
+
* 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,
OPTION_TRACE_DEBUG,
OPTION_TRACE_FILE,
OPTION_TRACE_VPU,
- OPTION_TRACE_SYSCALL
+ OPTION_TRACE_SYSCALL,
+ OPTION_TRACE_REGISTER
};
static const OPTION trace_options[] =
{ {"trace-syscall", optional_argument, NULL, OPTION_TRACE_SYSCALL},
'\0', "on|off", "Trace system calls",
trace_option_handler, NULL },
+ { {"trace-register", optional_argument, NULL, OPTION_TRACE_REGISTER},
+ '\0', "on|off", "Trace cpu register accesses",
+ trace_option_handler, NULL },
#ifdef SIM_HAVE_ADDR_RANGE
{ {"trace-range", required_argument, NULL, OPTION_TRACE_RANGE},
'\0', "START,END", "Specify range of addresses for instruction tracing",
sim_io_eprintf (sd, "System call tracing not compiled in, `--trace-syscall' ignored\n");
break;
+ case OPTION_TRACE_REGISTER :
+ if (WITH_TRACE_REGISTER_P)
+ return set_trace_option (sd, "-register", TRACE_REGISTER_IDX, arg);
+ else
+ sim_io_eprintf (sd, "Register tracing not compiled in, `--trace-register' ignored\n");
+ break;
+
case OPTION_TRACE_SEMANTICS :
if (WITH_TRACE_ALU_P
&& WITH_TRACE_FPU_P
static char num[8];
switch (trace_idx)
{
- case TRACE_ALU_IDX: return "alu: ";
- case TRACE_INSN_IDX: return "insn: ";
- case TRACE_DECODE_IDX: return "decode: ";
- case TRACE_EXTRACT_IDX: return "extract: ";
- case TRACE_MEMORY_IDX: return "memory: ";
- case TRACE_CORE_IDX: return "core: ";
- case TRACE_EVENTS_IDX: return "events: ";
- case TRACE_FPU_IDX: return "fpu: ";
- case TRACE_BRANCH_IDX: return "branch: ";
- case TRACE_SYSCALL_IDX: return "syscall: ";
- case TRACE_VPU_IDX: return "vpu: ";
+ case TRACE_ALU_IDX: return "alu: ";
+ case TRACE_INSN_IDX: return "insn: ";
+ case TRACE_DECODE_IDX: return "decode: ";
+ case TRACE_EXTRACT_IDX: return "extract: ";
+ case TRACE_MEMORY_IDX: return "memory: ";
+ case TRACE_CORE_IDX: return "core: ";
+ case TRACE_EVENTS_IDX: return "events: ";
+ case TRACE_FPU_IDX: return "fpu: ";
+ case TRACE_BRANCH_IDX: return "branch: ";
+ case TRACE_SYSCALL_IDX: return "syscall: ";
+ case TRACE_REGISTER_IDX: return "reg: ";
+ case TRACE_VPU_IDX: return "vpu: ";
default:
sprintf (num, "?%d?", trace_idx);
return num;
/* Trace syscalls. */
TRACE_SYSCALL_IDX,
+ /* Trace cpu register accesses. Registers that are part of hardware devices
+ should use the HW_TRACE macros instead. */
+ TRACE_REGISTER_IDX,
+
/* Add information useful for debugging the simulator to trace output. */
TRACE_DEBUG_IDX,
#define TRACE_vpu (1 << TRACE_VPU_IDX)
#define TRACE_branch (1 << TRACE_BRANCH_IDX)
#define TRACE_syscall (1 << TRACE_SYSCALL_IDX)
+#define TRACE_register (1 << TRACE_REGISTER_IDX)
#define TRACE_debug (1 << TRACE_DEBUG_IDX)
/* Return non-zero if tracing of idx is enabled (compiled in). */
#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_REGISTER_P WITH_TRACE_P (TRACE_REGISTER_IDX)
#define WITH_TRACE_DEBUG_P WITH_TRACE_P (TRACE_DEBUG_IDX)
/* Tracing install handler. */
#define STRACE_VPU_P(sd) STRACE_P (sd, TRACE_VPU_IDX)
#define STRACE_BRANCH_P(sd) STRACE_P (sd, TRACE_BRANCH_IDX)
#define STRACE_SYSCALL_P(sd) STRACE_P (sd, TRACE_SYSCALL_IDX)
+#define STRACE_REGISTER_P(sd) STRACE_P (sd, TRACE_REGISTER_IDX)
#define STRACE_DEBUG_P(sd) STRACE_P (sd, TRACE_DEBUG_IDX)
/* Helper functions for printing messages. */
#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_REGISTER(sd, fmt, args...) STRACE (sd, TRACE_REGISTER_IDX, fmt, ## args)
#define STRACE_DEBUG(sd, fmt, args...) STRACE (sd, TRACE_DEBUG_IDX, fmt, ## args)
\f
/* CPU tracing support. */
#define TRACE_VPU_P(cpu) TRACE_P (cpu, TRACE_VPU_IDX)
#define TRACE_BRANCH_P(cpu) TRACE_P (cpu, TRACE_BRANCH_IDX)
#define TRACE_SYSCALL_P(cpu) TRACE_P (cpu, TRACE_SYSCALL_IDX)
+#define TRACE_REGISTER_P(cpu) TRACE_P (cpu, TRACE_REGISTER_IDX)
#define TRACE_DEBUG_P(cpu) TRACE_P (cpu, TRACE_DEBUG_IDX)
/* Helper functions for printing messages. */
#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_REGISTER(cpu, fmt, args...) TRACE (cpu, TRACE_REGISTER_IDX, fmt, ## args)
#define TRACE_DEBUG(cpu, fmt, args...) TRACE (cpu, TRACE_DEBUG_IDX, fmt, ## args)
\f
/* Tracing functions. */
+2015-06-24 Mike Frysinger <vapier@gentoo.org>
+
+ * msp430-sim.c (trace_reg_put): Change TRACE_VPU to TRACE_REGISTER.
+ (trace_reg_get): Likewise.
+
2015-06-23 Mike Frysinger <vapier@gentoo.org>
* configure: Regenerate.
static void
trace_reg_put (SIM_DESC sd, int n, unsigned int v)
{
- TRACE_VPU (MSP430_CPU (sd), "PUT: %#x -> %s", v, register_names[n]);
+ TRACE_REGISTER (MSP430_CPU (sd), "PUT: %#x -> %s", v, register_names[n]);
REG (n) = v;
}
static unsigned int
trace_reg_get (SIM_DESC sd, int n)
{
- TRACE_VPU (MSP430_CPU (sd), "GET: %s -> %#x", register_names[n], REG (n));
+ TRACE_REGISTER (MSP430_CPU (sd), "GET: %s -> %#x", register_names[n], REG (n));
return REG (n);
}