connect OSS to the build (clean and install only)
[minix.git] / kernel / debug.h
blobe9de2a5ca79aee75249c0c725318f2d86591c0d9
1 #ifndef DEBUG_H
2 #define DEBUG_H
4 /* This header file defines all debugging constants and macros, and declares
5 * some variables. Certain debugging features redefine standard constants
6 * and macros. Therefore, this header file should be included after the
7 * other kernel headers.
8 */
10 #include <ansi.h>
11 #include <minix/debug.h>
12 #include "config.h"
14 /* Enable prints such as
15 * . send/receive failed due to deadlock or dead source or dead destination
16 * . trap not allowed
17 * . bogus message pointer
18 * . kernel call number not allowed by this process
20 * Of course the call still fails, but nothing is printed if these warnings
21 * are disabled.
23 #define DEBUG_ENABLE_IPC_WARNINGS 1
24 #define DEBUG_STACKTRACE 1
25 #define DEBUG_TIME_LOCKS 1
27 /* Runtime sanity checking. */
28 #define DEBUG_VMASSERT 0
29 #define DEBUG_SCHED_CHECK 0
30 #define DEBUG_STACK_CHECK 0
31 #define DEBUG_TRACE 0
33 #if DEBUG_TRACE
35 #define VF_SCHEDULING (1L << 1)
36 #define VF_PICKPROC (1L << 2)
38 #define TRACE(code, statement) if(verboseflags & code) { printf("%s:%d: ", __FILE__, __LINE__); statement }
40 #else
41 #define TRACE(code, statement)
42 #endif
44 #define NOREC_ENTER(varname) \
45 static int varname = 0; \
46 int mustunlock = 0; \
47 if(!intr_disabled()) { lock; mustunlock = 1; } \
48 if(varname) { \
49 minix_panic(#varname " recursive enter", __LINE__); \
50 } \
51 varname = 1;
53 #define NOREC_RETURN(varname, v) do { \
54 if(!varname) \
55 minix_panic(#varname " flag off", __LINE__); \
56 if(!intr_disabled()) \
57 minix_panic(#varname " interrupts on", __LINE__); \
58 varname = 0; \
59 if(mustunlock) { unlock; } \
60 return v; \
61 } while(0)
63 #if DEBUG_VMASSERT
64 #define vmassert(t) { \
65 if(!(t)) { minix_panic("vm: assert " #t " failed\n", __LINE__); } }
66 #else
67 #define vmassert(t) { }
68 #endif
70 #define NOT_REACHABLE(__x) do { \
71 kprintf("NOT_REACHABLE at %s:%d\n", __FILE__, __LINE__); \
72 minix_panic("execution at an unexpected location\n", NO_NUM); \
73 for(;;); \
74 } while(0)
76 #endif /* DEBUG_H */