+Tue Feb 24 00:29:57 1998 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * sim-trace.c (print_data): case trace_fmt_fp missing break. Use
+ sim_fpu to safely print fp_word values.
+ (print_data): Add trace_fmt_bool and trace_fmt_addr.
+ (trace_result_bool1, trace_result_addr1): New functions.
+ (trace_input_bool1, trace_input_addr1): New functions.
+
+ * sim-trace.h (TRACE_FPU_*): Define.
+
Mon Feb 23 13:24:54 1998 Andrew Cagney <cagney@b1.cygnus.com>
* sim-fpu.h (enum sim_fpu_class): Add sim_fpu_class_denorm.
trace_fmt_fp,
trace_fmt_fpu,
trace_fmt_string,
+ trace_fmt_bool,
+ trace_fmt_addr,
trace_fmt_instruction_incomplete,
} data_fmt;
trace_printf (sd, cpu, " (instruction incomplete)");
break;
case trace_fmt_word:
- switch (size)
- {
- case sizeof (unsigned_word):
- trace_printf (sd, cpu, " 0x%08lx", (long) * (unsigned_word*) data);
- break;
- default:
- abort ();
- }
- break;
+ case trace_fmt_addr:
+ {
+ switch (size)
+ {
+ case sizeof (unsigned32):
+ trace_printf (sd, cpu, " 0x%08lx", (long) * (unsigned32*) data);
+ break;
+ case sizeof (unsigned64):
+ trace_printf (sd, cpu, " 0x%08lx", (long) * (unsigned64*) data);
+ break;
+ default:
+ abort ();
+ }
+ break;
+ }
+ case trace_fmt_bool:
+ {
+ SIM_ASSERT (size == sizeof (int));
+ trace_printf (sd, cpu, " %-8s",
+ (* (int*) data) ? "true" : "false");
+ break;
+ }
case trace_fmt_fp:
- switch (size)
- {
- /* FIXME: Assumes sizeof float == 4; sizeof double == 8 */
- case 4:
- trace_printf (sd, cpu, " %8g", * (float*) data);
- break;
- case 8:
- trace_printf (sd, cpu, " %8g", * (double*) data);
- break;
- default:
- abort ();
- }
+ {
+ sim_fpu fp;
+ switch (size)
+ {
+ /* FIXME: Assumes sizeof float == 4; sizeof double == 8 */
+ case 4:
+ sim_fpu_32to (&fp, * (unsigned32*) data);
+ break;
+ case 8:
+ sim_fpu_64to (&fp, * (unsigned32*) data);
+ break;
+ default:
+ abort ();
+ }
+ trace_printf (sd, cpu, " %8g", sim_fpu_2d (&fp));
+ break;
+ }
case trace_fmt_fpu:
/* FIXME: At present sim_fpu data is stored as a double */
trace_printf (sd, cpu, " %8g", * (double*) data);
save_data (sd, data, trace_fmt_word, sizeof (unsigned_word), &d2);
}
+void
+trace_input_bool1 (SIM_DESC sd,
+ sim_cpu *cpu,
+ int trace_idx,
+ int d0)
+{
+ TRACE_DATA *data = CPU_TRACE_DATA (cpu);
+ TRACE_IDX (data) = trace_idx;
+ save_data (sd, data, trace_fmt_bool, sizeof (d0), &d0);
+}
+
+void
+trace_input_addr1 (SIM_DESC sd,
+ sim_cpu *cpu,
+ int trace_idx,
+ address_word d0)
+{
+ TRACE_DATA *data = CPU_TRACE_DATA (cpu);
+ TRACE_IDX (data) = trace_idx;
+ save_data (sd, data, trace_fmt_addr, sizeof (d0), &d0);
+}
+
void
trace_input_fp1 (SIM_DESC sd,
sim_cpu *cpu,
trace_results (sd, cpu, trace_idx, last_input);
}
+void
+trace_result_bool1 (SIM_DESC sd,
+ sim_cpu *cpu,
+ int trace_idx,
+ int r0)
+{
+ TRACE_DATA *data = CPU_TRACE_DATA (cpu);
+ int last_input;
+
+ /* Append any results to the end of the inputs */
+ last_input = TRACE_INPUT_IDX (data);
+ 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,
+ sim_cpu *cpu,
+ int trace_idx,
+ address_word r0)
+{
+ TRACE_DATA *data = CPU_TRACE_DATA (cpu);
+ int last_input;
+
+ /* Append any results to the end of the inputs */
+ last_input = TRACE_INPUT_IDX (data);
+ 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,
sim_cpu *cpu,
/* Simulator tracing/debugging support.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
Contributed by Cygnus Support.
This file is part of GDB, the GNU debugger.
#ifndef MAX_TRACE_VALUES
#define MAX_TRACE_VALUES 32
#endif
+
+/* The -t option only prints useful values. It's easy to type and shouldn't
+ splat on the screen everything under the sun making nothing easy to
+ find. */
+#define TRACE_USEFUL_MASK \
+((1 << TRACE_INSN_IDX) \
+ | (1 << TRACE_LINENUM_IDX) \
+ | (1 << TRACE_MEMORY_IDX) \
+ | (1 << TRACE_MODEL_IDX) \
+ | (1 << TRACE_EVENTS_IDX))
\f
/* Masks so WITH_TRACE can have symbolic values.
The case choice here is on purpose. The lowercase parts are args to
extern void trace_input0 PARAMS ((SIM_DESC sd,
sim_cpu *cpu,
int trace_idx));
+
extern void trace_input_word1 PARAMS ((SIM_DESC sd,
sim_cpu *cpu,
int trace_idx,
unsigned_word d0));
+
extern void trace_input_word2 PARAMS ((SIM_DESC sd,
sim_cpu *cpu,
int trace_idx,
unsigned_word d0,
unsigned_word d1));
+
extern void trace_input_word3 PARAMS ((SIM_DESC sd,
sim_cpu *cpu,
int trace_idx,
unsigned_word d1,
unsigned_word d2));
+extern void trace_input_bool1 PARAMS ((SIM_DESC sd,
+ sim_cpu *cpu,
+ int trace_idx,
+ int d0));
+
extern void trace_input_fp1 PARAMS ((SIM_DESC sd,
sim_cpu *cpu,
int trace_idx,
int trace_idx,
unsigned_word r0));
+extern void trace_result_bool1 PARAMS ((SIM_DESC sd,
+ sim_cpu *cpu,
+ int trace_idx,
+ int r0));
+
+extern void trace_result_addr1 PARAMS ((SIM_DESC sd,
+ sim_cpu *cpu,
+ int trace_idx,
+ address_word r0));
+
extern void trace_result_fp1 PARAMS ((SIM_DESC sd,
sim_cpu *cpu,
int trace_idx,
/* Macro's for tracing ALU instructions */
+
#define TRACE_ALU_INPUT0() \
do { \
if (TRACE_ALU_P (CPU)) \
trace_result_word1 (SD, CPU, TRACE_ALU_IDX, (R0)); \
} while (0)
+
+/* Macro's for tracing FPU instructions */
+
+#define TRACE_FPU_INPUT0() \
+do { \
+ if (TRACE_FPU_P (CPU)) \
+ trace_input0 (SD, CPU, TRACE_FPU_IDX); \
+} while (0)
+
+#define TRACE_FPU_INPUT1(V0) \
+do { \
+ if (TRACE_FPU_P (CPU)) \
+ trace_input_fp1 (SD, CPU, TRACE_FPU_IDX, (V0)); \
+} while (0)
+
+#define TRACE_FPU_INPUT2(V0,V1) \
+do { \
+ if (TRACE_FPU_P (CPU)) \
+ trace_input_fp2 (SD, CPU, TRACE_FPU_IDX, (V0), (V1)); \
+} while (0)
+
+#define TRACE_FPU_INPUT3(V0,V1,V2) \
+do { \
+ if (TRACE_FPU_P (CPU)) \
+ trace_input_fp3 (SD, CPU, TRACE_FPU_IDX, (V0), (V1), (V2)); \
+} while (0)
+
+#define TRACE_FPU_RESULT(R0) \
+do { \
+ if (TRACE_FPU_P (CPU)) \
+ trace_result_fp1 (SD, CPU, TRACE_FPU_IDX, (R0)); \
+} while (0)
+
+#define TRACE_FPU_RESULT_BOOL(R0) \
+do { \
+ if (TRACE_FPU_P (CPU)) \
+ trace_result_bool1 (SD, CPU, TRACE_FPU_IDX, (R0)); \
+} while (0)
+
+
+/* Macros for tracing branches */
+
+#define TRACE_BRANCH_INPUT(COND) \
+do { \
+ if (TRACE_BRANCH_P (CPU)) \
+ trace_input_bool1 (SD, CPU, TRACE_BRANCH_IDX, (COND)); \
+} while (0)
+
+#define TRACE_BRANCH_RESULT(DEST) \
+do { \
+ if (TRACE_BRANCH_P (CPU)) \
+ trace_result_addr1 (SD, CPU, TRACE_BRANCH_IDX, (DEST)); \
+} while (0)
+
\f
/* The function trace_one_insn has been replaced by trace_generic */
extern void trace_one_insn PARAMS ((SIM_DESC sd,