aboutsummaryrefslogtreecommitdiff
path: root/sim/common/cgen-trace.c
diff options
context:
space:
mode:
authorDavid Edelsohn <dje.gcc@gmail.com>1997-05-01 18:05:37 +0000
committerDavid Edelsohn <dje.gcc@gmail.com>1997-05-01 18:05:37 +0000
commitc967f1874a9a38bdc0040f218b6905f4987ab600 (patch)
tree9ce497975c88d89234605916e6013936afebd153 /sim/common/cgen-trace.c
parent2c8f0de695ce97cd6c09eca707e1a216c8b69943 (diff)
downloadfsf-binutils-gdb-c967f1874a9a38bdc0040f218b6905f4987ab600.zip
fsf-binutils-gdb-c967f1874a9a38bdc0040f218b6905f4987ab600.tar.gz
fsf-binutils-gdb-c967f1874a9a38bdc0040f218b6905f4987ab600.tar.bz2
* Makefile.in (sim-options_h): Define.
(sim-{module,options,trace,profile,utils}.o): Clean up dependencies. (sim-model.o): Add new rule. (cgen-{scache,trace,utils}.o): Add new rules. * aclocal.m4 (SIM_AC_OPTION_{SCACHE,DEFAULT_MODEL}): Add. * cgen-scache.c (scache_print_profile): Change `sd' arg to `cpu'. Indent output by 2 spaces. * cgen-scache.h (scache_print_profile): Update. * cgen-trace.c (trace_insn_fini): Indent output by 2 spaces. Use trace_printf, not fprintf. (trace_extract): Use trace_printf, not cgen_trace_printf. * genmloop.sh (!FAST case): Increment `insn_count'. * sim-base.h (sim_state_base): Only include scache_size if WITH_SCACHE. (sim_cpu_base): Rename member `sd' to `state' to be consistent with access macro's name. * sim-core.c (sim_core_init): Use EXTERN_SIM_CORE to define it. Change return type to SIM_RC. (sim_core_{install,uninstall}): New functions. * sim-core.h (sim_core_{install,uninstall}): Declare. (sim_core_init): Use EXTERN_SIM_CORE to define it. Change return type to SIM_RC. * sim-model.h (models,machs,model_install): Declare. * sim-module.c (modules): Add scache_install, model_install. (sim_post_argv_init): Set cpu->state backlinks. * sim-options.c (standard_options): Delete --simcache-size,--max-insns. (standard_option_handler): Likewise. * sim-profile.c (PROFILE_{HISTOGRAM,LABEL}_WIDTH): Move to sim-profile.h. (*): Assume ANSI C. (profile_options): Delete --profile-simcache. (profile_option_handler): Likewise. (profile_print_insn): Change `sd' arg to `cpu'. Indent output 2 spaces. (profile_print_{memory,model}): Likewise. (profile_print_simcache): Delete. (profile_print_speed): New function. (profile_print): Rewrite. * sim-profile.h (PROFILE_scache): Renamed from PROFILE_simcache. (WITH_PROFILE_SCACHE_P): Renamed from WITH_PROFILE_SIMCACHE_P. (PROFILE_DATA): Delete members simcache_{hits,misses}. (PROFILE_COUNT_SIMCACHE_{HIT,MISS}): Delete. (PROFILE_{CALLBACK,CPU_CALLBACK}): New types. (profile_print): Update prototype.
Diffstat (limited to 'sim/common/cgen-trace.c')
-rw-r--r--sim/common/cgen-trace.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/sim/common/cgen-trace.c b/sim/common/cgen-trace.c
index 675c369..c18cdda 100644
--- a/sim/common/cgen-trace.c
+++ b/sim/common/cgen-trace.c
@@ -47,7 +47,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#endif
/* Text is queued in TRACE_BUF because we want to output the insn's cycle
- count first but that isn't know until after the insn has executed. */
+ count first but that isn't known until after the insn has executed. */
static char trace_buf[1024];
/* If NULL, output to stdout directly. */
static char *bufptr;
@@ -69,14 +69,13 @@ trace_insn_fini (SIM_CPU *cpu)
if (CPU_PROFILE_FLAGS (cpu) [PROFILE_MODEL_IDX])
{
unsigned long total = PROFILE_TOTAL_CYCLE_COUNT (CPU_PROFILE_DATA (cpu));
- fprintf (stderr, "%-*ld %-*ld ",
- SIZE_CYCLE_COUNT, total - last_cycle_count,
- SIZE_TOTAL_CYCLE_COUNT, total);
+ trace_printf (cpu, "%-*ld %-*ld ",
+ SIZE_CYCLE_COUNT, total - last_cycle_count,
+ SIZE_TOTAL_CYCLE_COUNT, total);
last_cycle_count = total;
}
- fputs (trace_buf, stderr);
- fputc ('\n', stderr);
+ trace_printf (cpu, "%s\n", trace_buf);
}
/* For communication between trace_insn and trace_result. */
@@ -169,7 +168,7 @@ trace_extract (SIM_CPU *cpu, PCADDR pc, char *name, ...)
va_start (args, name);
- cgen_trace_printf (cpu, "0x%.*x: %s ", SIZE_PC, pc, name);
+ trace_printf (cpu, "Extract: 0x%.*x: %s ", SIZE_PC, pc, name);
do {
int type,ival;
@@ -179,14 +178,14 @@ trace_extract (SIM_CPU *cpu, PCADDR pc, char *name, ...)
if (fmt)
{
if (printed_one_p)
- cgen_trace_printf (cpu, ", ");
+ trace_printf (cpu, ", ");
printed_one_p = 1;
type = va_arg (args, int);
switch (type)
{
case 'x' :
ival = va_arg (args, int);
- cgen_trace_printf (cpu, fmt, ival);
+ trace_printf (cpu, fmt, ival);
break;
default :
abort ();
@@ -195,7 +194,7 @@ trace_extract (SIM_CPU *cpu, PCADDR pc, char *name, ...)
} while (fmt);
va_end (args);
- cgen_trace_printf (cpu, "\n");
+ trace_printf (cpu, "\n");
}
void
@@ -226,6 +225,9 @@ trace_result (SIM_CPU *cpu, char *name, int type, ...)
va_end (args);
}
+/* Print trace output to BUFPTR if active, otherwise print normally.
+ This is only for tracing semantic code. */
+
void
cgen_trace_printf (SIM_CPU *cpu, char *fmt, ...)
{