top manpage update
[minix.git] / kernel / debug.h
blobcf376434aa1ad7b1efeab181f1c109aebdd73b0e
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 ENTERED 0xBA5E1514
45 #define NOTENTERED 0x1415BEE1
47 #define NOREC_ENTER(varname) \
48 static int varname = NOTENTERED; \
49 vmassert(varname == ENTERED || varname == NOTENTERED); \
50 vmassert(magictest == MAGICTEST); \
51 vmassert(varname != ENTERED); \
52 varname = ENTERED;
54 #define NOREC_RETURN(varname, v) do { \
55 vmassert(magictest == MAGICTEST); \
56 vmassert(varname == ENTERED || varname == NOTENTERED); \
57 varname = NOTENTERED; \
58 return v; \
59 } while(0)
61 #if DEBUG_VMASSERT
62 #define vmassert(t) { \
63 if(!(t)) { minix_panic("vm: assert " #t " failed in " __FILE__, __LINE__); } }
64 #else
65 #define vmassert(t) { }
66 #endif
68 #define NOT_REACHABLE do { \
69 printf("NOT_REACHABLE at %s:%d\n", __FILE__, __LINE__); \
70 minix_panic("execution at an unexpected location\n", NO_NUM); \
71 for(;;); \
72 } while(0)
74 #define NOT_IMPLEMENTED do { \
75 printf("NOT_IMPLEMENTED at %s:%d\n", __FILE__, __LINE__); \
76 minix_panic("NOT_IMPLEMENTED", NO_NUM); \
77 } while(0)
79 #ifdef CONFIG_BOOT_VERBOSE
80 #define BOOT_VERBOSE(x) x
81 #else
82 #define BOOT_VERBOSE(x)
83 #endif
85 #ifdef _SYSTEM
86 #define DEBUG_PRINT(params, level) do { \
87 if (verboseboot >= (level)) printf params; } while (0)
88 #define DEBUGBASIC(params) DEBUG_PRINT(params, VERBOSEBOOT_BASIC)
89 #define DEBUGMAX(params) DEBUG_PRINT(params, VERBOSEBOOT_MAX)
90 #endif
92 #endif /* DEBUG_H */