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 2 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, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 #include "filter_filename.h"
55 trace_register_device
,
58 trace_disklabel_package
,
75 trace_print_device_tree
,
76 trace_dump_device_tree
,
82 extern int ppc_trace
[nr_trace_options
];
85 #define TRACE(OBJECT, ARGS) \
88 if (ppc_trace[OBJECT]) { \
89 printf_filtered("%s:%d: ", filter_filename(__FILE__), __LINE__); \
90 printf_filtered ARGS; \
96 #define ITRACE(OBJECT, ARGS) \
99 if (ppc_trace[OBJECT]) { \
100 printf_filtered("%s:%d:0x%08lx:%s ", itable[MY_INDEX].file, itable[MY_INDEX].line_nr, (long)cia, itable[MY_INDEX].name); \
101 printf_filtered ARGS; \
107 #define DTRACE(OBJECT, ARGS) \
110 int trace_device = device_trace(me); \
111 if (ppc_trace[trace_devices] \
112 || ppc_trace[trace_##OBJECT##_device] \
114 printf_filtered("%s:%d:%s:%s%s ", \
115 filter_filename(__FILE__), __LINE__, #OBJECT, \
116 trace_device ? device_path(me) : "", \
117 trace_device ? ":" : ""); \
118 printf_filtered ARGS; \
123 /* device instance */
124 #define DITRACE(OBJECT, ARGS) \
127 device *me = device_instance_device(instance); \
128 int trace_device = device_trace(me); \
129 if (ppc_trace[trace_devices] \
130 || ppc_trace[trace_##OBJECT##_device] \
132 printf_filtered("%s:%d:%s:%s%s ", \
133 filter_filename(__FILE__), __LINE__, #OBJECT, \
134 trace_device ? device_path(me) : "", \
135 trace_device ? ":" : ""); \
136 printf_filtered ARGS; \
142 #define PTRACE(OBJECT, ARGS) \
145 if (ppc_trace[trace_##OBJECT##_package]) { \
146 printf_filtered("%s:%d:%s: ", filter_filename(__FILE__), __LINE__, #OBJECT); \
147 printf_filtered ARGS; \
153 #define ASSERT(EXPRESSION) \
156 if (!(EXPRESSION)) { \
157 error("%s:%d: assertion failed - %s\n", \
158 filter_filename(__FILE__), __LINE__, #EXPRESSION); \
163 /* Parse OPTION updating the trace array */
165 trace_option(const char *option
, int setting
);
167 /* Output the list of trace options */
168 extern void trace_usage
172 #endif /* _DEBUG_H_ */