+2015-06-12 Mike Frysinger <vapier@gentoo.org>
+
+ * interp.c [TRACE]: Delete.
+ (TRACE): Change to WITH_TRACE_ANY_P.
+ [!WITH_TRACE_ANY_P] (open_trace): Define.
+ (mips_option_handler, open_trace, sim_close, dotrace):
+ Change defined(TRACE) to WITH_TRACE_ANY_P.
+ (sim_open): Delete TRACE ifdef check.
+ * sim-main.c (load_memory): Delete TRACE ifdef check.
+ (store_memory): Likewise.
+ * sim-main.h [WITH_TRACE_ANY_P] (dotrace, tracefh): Protect decls.
+ [!WITH_TRACE_ANY_P] (dotrace): Define.
+
2015-04-18 Mike Frysinger <vapier@gentoo.org>
* sim-main.h (SIM_ENGINE_HALT_HOOK, SIM_ENGINE_RESTART_HOOK): Delete
*/
-/* The TRACE manifests enable the provision of extra features. If they
- are not defined then a simpler (quicker) simulator is constructed
- without the required run-time checks, etc. */
-#if 1 /* 0 to allow user build selection, 1 to force inclusion */
-#define TRACE (1)
-#endif
-
#include "config.h"
#include "bfd.h"
#include "sim-main.h"
#define MEM_SIZE (8 << 20) /* 8 MBytes */
-#if defined(TRACE)
+#if WITH_TRACE_ANY_P
static char *tracefile = "trace.din"; /* default filename for trace log */
FILE *tracefh = NULL;
static void open_trace (SIM_DESC sd);
-#endif /* TRACE */
+#else
+#define open_trace(sd)
+#endif
static const char * get_insn_name (sim_cpu *, int);
switch (opt)
{
case OPTION_DINERO_TRACE: /* ??? */
-#if defined(TRACE)
+#if WITH_TRACE_ANY_P
/* Eventually the simTRACE flag could be treated as a toggle, to
allow external control of the program points being traced
(i.e. only from main onwards, excluding the run-time setup,
}
}
return SIM_RC_OK;
-#else /* !TRACE */
+#else /* !WITH_TRACE_ANY_P */
fprintf(stderr,"\
Simulator constructed without dinero tracing support (for performance).\n\
-Re-compile simulator with \"-DTRACE\" to enable this option.\n");
+Re-compile simulator with \"-DWITH_TRACE_ANY_P\" to enable this option.\n");
return SIM_RC_FAIL;
-#endif /* !TRACE */
+#endif /* !WITH_TRACE_ANY_P */
case OPTION_DINERO_FILE:
-#if defined(TRACE)
+#if WITH_TRACE_ANY_P
if (optarg != NULL) {
char *tmp;
tmp = (char *)malloc(strlen(optarg) + 1);
sim_io_printf(sd,"Placing trace information into file \"%s\"\n",tracefile);
}
}
-#endif /* TRACE */
+#endif /* WITH_TRACE_ANY_P */
return SIM_RC_OK;
case OPTION_FIRMWARE:
}
-#if defined(TRACE)
if (STATE & simTRACE)
open_trace(sd);
-#endif /* TRACE */
/*
sim_io_eprintf (sd, "idt@%x pmon@%x lsipmon@%x\n",
return sd;
}
-#if defined(TRACE)
+#if WITH_TRACE_ANY_P
static void
open_trace (SIM_DESC sd)
{
tracefh = stderr;
}
}
-#endif /* TRACE */
+#endif
/* Return name of an insn, used by insn profiling. */
static const char *
mechanism are released: */
sim_io_shutdown (sd);
-#if defined(TRACE)
+#if WITH_TRACE_ANY_P
if (tracefh != NULL && tracefh != stderr)
fclose(tracefh);
tracefh = NULL;
-#endif /* TRACE */
+#endif
/* FIXME - free SD */
/*-- trace support ----------------------------------------------------------*/
-/* The TRACE support is provided (if required) in the memory accessing
+/* The trace support is provided (if required) in the memory accessing
routines. Since we are also providing the architecture specific
features, the architecture simulation code can also deal with
- notifying the TRACE world of cache flushes, etc. Similarly we do
+ notifying the trace world of cache flushes, etc. Similarly we do
not need to provide profiling support in the simulator engine,
since we can sample in the instruction fetch control loop. By
- defining the TRACE manifest, we add tracing as a run-time
+ defining the trace manifest, we add tracing as a run-time
option. */
-#if defined(TRACE)
+#if WITH_TRACE_ANY_P
/* Tracing by default produces "din" format (as required by
dineroIII). Each line of such a trace file *MUST* have a din label
and address field. The rest of the line is ignored, so comments can
return;
}
-#endif /* TRACE */
+#endif /* WITH_TRACE_ANY_P */
/*---------------------------------------------------------------------------*/
/*-- simulator engine -------------------------------------------------------*/
pr_addr (pAddr));
}
-#if defined(TRACE)
dotrace (SD, CPU, tracefh,((IorD == isDATA) ? 0 : 2),(unsigned int)(pAddr&0xFFFFFFFF),(AccessLength + 1),"load%s",((IorD == isDATA) ? "" : " instruction"));
-#endif /* TRACE */
/* Read the specified number of bytes from memory. Adjust for
host/target byte ordering/ Align the least significant byte
(LOADDRMASK + 1) << 3,
pr_addr(pAddr));
-#if defined(TRACE)
dotrace (SD, CPU, tracefh,1,(unsigned int)(pAddr&0xFFFFFFFF),(AccessLength + 1),"store");
-#endif /* TRACE */
#ifdef DEBUG
printf("DBG: StoreMemory: offset = %d MemElem = 0x%s%s\n",(unsigned int)(pAddr & LOADDRMASK),pr_uword64(MemElem1),pr_uword64(MemElem));
#define IMEM16(CIA) ifetch16 (SD, CPU, (CIA), ((CIA) & ~1))
#define IMEM16_IMMED(CIA,NR) ifetch16 (SD, CPU, (CIA), ((CIA) & ~1) + 2 * (NR))
+#if WITH_TRACE_ANY_P
void dotrace (SIM_DESC sd, sim_cpu *cpu, FILE *tracefh, int type, SIM_ADDR address, int width, char *comment, ...);
extern FILE *tracefh;
+#else
+#define dotrace(sd, cpu, tracefh, type, address, width, comment, ...)
+#endif
extern int DSPLO_REGNUM[4];
extern int DSPHI_REGNUM[4];