1 /*  Part of SWI-Prolog
2 
3     Author:        Keri Harris
4     E-mail:        keri.harris@securitease.com
5     WWW:           http://www.swi-prolog.org
6     Copyright (c)  2011-2018, University of Amsterdam
7 			      CWI, Amsterdam
8     All rights reserved.
9 
10     Redistribution and use in source and binary forms, with or without
11     modification, are permitted provided that the following conditions
12     are met:
13 
14     1. Redistributions of source code must retain the above copyright
15        notice, this list of conditions and the following disclaimer.
16 
17     2. Redistributions in binary form must reproduce the above copyright
18        notice, this list of conditions and the following disclaimer in
19        the documentation and/or other materials provided with the
20        distribution.
21 
22     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23     "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25     FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26     COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28     BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31     LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32     ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33     POSSIBILITY OF SUCH DAMAGE.
34 */
35 
36 #ifndef PL_DEBUG_INCLUDED
37 #define PL_DEBUG_INCLUDED 1
38 
39 #define MAX_TOPIC_LEN 32
40 
41 #define DBG_LEVEL0  0
42 #define DBG_LEVEL1  1
43 #define DBG_LEVEL2  2
44 #define DBG_LEVEL3  3
45 #define DBG_LEVEL4  4
46 #define DBG_LEVEL5  5
47 #define DBG_LEVEL6  6
48 #define DBG_LEVEL7  7
49 #define DBG_LEVEL8  8
50 #define DBG_LEVEL9  9
51 
52 #define	MSG_VMI			 10
53 #define	MSG_CLEANUP		 11
54 #define	MSG_PROLOG_FLAG		 12
55 #define	MSG_HASH_STAT		 13
56 #define	MSG_SPARE_STACK		 14
57 #define	MSG_THREAD		 15
58 #define MSG_THROW		 16
59 #define MSG_CALL		 17
60 #define MSG_SRCLOC		 18
61 #define MSG_PROC		 19
62 
63 #define MSG_COMP_ARGVAR		 20
64 #define MSG_UNLOAD		 21
65 #define MSG_INDEX_FIND		 22
66 #define MSG_INDEX_UPDATE	 23
67 #define MSG_INDEX_DEEP		 24
68 #define MSG_TRACE		 25
69 
70 #define MSG_QLF_INTEGER		 26
71 #define MSG_QLF_FLOAT		 27
72 #define MSG_QLF_XR		 28
73 #define MSG_QLF_TERM		 29
74 #define MSG_QLF_DIRECTIVE	 30
75 #define MSG_QLF_PREDICATE	 31
76 #define MSG_QLF_EXPORT		 32
77 #define MSG_QLF_VMI		 33
78 #define MSG_QLF_PATH		 34
79 #define MSG_QLF_SECTION		 35
80 #define MSG_QLF_BOOT		 36
81 #define MSG_QLF_BOOT_READ	 37
82 #define MSG_QLF_LABEL		 38
83 #define MSG_PROC_COUNT		 39
84 #define MSG_CUT			 40
85 
86 #define MSG_QUEUE		 41
87 #define MSG_QUEUE_WAIT		 42
88 #define MSG_SIGNAL		 43
89 #define MSG_COMP_VARS		 44
90 #define MSG_DICT		 45
91 #define MSG_PROF_CALLTREE	 46
92 #define MSG_PROF_TICKS		 47
93 #define MSG_INFERENCE_LIMIT	 48
94 #define MSG_NSOLS		 40
95 #define MSG_SRCFILE		 50
96 #define MSG_SRCFILE_REF		 51
97 #define MSG_DESTROY_MODULE	 52
98 #define MSG_CREATE_MODULE	 53
99 #define MSG_QUEUE_GC		 54
100 #define MSG_ACYCLIC		 55
101 #define MSG_OPERATOR		 56
102 #define MSG_MUTEX_GC		 57
103 #define MSG_REC_ATTVAR		 58
104 #define MSG_TTY			 59
105 #define MSG_OS_DIR		 60
106 
107 #define MSG_READ_TOKEN		 65
108 
109 #define MSG_CONTINUE		 70
110 
111 #define MSG_CLEANUP_THREAD	 80
112 #define MSG_INITIALISE		 81
113 
114 #define MSG_BACKTRACK		 90
115 
116 						/* GC messages */
117 #define	MSG_AGC			 100
118 #define	MSG_CLAUSE_GC		 101
119 #define	MSG_GC_STATS		 102
120 #define	MSG_GC_SCHEDULE		 103
121 #define	MSG_GC_PROGRESS		 104
122 #define	MSG_GC_MARK_VAR		 105
123 #define	MSG_GC_MARK_GVAR	 106
124 #define	MSG_GC_MARK_ATTVAR	 107
125 #define	MSG_GC_MARK_TERMREF	 108
126 #define	MSG_GC_MARK_FOREIGN	 109
127 #define	MSG_GC_MARK_ARGS	 110
128 #define	MSG_GC_MARK_QUERY	 111
129 #define	MSG_GC_MARK_VAR_WALK	 112
130 #define	MSG_GC_CLEAR		 113
131 #define	MSG_GC_ASSIGNMENTS	 114
132 #define	MSG_GC_ASSIGNMENTS_MERGE 115
133 #define	MSG_GC_ASSIGNMENTS_MARK	 116
134 #define	MSG_GC_RESET		 117
135 #define	MSG_GC_WALK		 118
136 #define	MSG_GC_RELOC		 119
137 #define	MSG_GC_HOLE		 120
138 #define	MSG_GC_SWEEP		 121
139 #define	MSG_GC_CHECK		 122
140 #define	MSG_SHIFT		 123
141 #define	MSG_SHIFT_PROGRESS	 124
142 #define	MSG_SHIFT_POINTER	 125
143 #define	MSG_SHIFT_FRAME		 126
144 #define	MSG_STACK_OVERFLOW	 127
145 #define MSG_UNWIND_EXCEPTION	 128
146 
147 #define MSG_ATTVAR_LINK		 150
148 #define MSG_CALL_RESIDUE_VARS	 151
149 #define MSG_SOFTCUT		 152
150 #define MSG_WAKEUP		 153
151 
152 #define MSG_HASH_TABLE_API	 160
153 #define MSG_HASH_TABLE_KVS	 161
154 #define MSG_HASH_TABLE_ENUM	 162
155 
156 #define MSG_CGC			 170
157 #define MSG_CGC_CREF		 171
158 #define MSG_CGC_CREF_PL		 172
159 #define MSG_CGC_CREF_TRACK	 173
160 #define MSG_CGC_PRED		 174
161 #define MSG_CGC_CONSIDER	 175
162 #define MSG_CGC_STACK		 176
163 #define MSG_CGC_PRED_REF	 177
164 #define MSG_CGC_RETRACT		 178
165 #define MSG_CGC_GENERATION	 179
166 
167 #define MSG_JIT			 180
168 #define MSG_JIT_DELINDEX	 181
169 #define MSG_JIT_POOR		 182
170 
171 #define MSG_RECONSULT		 190
172 #define MSG_RECONSULT_PRED	 191
173 #define MSG_RECONSULT_CLAUSE	 192
174 #define MSG_RECONSULT_MODULE	 193
175 
176 #define MSG_TRIE_PUT_TERM	 200
177 #define MSG_TRIE_GC		 201
178 #define MSG_TRIE_GEN		 202
179 #define MSG_TRIE_VM		 203
180 
181 #define MSG_THREAD_LOCAL	 240
182 
183 #define MSG_ZIP			 250
184 #define MSG_ZIP_STATE		 251
185 #define MSG_WIN_API		 252
186 #define MSG_WIN_DDE		 253
187 
188 #define MSG_MODULE_REF		 260
189 
190 #define MSG_STRING_BUFFER	 270
191 
192 #define MSG_TABLING_WORK	 300
193 #define MSG_TABLING_MODED	 301
194 #define MSG_TABLING_NEG		 302
195 #define MSG_TABLING_SIMPLIFY	 303
196 #define MSG_TABLING_DELAY	 304
197 #define MSG_TABLING_DELAY_VAR	 305
198 #define MSG_TABLING_AC		 306
199 #define MSG_TABLING_MERGE	 307
200 #define MSG_TABLING_VTRIE_DEPENDENCIES 308
201 #define MSG_TABLING_IDG		 309
202 #define MSG_TABLING_IDG_CHANGED	 310
203 #define MSG_TABLING_IDG_REEVAL	 311
204 #define MSG_TABLING_EXCEPTION	 312
205 #define MSG_TABLING_SHARED	 313
206 #define MSG_TABLING_ABOLISH	 314
207 #define MSG_TABLING_CALL_SUBSUMPTION 315
208 #define MSG_TABLING_RESTRAINT	 316
209 
210 #define TABLING_NO_EARLY_COMPLETION 320
211 #define TABLING_NO_SIMPLIFY	 321		/* these affect behaviour */
212 #define TABLING_NO_AC		 322
213 
214 #define CHK_SECURE              1000
215 #define CHK_HIGH_ARITY          1001
216 #define CHK_HIGHER_ADDRESS      1002
217 #define CHK_ATOM_GARBAGE_COLLECTED 1003
218 
219 typedef struct debug_topic
220 { unsigned	code;
221   const char   *name;
222 } debug_topic;
223 
224 COMMON(void)	cleanupDebug(void);
225 COMMON(int)	prolog_debug_from_string(const char *spec, int flag);
226 
227 #endif /*PL_DEBUG_INCLUDED*/
228