Update
[gdb.git] / sim / ppc / debug.h
blob1fdb36ebac3bc3afba19847a424c08ce94648880
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.
22 #ifndef _DEBUG_H_
23 #define _DEBUG_H_
25 #include "filter_filename.h"
27 typedef enum {
28 trace_invalid,
29 trace_tbd,
30 /**/
31 trace_gdb,
32 trace_os_emul,
33 /**/
34 trace_events,
35 trace_device_tree,
36 trace_devices,
37 trace_binary_device,
38 trace_com_device,
39 trace_console_device,
40 trace_core_device,
41 trace_disk_device,
42 trace_eeprom_device,
43 trace_file_device,
44 trace_glue_device,
45 trace_halt_device,
46 trace_htab_device,
47 trace_icu_device,
48 trace_ide_device,
49 trace_memory_device,
50 trace_opic_device,
51 trace_pal_device,
52 trace_pass_device,
53 trace_phb_device,
54 trace_stack_device,
55 trace_register_device,
56 trace_vm_device,
57 /**/
58 trace_disklabel_package,
59 /**/
60 trace_semantics,
61 trace_idecode,
62 trace_alu,
63 trace_load_store,
64 trace_model,
65 /**/
66 trace_vm,
67 trace_core,
68 trace_interrupts,
69 trace_psim,
70 trace_device_init,
71 trace_cpu,
72 trace_breakpoint,
73 trace_opts,
74 trace_print_info,
75 trace_print_device_tree,
76 trace_dump_device_tree,
77 nr_trace_options
78 } trace_options;
82 extern int ppc_trace[nr_trace_options];
84 /* simple */
85 #define TRACE(OBJECT, ARGS) \
86 do { \
87 if (WITH_TRACE) { \
88 if (ppc_trace[OBJECT]) { \
89 printf_filtered("%s:%d: ", filter_filename(__FILE__), __LINE__); \
90 printf_filtered ARGS; \
91 } \
92 } \
93 } while (0)
95 /* issue */
96 #define ITRACE(OBJECT, ARGS) \
97 do { \
98 if (WITH_TRACE) { \
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; \
104 } while (0)
106 /* device */
107 #define DTRACE(OBJECT, ARGS) \
108 do { \
109 if (WITH_TRACE) { \
110 int trace_device = device_trace(me); \
111 if (ppc_trace[trace_devices] \
112 || ppc_trace[trace_##OBJECT##_device] \
113 || trace_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; \
121 } while (0)
123 /* device instance */
124 #define DITRACE(OBJECT, ARGS) \
125 do { \
126 if (WITH_TRACE) { \
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] \
131 || trace_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; \
139 } while (0)
141 /* package */
142 #define PTRACE(OBJECT, ARGS) \
143 do { \
144 if (WITH_TRACE) { \
145 if (ppc_trace[trace_##OBJECT##_package]) { \
146 printf_filtered("%s:%d:%s: ", filter_filename(__FILE__), __LINE__, #OBJECT); \
147 printf_filtered ARGS; \
150 } while (0)
153 #define ASSERT(EXPRESSION) \
154 do { \
155 if (WITH_ASSERT) { \
156 if (!(EXPRESSION)) { \
157 error("%s:%d: assertion failed - %s\n", \
158 filter_filename(__FILE__), __LINE__, #EXPRESSION); \
161 } while (0)
163 /* Parse OPTION updating the trace array */
164 extern void
165 trace_option(const char *option, int setting);
167 /* Output the list of trace options */
168 extern void trace_usage
169 (int verbose);
172 #endif /* _DEBUG_H_ */