From fa8f87e53b68881c5e3aab296b517203407c4378 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 24 Jun 2015 19:37:21 +0545 Subject: sim: trace: add a basic cpu register class The bfin/msp430 ports already had trace logic set up for reading/writing cpu registers, albeit using different unrelated levels (core & vpu). Add a proper register class for these and for other ports. --- sim/common/sim-trace.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'sim/common/sim-trace.c') diff --git a/sim/common/sim-trace.c b/sim/common/sim-trace.c index 1693a6e..6e11cce 100644 --- a/sim/common/sim-trace.c +++ b/sim/common/sim-trace.c @@ -77,7 +77,8 @@ enum { OPTION_TRACE_DEBUG, OPTION_TRACE_FILE, OPTION_TRACE_VPU, - OPTION_TRACE_SYSCALL + OPTION_TRACE_SYSCALL, + OPTION_TRACE_REGISTER }; static const OPTION trace_options[] = @@ -128,6 +129,9 @@ 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", @@ -333,6 +337,13 @@ trace_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt, 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 @@ -603,17 +614,18 @@ trace_idx_to_str (int trace_idx) 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; -- cgit v1.1