aboutsummaryrefslogtreecommitdiff
path: root/sim/common/sim-trace.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-06-24 19:37:21 +0545
committerMike Frysinger <vapier@gentoo.org>2015-06-24 10:40:17 -0400
commitfa8f87e53b68881c5e3aab296b517203407c4378 (patch)
tree6eb1f8996ae765cd81589f6c8e8f318ee92a673b /sim/common/sim-trace.c
parentcf304b56ca48631836bdc4035134b5b5ec3b9d49 (diff)
downloadgdb-fa8f87e53b68881c5e3aab296b517203407c4378.zip
gdb-fa8f87e53b68881c5e3aab296b517203407c4378.tar.gz
gdb-fa8f87e53b68881c5e3aab296b517203407c4378.tar.bz2
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.
Diffstat (limited to 'sim/common/sim-trace.c')
-rw-r--r--sim/common/sim-trace.c36
1 files changed, 24 insertions, 12 deletions
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;