aboutsummaryrefslogtreecommitdiff
path: root/sim/common/sim-trace.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>1998-02-23 16:43:34 +0000
committerAndrew Cagney <cagney@redhat.com>1998-02-23 16:43:34 +0000
commit0325f2dc89b9d57757f4db62732ae873993c232f (patch)
treecf84dec600db094920f1162d56ae3b9ffb7778fe /sim/common/sim-trace.c
parent5af9fc5f50fe5ef373219668cb94f2894b263a6b (diff)
downloadgdb-0325f2dc89b9d57757f4db62732ae873993c232f.zip
gdb-0325f2dc89b9d57757f4db62732ae873993c232f.tar.gz
gdb-0325f2dc89b9d57757f4db62732ae873993c232f.tar.bz2
Add tracing of booleans and addresses.
Diffstat (limited to 'sim/common/sim-trace.c')
-rw-r--r--sim/common/sim-trace.c116
1 files changed, 95 insertions, 21 deletions
diff --git a/sim/common/sim-trace.c b/sim/common/sim-trace.c
index 7764005..0990aee 100644
--- a/sim/common/sim-trace.c
+++ b/sim/common/sim-trace.c
@@ -384,6 +384,8 @@ typedef enum {
trace_fmt_fp,
trace_fmt_fpu,
trace_fmt_string,
+ trace_fmt_bool,
+ trace_fmt_addr,
trace_fmt_instruction_incomplete,
} data_fmt;
@@ -428,28 +430,46 @@ print_data (SIM_DESC sd,
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);
@@ -701,6 +721,28 @@ trace_input_word3 (SIM_DESC sd,
}
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,
int trace_idx,
@@ -804,6 +846,38 @@ trace_result_word1 (SIM_DESC sd,
}
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,
int trace_idx,