* sim-utils.c (sim_add_commas): New function.
[deliverable/binutils-gdb.git] / sim / common / sim-trace.c
CommitLineData
e9b2f579
DE
1/* Simulator tracing/debugging support.
2 Copyright (C) 1997 Free Software Foundation, Inc.
3 Contributed by Cygnus Support.
4
5This file is part of GDB, the GNU debugger.
6
7This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License along
18with this program; if not, write to the Free Software Foundation, Inc.,
1959 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20
21#include "sim-main.h"
22#include "sim-io.h"
23
24void
25trace_printf VPARAMS ((sim_cpu *cpu, const char *fmt, ...))
26{
27#ifndef __STDC__
28 sim_cpu *cpu;
29 const char *fmt;
30#endif
31 va_list ap;
32
33 VA_START (ap, fmt);
34#ifndef __STDC__
35 cpu = va_arg (ap, sim_cpu *);
36 fmt = va_arg (ap, const char *);
37#endif
38
39 if (CPU_TRACE_FILE (cpu) == NULL)
40 (* STATE_CALLBACK (CPU_STATE (cpu))->evprintf_filtered)
41 (STATE_CALLBACK (CPU_STATE (cpu)), fmt, ap);
42 else
43 vfprintf (CPU_TRACE_FILE (cpu), fmt, ap);
44
45 va_end (ap);
46}
47
48void
49debug_printf VPARAMS ((sim_cpu *cpu, const char *fmt, ...))
50{
51#ifndef __STDC__
52 sim_cpu *cpu;
53 const char *fmt;
54#endif
55 va_list ap;
56
57 VA_START (ap, fmt);
58#ifndef __STDC__
59 cpu = va_arg (ap, sim_cpu *);
60 fmt = va_arg (ap, const char *);
61#endif
62
63 if (CPU_DEBUG_FILE (cpu) == NULL)
64 (* STATE_CALLBACK (CPU_STATE (cpu))->evprintf_filtered)
65 (STATE_CALLBACK (CPU_STATE (cpu)), fmt, ap);
66 else
67 vfprintf (CPU_DEBUG_FILE (cpu), fmt, ap);
68
69 va_end (ap);
70}
This page took 0.029033 seconds and 4 git commands to generate.