BlitzMax Extended  0.8.18
Pushing Blitz to the Max.
blitz_debug.h
Go to the documentation of this file.
1 
16 #ifndef BLITZ_DEBUG_H
17 #define BLITZ_DEBUG_H
18 
19 #include "_common.h"
20 
21 BB_BEGIN_DECLS
22 
23 #ifdef BB_DEBUG
24 void bb_assert(const char *expr, const char *file, int line, const char *msg, ...);
25 
37 # define BB_ASSERT(expr, msg, ...) \
38  if (!(expr)) { bb_assert(#expr, __FILE__, __LINE__, (msg), ##__VA_ARGS__); }
39 #else
40 # define BB_ASSERT(expr, msg, ...)
41 #endif
42 
48 {
51 
54 
57 
60 
63 
66 
72 
75 };
76 
77 typedef enum BBDebugDeclKind BBDebugDeclKind;
78 
85 {
88 
90  const char *name;
91 
93  const char *type_tag;
94 
95  union {
96  BBString* const_value;
97  BBSize local_offset;
98  BBSize field_offset;
99  void *global_address;
100  };
101 };
102 
103 typedef struct BBDebugDecl BBDebugDecl;
104 
110 {
113 
116 
119 };
120 
122 
132 {
135 
137  const char *name;
138 
141 };
142 
143 #ifdef BB_INCLUDE_INTERNALS
144 
145 // Used internally to create debug scopes for BlitzMax classes
146 // implemented in C e.g. bbRuntimeExceptionClass
147 typedef struct bb_debugscope_s
148 {
149  BBDebugScopeKind kind;
150  const char *name;
151  BBDebugDecl decls[];
152 } bb_debugscope_t;
153 
154 #endif // BB_INCLUDE_INTERNALS
155 
160 {
162  const char *source_file;
163 
165  BBSize line_num;
166 
168  BBSize char_num;
169 };
170 
171 typedef struct BBDebugStm BBDebugStm;
172 typedef struct BBDebugScope BBDebugScope;
173 
174 extern void (*bbOnDebugStop)();
175 extern void (*bbOnDebugLog)(BBString *msg);
176 extern void (*bbOnDebugEnterStm)(BBDebugStm *stm);
177 extern void (*bbOnDebugEnterScope)(BBDebugScope *scope, void *inst);
178 extern void (*bbOnDebugLeaveScope)();
179 extern void (*bbOnDebugPushExState)();
180 extern void (*bbOnDebugPopExState)();
181 extern void (*bbOnDebugUnhandledEx)(BBObject *ex);
182 
183 
184 #ifndef BB_DISABLE_DEPRECATED
185 
186 extern void bbCAssertEx();
187 
188 #ifndef NDEBUG
189 # define bbassert(expr) if (!(expr)) { bbCAssertEx(); }
190 #else
191 # define bbassert(expr)
192 #endif
193 
194 #endif // !BB_DISABLE_DEPRECATED
195 
196 BB_END_DECLS
197 
198 #endif // BLITZ_DEBUG_H