sim-trace.c: New file.

This commit is contained in:
David Edelsohn 1997-04-17 14:08:30 +00:00
parent 5bfbd72555
commit e9b2f57903
4 changed files with 79 additions and 3 deletions

View File

@ -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

View File

@ -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.

View File

@ -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)

70
sim/common/sim-trace.c Normal file
View File

@ -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);
}