sim: add syscall tracing level
It's useful to be able to trace just the system calls the simulated program is calling, so add a new --trace-syscall option for ports to leverage if they choose. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
parent
39f8b7c1fa
commit
3a49ea9fac
3 changed files with 30 additions and 1 deletions
|
@ -1,3 +1,14 @@
|
||||||
|
2011-05-25 Mike Frysinger <vapier@gentoo.org>
|
||||||
|
|
||||||
|
* sim-trace.c (OPTION_TRACE_SYSCALL): New enum.
|
||||||
|
(trace_options): Handle "trace-syscall" with OPTION_TRACE_SYSCALL.
|
||||||
|
(trace_option_handler): Handle OPTION_TRACE_SYSCALL.
|
||||||
|
(trace_idx_to_str): Likewise.
|
||||||
|
* sim-trace.h (TRACE_SYSCALL_IDX): New enum.
|
||||||
|
(TRACE_syscall): Define.
|
||||||
|
(WITH_TRACE_SYSCALL_P): Likewise.
|
||||||
|
(TRACE_SYSCALL_P): Likewise.
|
||||||
|
|
||||||
2011-05-23 Mike Frysinger <vapier@gentoo.org>
|
2011-05-23 Mike Frysinger <vapier@gentoo.org>
|
||||||
|
|
||||||
* dv-glue.c (hw_glue_finish): Move "name" to function scope and
|
* dv-glue.c (hw_glue_finish): Move "name" to function scope and
|
||||||
|
|
|
@ -77,7 +77,8 @@ enum {
|
||||||
OPTION_TRACE_FUNCTION,
|
OPTION_TRACE_FUNCTION,
|
||||||
OPTION_TRACE_DEBUG,
|
OPTION_TRACE_DEBUG,
|
||||||
OPTION_TRACE_FILE,
|
OPTION_TRACE_FILE,
|
||||||
OPTION_TRACE_VPU
|
OPTION_TRACE_VPU,
|
||||||
|
OPTION_TRACE_SYSCALL
|
||||||
};
|
};
|
||||||
|
|
||||||
static const OPTION trace_options[] =
|
static const OPTION trace_options[] =
|
||||||
|
@ -125,6 +126,9 @@ static const OPTION trace_options[] =
|
||||||
{ {"trace-events", optional_argument, NULL, OPTION_TRACE_EVENTS},
|
{ {"trace-events", optional_argument, NULL, OPTION_TRACE_EVENTS},
|
||||||
'\0', "on|off", "Trace events",
|
'\0', "on|off", "Trace events",
|
||||||
trace_option_handler, NULL },
|
trace_option_handler, NULL },
|
||||||
|
{ {"trace-syscall", optional_argument, NULL, OPTION_TRACE_SYSCALL},
|
||||||
|
'\0', "on|off", "Trace system calls",
|
||||||
|
trace_option_handler, NULL },
|
||||||
#ifdef SIM_HAVE_ADDR_RANGE
|
#ifdef SIM_HAVE_ADDR_RANGE
|
||||||
{ {"trace-range", required_argument, NULL, OPTION_TRACE_RANGE},
|
{ {"trace-range", required_argument, NULL, OPTION_TRACE_RANGE},
|
||||||
'\0', "START,END", "Specify range of addresses for instruction tracing",
|
'\0', "START,END", "Specify range of addresses for instruction tracing",
|
||||||
|
@ -331,6 +335,13 @@ trace_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt,
|
||||||
sim_io_eprintf (sd, "Branch tracing not compiled in, `--trace-branch' ignored\n");
|
sim_io_eprintf (sd, "Branch tracing not compiled in, `--trace-branch' ignored\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case OPTION_TRACE_SYSCALL :
|
||||||
|
if (WITH_TRACE_SYSCALL_P)
|
||||||
|
return set_trace_option (sd, "-syscall", TRACE_SYSCALL_IDX, arg);
|
||||||
|
else
|
||||||
|
sim_io_eprintf (sd, "System call tracing not compiled in, `--trace-syscall' ignored\n");
|
||||||
|
break;
|
||||||
|
|
||||||
case OPTION_TRACE_SEMANTICS :
|
case OPTION_TRACE_SEMANTICS :
|
||||||
if (WITH_TRACE_ALU_P
|
if (WITH_TRACE_ALU_P
|
||||||
&& WITH_TRACE_FPU_P
|
&& WITH_TRACE_FPU_P
|
||||||
|
@ -621,6 +632,7 @@ trace_idx_to_str (int trace_idx)
|
||||||
case TRACE_EVENTS_IDX: return "events: ";
|
case TRACE_EVENTS_IDX: return "events: ";
|
||||||
case TRACE_FPU_IDX: return "fpu: ";
|
case TRACE_FPU_IDX: return "fpu: ";
|
||||||
case TRACE_BRANCH_IDX: return "branch: ";
|
case TRACE_BRANCH_IDX: return "branch: ";
|
||||||
|
case TRACE_SYSCALL_IDX: return "syscall: ";
|
||||||
case TRACE_VPU_IDX: return "vpu: ";
|
case TRACE_VPU_IDX: return "vpu: ";
|
||||||
default:
|
default:
|
||||||
sprintf (num, "?%d?", trace_idx);
|
sprintf (num, "?%d?", trace_idx);
|
||||||
|
|
|
@ -69,6 +69,9 @@ enum {
|
||||||
/* Trace branching. */
|
/* Trace branching. */
|
||||||
TRACE_BRANCH_IDX,
|
TRACE_BRANCH_IDX,
|
||||||
|
|
||||||
|
/* Trace syscalls. */
|
||||||
|
TRACE_SYSCALL_IDX,
|
||||||
|
|
||||||
/* Add information useful for debugging the simulator to trace output. */
|
/* Add information useful for debugging the simulator to trace output. */
|
||||||
TRACE_DEBUG_IDX,
|
TRACE_DEBUG_IDX,
|
||||||
|
|
||||||
|
@ -105,6 +108,7 @@ enum {
|
||||||
#define TRACE_fpu (1 << TRACE_FPU_IDX)
|
#define TRACE_fpu (1 << TRACE_FPU_IDX)
|
||||||
#define TRACE_vpu (1 << TRACE_VPU_IDX)
|
#define TRACE_vpu (1 << TRACE_VPU_IDX)
|
||||||
#define TRACE_branch (1 << TRACE_BRANCH_IDX)
|
#define TRACE_branch (1 << TRACE_BRANCH_IDX)
|
||||||
|
#define TRACE_syscall (1 << TRACE_SYSCALL_IDX)
|
||||||
#define TRACE_debug (1 << TRACE_DEBUG_IDX)
|
#define TRACE_debug (1 << TRACE_DEBUG_IDX)
|
||||||
|
|
||||||
/* Preprocessor macros to simplify tests of WITH_TRACE. */
|
/* Preprocessor macros to simplify tests of WITH_TRACE. */
|
||||||
|
@ -120,6 +124,7 @@ enum {
|
||||||
#define WITH_TRACE_FPU_P (WITH_TRACE & TRACE_fpu)
|
#define WITH_TRACE_FPU_P (WITH_TRACE & TRACE_fpu)
|
||||||
#define WITH_TRACE_VPU_P (WITH_TRACE & TRACE_vpu)
|
#define WITH_TRACE_VPU_P (WITH_TRACE & TRACE_vpu)
|
||||||
#define WITH_TRACE_BRANCH_P (WITH_TRACE & TRACE_branch)
|
#define WITH_TRACE_BRANCH_P (WITH_TRACE & TRACE_branch)
|
||||||
|
#define WITH_TRACE_SYSCALL_P (WITH_TRACE & TRACE_syscall)
|
||||||
#define WITH_TRACE_DEBUG_P (WITH_TRACE & TRACE_debug)
|
#define WITH_TRACE_DEBUG_P (WITH_TRACE & TRACE_debug)
|
||||||
|
|
||||||
/* Tracing install handler. */
|
/* Tracing install handler. */
|
||||||
|
@ -217,6 +222,7 @@ typedef struct _trace_data {
|
||||||
#define TRACE_FPU_P(cpu) TRACE_P (cpu, TRACE_FPU_IDX)
|
#define TRACE_FPU_P(cpu) TRACE_P (cpu, TRACE_FPU_IDX)
|
||||||
#define TRACE_VPU_P(cpu) TRACE_P (cpu, TRACE_VPU_IDX)
|
#define TRACE_VPU_P(cpu) TRACE_P (cpu, TRACE_VPU_IDX)
|
||||||
#define TRACE_BRANCH_P(cpu) TRACE_P (cpu, TRACE_BRANCH_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_DEBUG_P(cpu) TRACE_P (cpu, TRACE_DEBUG_IDX)
|
#define TRACE_DEBUG_P(cpu) TRACE_P (cpu, TRACE_DEBUG_IDX)
|
||||||
|
|
||||||
/* Tracing functions. */
|
/* Tracing functions. */
|
||||||
|
|
Loading…
Reference in a new issue