Commit | Line | Data |
---|---|---|
c143ef62 MM |
1 | /* This file is part of the program psim. |
2 | ||
3 | Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au> | |
4 | ||
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. | |
9 | ||
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. | |
14 | ||
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. | |
18 | ||
19 | */ | |
20 | ||
21 | ||
22 | #ifndef _DEBUG_H_ | |
23 | #define _DEBUG_H_ | |
24 | ||
25 | #include "filter_filename.h" | |
26 | ||
27 | typedef enum { | |
28 | trace_invalid, | |
29 | trace_tbd, | |
30 | /**/ | |
31 | trace_gdb, | |
32 | trace_os_emul, | |
33 | /**/ | |
34 | trace_device_tree, | |
35 | trace_devices, | |
36 | trace_pass_device, | |
37 | trace_console_device, | |
38 | trace_icu_device, | |
39 | trace_halt_device, | |
40 | trace_register_device, | |
41 | trace_vm_device, | |
42 | trace_memory_device, | |
43 | trace_htab_device, | |
44 | trace_pte_device, | |
45 | trace_binary_device, | |
46 | trace_file_device, | |
47 | trace_core_device, | |
48 | trace_stack_device, | |
49 | /**/ | |
50 | trace_semantics, | |
51 | trace_idecode, | |
52 | trace_alu, | |
a983c8f0 | 53 | trace_load_store, |
c143ef62 MM |
54 | /**/ |
55 | trace_vm, | |
56 | trace_core, | |
57 | trace_psim, | |
58 | trace_device_init, | |
59 | trace_cpu, | |
60 | trace_breakpoint, | |
61 | nr_trace_options | |
62 | } trace_options; | |
63 | ||
64 | ||
65 | ||
66 | extern int ppc_trace[nr_trace_options]; | |
67 | ||
68 | #if WITH_TRACE | |
69 | #define TRACE(OBJECT, ARGS) \ | |
70 | do { \ | |
71 | if (ppc_trace[OBJECT]) { \ | |
72 | printf_filtered("%s:%d:%s: ", filter_filename(__FILE__), __LINE__, #OBJECT); \ | |
73 | printf_filtered ARGS; \ | |
74 | } \ | |
75 | } while (0) | |
76 | /* issue */ | |
77 | #define ITRACE(OBJECT, ARGS) \ | |
78 | do { \ | |
79 | if (ppc_trace[OBJECT]) { \ | |
80 | printf_filtered("%s:%d:0x%x", my_prefix, cpu_nr(processor) + 1, cia); \ | |
81 | printf_filtered ARGS; \ | |
82 | } \ | |
83 | } while (0) | |
84 | /* device */ | |
85 | #define DTRACE(OBJECT, ARGS) \ | |
86 | do { \ | |
87 | if (ppc_trace[trace_devices] || ppc_trace[trace_##OBJECT##_device]) { \ | |
88 | printf_filtered("%s:%d:%s: ", filter_filename(__FILE__), __LINE__, #OBJECT); \ | |
89 | printf_filtered ARGS; \ | |
90 | } \ | |
91 | } while (0) | |
92 | #else | |
93 | #define TRACE(OBJECT, ARGS) | |
94 | #define ITRACE(OBJECT, ARGS) | |
95 | #define DTRACE(OBJECT, ARGS) | |
96 | #endif | |
97 | ||
98 | #if WITH_ASSERT | |
99 | #define ASSERT(EXPRESSION) \ | |
100 | do { \ | |
101 | if (!(EXPRESSION)) { \ | |
102 | error("%s:%d: assertion failed - %s\n", \ | |
103 | filter_filename(__FILE__), __LINE__, #EXPRESSION); \ | |
104 | } \ | |
105 | } while (0) | |
106 | #else | |
107 | #define ASSERT(EXPRESSION) | |
108 | #endif | |
109 | ||
110 | /* Parse OPTION updating the trace array */ | |
111 | extern void | |
112 | trace_option(const char *option); | |
113 | ||
114 | /* Output the list of trace options */ | |
115 | extern void | |
116 | trace_usage(void); | |
117 | ||
118 | ||
119 | #endif /* _DEBUG_H_ */ |