aboutsummaryrefslogtreecommitdiff
path: root/sim/common/sim-trace.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>1997-05-07 13:58:52 +0000
committerAndrew Cagney <cagney@redhat.com>1997-05-07 13:58:52 +0000
commit381f42ef5d76943fb09494130c95abfb9b70e024 (patch)
treef45512a238920ab0e21b11e3efdb62d924984c9d /sim/common/sim-trace.c
parentbd3274c6d9a56ad8cafa149fd72f0a0cc1a6d0fc (diff)
downloadgdb-381f42ef5d76943fb09494130c95abfb9b70e024.zip
gdb-381f42ef5d76943fb09494130c95abfb9b70e024.tar.gz
gdb-381f42ef5d76943fb09494130c95abfb9b70e024.tar.bz2
o Clean-up tic80 fp tracing
o Fill in more tic80 insns
Diffstat (limited to 'sim/common/sim-trace.c')
-rw-r--r--sim/common/sim-trace.c45
1 files changed, 30 insertions, 15 deletions
diff --git a/sim/common/sim-trace.c b/sim/common/sim-trace.c
index a2eec25..f617783 100644
--- a/sim/common/sim-trace.c
+++ b/sim/common/sim-trace.c
@@ -308,21 +308,27 @@ trace_uninstall (SIM_DESC sd)
void
trace_one_insn (SIM_DESC sd, sim_cpu *cpu, address_word pc,
int line_p, const char *filename, int linenum,
- const char *phase_wo_colon, const char *name)
+ const char *phase_wo_colon, const char *fmt,
+ ...)
{
+ va_list ap;
char phase[SIZE_PHASE+2];
strncpy (phase, phase_wo_colon, SIZE_PHASE);
strcat (phase, ":");
if (!line_p)
- trace_printf(sd, cpu, "%-*s %s:%-*d 0x%.*lx %s\n",
- SIZE_PHASE+1, phase,
- filename,
- SIZE_LINE_NUMBER, linenum,
- SIZE_PC, (long)pc,
- name);
-
+ {
+ trace_printf (sd, cpu, "%-*s %s:%-*d 0x%.*lx ",
+ SIZE_PHASE+1, phase,
+ filename,
+ SIZE_LINE_NUMBER, linenum,
+ SIZE_PC, (long)pc);
+ va_start (ap, fmt);
+ trace_vprintf (sd, cpu, fmt, ap);
+ va_end (ap);
+ trace_printf (sd, cpu, "\n");
+ }
else
{
char buf[256];
@@ -371,15 +377,27 @@ trace_one_insn (SIM_DESC sd, sim_cpu *cpu, address_word pc,
}
}
- trace_printf (sd, cpu, "%-*s 0x%.*x %-*.*s %s\n",
+ trace_printf (sd, cpu, "%-*s 0x%.*x %-*.*s ",
SIZE_PHASE+1, phase,
SIZE_PC, (unsigned) pc,
- SIZE_LOCATION, SIZE_LOCATION, buf,
- name);
+ SIZE_LOCATION, SIZE_LOCATION, buf);
+ va_start (ap, fmt);
+ trace_vprintf (sd, cpu, fmt, ap);
+ va_end (ap);
+ trace_printf (sd, cpu, "\n");
}
}
void
+trace_vprintf (SIM_DESC sd, sim_cpu *cpu, const char *fmt, va_list ap)
+{
+ if (cpu != NULL && TRACE_FILE (CPU_TRACE_DATA (cpu)) != NULL)
+ vfprintf (TRACE_FILE (CPU_TRACE_DATA (cpu)), fmt, ap);
+ else
+ sim_io_evprintf (sd, fmt, ap);
+}
+
+void
trace_printf VPARAMS ((SIM_DESC sd, sim_cpu *cpu, const char *fmt, ...))
{
#ifndef __STDC__
@@ -396,10 +414,7 @@ trace_printf VPARAMS ((SIM_DESC sd, sim_cpu *cpu, const char *fmt, ...))
fmt = va_arg (ap, const char *);
#endif
- if (cpu != NULL && TRACE_FILE (CPU_TRACE_DATA (cpu)) != NULL)
- vfprintf (TRACE_FILE (CPU_TRACE_DATA (cpu)), fmt, ap);
- else
- sim_io_evprintf (sd, fmt, ap);
+ trace_vprintf (sd, cpu, fmt, ap);
va_end (ap);
}