Commit | Line | Data |
---|---|---|
e9b2f579 DE |
1 | /* Simulator tracing/debugging support. |
2 | Copyright (C) 1997 Free Software Foundation, Inc. | |
3 | Contributed by Cygnus Support. | |
4 | ||
5 | This file is part of GDB, the GNU debugger. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 2, or (at your option) | |
10 | any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License along | |
18 | with this program; if not, write to the Free Software Foundation, Inc., | |
19 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
20 | ||
21 | #include "sim-main.h" | |
22 | #include "sim-io.h" | |
23 | ||
24 | void | |
25 | trace_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 | ||
48 | void | |
49 | debug_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 | } |