diff options
author | Andrew Cagney <cagney@redhat.com> | 1997-05-07 13:58:52 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 1997-05-07 13:58:52 +0000 |
commit | 381f42ef5d76943fb09494130c95abfb9b70e024 (patch) | |
tree | f45512a238920ab0e21b11e3efdb62d924984c9d /sim/common | |
parent | bd3274c6d9a56ad8cafa149fd72f0a0cc1a6d0fc (diff) | |
download | gdb-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')
-rw-r--r-- | sim/common/ChangeLog | 7 | ||||
-rw-r--r-- | sim/common/sim-trace.c | 45 | ||||
-rw-r--r-- | sim/common/sim-trace.h | 16 |
3 files changed, 49 insertions, 19 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 6ef6147..4363d41 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,10 @@ +Wed May 7 15:19:58 1997 Andrew Cagney <cagney@b1.cygnus.com> + + * sim-trace.c (trace_one_insn): Make a va-args function. + + * sim-trace.c (trace_vprintf): New function, va-arg version of + trace_printf. + Tue May 6 16:38:16 1997 Doug Evans <dje@canuck.cygnus.com> * sim-trace.c (trace_uninstall): Don't close a file twice. 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); } diff --git a/sim/common/sim-trace.h b/sim/common/sim-trace.h index e1cb786..a22da63 100644 --- a/sim/common/sim-trace.h +++ b/sim/common/sim-trace.h @@ -121,14 +121,22 @@ struct _sim_cpu; #define TRACE_FPU_P(cpu) TRACE_P (cpu, TRACE_FPU_IDX) #define TRACE_BRANCH_P(cpu) TRACE_P (cpu, TRACE_BRANCH_IDX) -extern void trace_one_insn PARAMS ((SIM_DESC, sim_cpu *, - address_word, int, - const char *, int, - const char *, const char *)); +extern void trace_one_insn PARAMS ((SIM_DESC sd, + sim_cpu * cpu, + address_word cia, + int print_linenum_p, + const char *file_name, + int line_nr, + const char *unit, + const char *fmt, + ...)) + __attribute__((format (printf, 8, 9))); extern void trace_printf PARAMS ((SIM_DESC, sim_cpu *, const char *, ...)) __attribute__((format (printf, 3, 4))); +extern void trace_vprintf PARAMS ((SIM_DESC, sim_cpu *, const char *, va_list)); + /* Debug support. This is included here because there isn't enough of it to justify a sim-debug.h. */ |