1 /* This file is part of the program psim.
3 Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, see <http://www.gnu.org/licenses/>.
24 #include "filter_filename.h"
56 trace_register_device
,
59 trace_disklabel_package
,
76 trace_print_device_tree
,
77 trace_dump_device_tree
,
83 extern int ppc_trace
[nr_trace_options
];
86 #define TRACE(OBJECT, ARGS) \
89 if (ppc_trace[OBJECT]) { \
90 sim_io_printf_filtered("%s:%d: ", filter_filename(__FILE__), __LINE__); \
91 sim_io_printf_filtered ARGS; \
97 #define ITRACE(OBJECT, ARGS) \
100 if (ppc_trace[OBJECT]) { \
101 sim_io_printf_filtered("%s:%d:0x%08lx:%s ", itable[MY_INDEX].file, itable[MY_INDEX].line_nr, (long)cia, itable[MY_INDEX].name); \
102 sim_io_printf_filtered ARGS; \
108 #define DTRACE(OBJECT, ARGS) \
111 int trace_device = device_trace(me); \
112 if (ppc_trace[trace_devices] \
113 || ppc_trace[trace_##OBJECT##_device] \
115 sim_io_printf_filtered("%s:%d:%s:%s%s ", \
116 filter_filename(__FILE__), __LINE__, #OBJECT, \
117 trace_device ? device_path(me) : "", \
118 trace_device ? ":" : ""); \
119 sim_io_printf_filtered ARGS; \
124 /* device instance */
125 #define DITRACE(OBJECT, ARGS) \
128 device *me = device_instance_device(instance); \
129 int trace_device = device_trace(me); \
130 if (ppc_trace[trace_devices] \
131 || ppc_trace[trace_##OBJECT##_device] \
133 sim_io_printf_filtered("%s:%d:%s:%s%s ", \
134 filter_filename(__FILE__), __LINE__, #OBJECT, \
135 trace_device ? device_path(me) : "", \
136 trace_device ? ":" : ""); \
137 sim_io_printf_filtered ARGS; \
143 #define PTRACE(OBJECT, ARGS) \
146 if (ppc_trace[trace_##OBJECT##_package]) { \
147 sim_io_printf_filtered("%s:%d:%s: ", filter_filename(__FILE__), __LINE__, #OBJECT); \
148 sim_io_printf_filtered ARGS; \
154 #define ASSERT(EXPRESSION) \
157 if (!(EXPRESSION)) { \
158 error("%s:%d: assertion failed - %s\n", \
159 filter_filename(__FILE__), __LINE__, #EXPRESSION); \
164 /* Parse OPTION updating the trace array */
166 trace_option(const char *option
, int setting
);
168 /* Output the list of trace options */
169 extern void trace_usage
173 #endif /* _DEBUG_H_ */