/* Simulator tracing/debugging support.
- Copyright (C) 1997, 1998, 2001, 2007, 2008, 2009, 2010
- Free Software Foundation, Inc.
+ Copyright (C) 1997-1998, 2001, 2007-2012 Free Software Foundation,
+ Inc.
Contributed by Cygnus Support.
This file is part of GDB, the GNU debugger.
OPTION_TRACE_FUNCTION,
OPTION_TRACE_DEBUG,
OPTION_TRACE_FILE,
- OPTION_TRACE_VPU
+ OPTION_TRACE_VPU,
+ OPTION_TRACE_SYSCALL
};
static const OPTION trace_options[] =
/* This table is organized to group related instructions together. */
{ {"trace", optional_argument, NULL, 't'},
't', "on|off", "Trace useful things",
- trace_option_handler },
+ trace_option_handler, NULL },
{ {"trace-insn", optional_argument, NULL, OPTION_TRACE_INSN},
'\0', "on|off", "Perform instruction tracing",
- trace_option_handler },
+ trace_option_handler, NULL },
{ {"trace-decode", optional_argument, NULL, OPTION_TRACE_DECODE},
'\0', "on|off", "Trace instruction decoding",
- trace_option_handler },
+ trace_option_handler, NULL },
{ {"trace-extract", optional_argument, NULL, OPTION_TRACE_EXTRACT},
'\0', "on|off", "Trace instruction extraction",
- trace_option_handler },
+ trace_option_handler, NULL },
{ {"trace-linenum", optional_argument, NULL, OPTION_TRACE_LINENUM},
'\0', "on|off", "Perform line number tracing (implies --trace-insn)",
- trace_option_handler },
+ trace_option_handler, NULL },
{ {"trace-memory", optional_argument, NULL, OPTION_TRACE_MEMORY},
'\0', "on|off", "Trace memory operations",
- trace_option_handler },
+ trace_option_handler, NULL },
{ {"trace-alu", optional_argument, NULL, OPTION_TRACE_ALU},
'\0', "on|off", "Trace ALU operations",
- trace_option_handler },
+ trace_option_handler, NULL },
{ {"trace-fpu", optional_argument, NULL, OPTION_TRACE_FPU},
'\0', "on|off", "Trace FPU operations",
- trace_option_handler },
+ trace_option_handler, NULL },
{ {"trace-vpu", optional_argument, NULL, OPTION_TRACE_VPU},
'\0', "on|off", "Trace VPU operations",
- trace_option_handler },
+ trace_option_handler, NULL },
{ {"trace-branch", optional_argument, NULL, OPTION_TRACE_BRANCH},
'\0', "on|off", "Trace branching",
- trace_option_handler },
+ trace_option_handler, NULL },
{ {"trace-semantics", optional_argument, NULL, OPTION_TRACE_SEMANTICS},
'\0', "on|off", "Perform ALU, FPU, MEMORY, and BRANCH tracing",
- trace_option_handler },
+ trace_option_handler, NULL },
{ {"trace-model", optional_argument, NULL, OPTION_TRACE_MODEL},
'\0', "on|off", "Include model performance data",
- trace_option_handler },
+ trace_option_handler, NULL },
{ {"trace-core", optional_argument, NULL, OPTION_TRACE_CORE},
'\0', "on|off", "Trace core operations",
- trace_option_handler },
+ trace_option_handler, NULL },
{ {"trace-events", optional_argument, NULL, OPTION_TRACE_EVENTS},
'\0', "on|off", "Trace events",
- trace_option_handler },
+ 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
{ {"trace-range", required_argument, NULL, OPTION_TRACE_RANGE},
'\0', "START,END", "Specify range of addresses for instruction tracing",
- trace_option_handler },
+ trace_option_handler, NULL },
#if 0 /*wip*/
{ {"trace-function", required_argument, NULL, OPTION_TRACE_FUNCTION},
'\0', "FUNCTION", "Specify function to trace",
- trace_option_handler },
+ trace_option_handler, NULL },
#endif
#endif
{ {"trace-debug", optional_argument, NULL, OPTION_TRACE_DEBUG},
'\0', "on|off", "Add information useful for debugging the simulator to the tracing output",
- trace_option_handler },
+ trace_option_handler, NULL },
{ {"trace-file", required_argument, NULL, OPTION_TRACE_FILE},
'\0', "FILE NAME", "Specify tracing output file",
- trace_option_handler },
- { {NULL, no_argument, NULL, 0}, '\0', NULL, NULL, NULL }
+ trace_option_handler, NULL },
+ { {NULL, no_argument, NULL, 0}, '\0', NULL, NULL, NULL, NULL }
};
/* Set/reset the trace options indicated in MASK. */
}
}
}
- }
+ }
return SIM_RC_OK;
}
char *arg, int is_command)
{
int n;
- int cpu_nr;
switch (opt)
{
sim_io_eprintf (sd, "Branch tracing not compiled in, `--trace-branch' ignored\n");
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 :
if (WITH_TRACE_ALU_P
&& WITH_TRACE_FPU_P
case OPTION_TRACE_RANGE :
if (WITH_TRACE)
{
+ int cpu_nr;
char *chp = arg;
unsigned long start,end;
start = strtoul (chp, &chp, 0);
TRACE_DATA *data,
data_fmt fmt,
long size,
- void *buf)
+ const void *buf)
{
int i = TRACE_INPUT_IDX (data);
if (i == sizeof (TRACE_INPUT_FMT (data)))
abort ();
}
}
-
+
static const char *
trace_idx_to_str (int trace_idx)
{
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: ";
default:
sprintf (num, "?%d?", trace_idx);
save_data (sd, data, trace_fmt_word, sizeof (unsigned_word), &r0);
trace_results (sd, cpu, trace_idx, last_input);
-}
+}
void
trace_result0 (SIM_DESC sd,
last_input = TRACE_INPUT_IDX (data);
trace_results (sd, cpu, trace_idx, last_input);
-}
+}
void
trace_result_word2 (SIM_DESC sd,
save_data (sd, data, trace_fmt_word, sizeof (r1), &r1);
trace_results (sd, cpu, trace_idx, last_input);
-}
+}
void
trace_result_word4 (SIM_DESC sd,
save_data (sd, data, trace_fmt_word, sizeof (r3), &r3);
trace_results (sd, cpu, trace_idx, last_input);
-}
+}
void
trace_result_bool1 (SIM_DESC sd,
save_data (sd, data, trace_fmt_bool, sizeof (r0), &r0);
trace_results (sd, cpu, trace_idx, last_input);
-}
+}
void
trace_result_addr1 (SIM_DESC sd,
save_data (sd, data, trace_fmt_addr, sizeof (r0), &r0);
trace_results (sd, cpu, trace_idx, last_input);
-}
+}
void
trace_result_fp1 (SIM_DESC sd,
save_data (sd, data, trace_fmt_fp, sizeof (fp_word), &f0);
trace_results (sd, cpu, trace_idx, last_input);
-}
+}
void
trace_result_fp2 (SIM_DESC sd,
save_data (sd, data, trace_fmt_fp, sizeof (f1), &f1);
trace_results (sd, cpu, trace_idx, last_input);
-}
+}
void
trace_result_fpu1 (SIM_DESC sd,
save_data (sd, data, trace_fmt_fp, sizeof (double), &d);
trace_results (sd, cpu, trace_idx, last_input);
-}
+}
void
trace_result_string1 (SIM_DESC sd,
save_data (sd, data, trace_fmt_string, strlen (s0) + 1, s0);
trace_results (sd, cpu, trace_idx, last_input);
-}
+}
void
trace_result_word1_string1 (SIM_DESC sd,
save_data (sd, data, trace_fmt_string, strlen (s0) + 1, s0);
trace_results (sd, cpu, trace_idx, last_input);
-}
+}
\f
void
trace_vprintf (SIM_DESC sd, sim_cpu *cpu, const char *fmt, va_list ap)