aboutsummaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorDavid Edelsohn <dje.gcc@gmail.com>1997-04-17 14:08:30 +0000
committerDavid Edelsohn <dje.gcc@gmail.com>1997-04-17 14:08:30 +0000
commite9b2f57903bf6272c0365833d328a106b7f8ff5a (patch)
tree0864d79352e6254670738b0f1609f32e0faabb39 /sim
parent5bfbd725553bc148a0ede1b8dacc7a65aa524ae2 (diff)
downloadgdb-e9b2f57903bf6272c0365833d328a106b7f8ff5a.zip
gdb-e9b2f57903bf6272c0365833d328a106b7f8ff5a.tar.gz
gdb-e9b2f57903bf6272c0365833d328a106b7f8ff5a.tar.bz2
sim-trace.c: New file.
Diffstat (limited to 'sim')
-rw-r--r--sim/common/.Sanitize1
-rw-r--r--sim/common/ChangeLog5
-rw-r--r--sim/common/Make-common.in6
-rw-r--r--sim/common/sim-trace.c70
4 files changed, 79 insertions, 3 deletions
diff --git a/sim/common/.Sanitize b/sim/common/.Sanitize
index b7b086a..06fb5fc 100644
--- a/sim/common/.Sanitize
+++ b/sim/common/.Sanitize
@@ -60,6 +60,7 @@ sim-n-core.h
sim-n-endian.h
sim-options.c
sim-options.h
+sim-trace.c
sim-trace.h
sim-types.h
sim-utils.c
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 18d9906..b16dd69 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -2,12 +2,12 @@ Thu Apr 17 02:25:11 1997 Doug Evans <dje@canuck.cygnus.com>
* 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,
@@ -18,6 +18,7 @@ Thu Apr 17 02:25:11 1997 Doug Evans <dje@canuck.cygnus.com>
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.
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index e4bdde6..521ecb2 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -257,10 +257,14 @@ sim-io.c: $(srcdir)/../common/sim-io.c
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)
diff --git a/sim/common/sim-trace.c b/sim/common/sim-trace.c
new file mode 100644
index 0000000..ffdaf32
--- /dev/null
+++ b/sim/common/sim-trace.c
@@ -0,0 +1,70 @@
+/* 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);
+}