* sim-options.c, sim-options.h: New files.
* sim-config.h (WITH_DEBUG): Provide default value of zero.
- * Make-common.in (nrun.o): Add rule for.
+ * Make-common.in (nrun.o): Add rules for.
* nrun.c: New file.
* run.c (main): Check return value of sim_open.
- * Make-common.in (sim-options.o, sim-load.o): Add rules for.
+ * Make-common.in (sim-options.o, sim-load.o, sim-trace.o): Add rules.
(sim_main_headers): Add sim-trace.h.
* run.c (exec_bfd, target_byte_order): Delete.
(main): Pass -E <endian> to sim_open. Delete code to load sections,
mem_size, memory [+ corresponding access macros].
(sim_cpu_base): New typedef.
* sim-trace.h: New file.
+ * sim-trace.c: New file.
* sim-basics.h: #include it.
* sim-load.c: New file.
cat $(srcdir)/../common/$@ >> tmp-$@
$(srcdir)/../../move-if-change tmp-$@ $@
-sim-options.o: $(srcdir)/../common/sim-options.c $(sim_headers) \
+sim-options.o: $(srcdir)/../common/sim-options.c $(sim_main_headers) \
$(srcdir)/../common/sim-options.h
$(CC) -c $(srcdir)/../common/sim-options.c $(ALL_CFLAGS)
+sim-trace.o: $(srcdir)/../common/sim-trace.c $(sim_main_headers) \
+ $(srcdir)/../common/sim-io.h
+ $(CC) -c $(srcdir)/../common/sim-trace.c $(ALL_CFLAGS)
+
sim-utils.o: $(srcdir)/../common/sim-utils.c $(sim_main_headers) \
$(SIM_EXTRA_DEPS)
$(CC) -c $(srcdir)/../common/sim-utils.c $(ALL_CFLAGS)
--- /dev/null
+/* Simulator tracing/debugging support.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ Contributed by Cygnus Support.
+
+This file is part of GDB, the GNU debugger.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#include "sim-main.h"
+#include "sim-io.h"
+
+void
+trace_printf VPARAMS ((sim_cpu *cpu, const char *fmt, ...))
+{
+#ifndef __STDC__
+ sim_cpu *cpu;
+ const char *fmt;
+#endif
+ va_list ap;
+
+ VA_START (ap, fmt);
+#ifndef __STDC__
+ cpu = va_arg (ap, sim_cpu *);
+ fmt = va_arg (ap, const char *);
+#endif
+
+ if (CPU_TRACE_FILE (cpu) == NULL)
+ (* STATE_CALLBACK (CPU_STATE (cpu))->evprintf_filtered)
+ (STATE_CALLBACK (CPU_STATE (cpu)), fmt, ap);
+ else
+ vfprintf (CPU_TRACE_FILE (cpu), fmt, ap);
+
+ va_end (ap);
+}
+
+void
+debug_printf VPARAMS ((sim_cpu *cpu, const char *fmt, ...))
+{
+#ifndef __STDC__
+ sim_cpu *cpu;
+ const char *fmt;
+#endif
+ va_list ap;
+
+ VA_START (ap, fmt);
+#ifndef __STDC__
+ cpu = va_arg (ap, sim_cpu *);
+ fmt = va_arg (ap, const char *);
+#endif
+
+ if (CPU_DEBUG_FILE (cpu) == NULL)
+ (* STATE_CALLBACK (CPU_STATE (cpu))->evprintf_filtered)
+ (STATE_CALLBACK (CPU_STATE (cpu)), fmt, ap);
+ else
+ vfprintf (CPU_DEBUG_FILE (cpu), fmt, ap);
+
+ va_end (ap);
+}