3.1.7 branch.
[minix.git] / kernel / debug.h
blob78c4b9948eb4b0e9f4446a7a555a6bb04c5704d9
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 /* Sanity checks. */
28 #define DEBUG_SANITYCHECKS 0
30 /* Verbose messages. */
31 #define DEBUG_TRACE 0
33 /* DEBUG_RACE makes every process preemptible, schedules
34 * every process on the same priority queue, and randomizes
35 * the next process to run, in order to help catch race
36 * conditions that could otherwise be masked.
38 #define DEBUG_RACE 0
40 #if DEBUG_TRACE
42 #define VF_SCHEDULING (1L << 1)
43 #define VF_PICKPROC (1L << 2)
45 #define TRACE(code, statement) if(verboseflags & code) { printf("%s:%d: ", __FILE__, __LINE__); statement }
47 #else
48 #define TRACE(code, statement)
49 #endif
51 #define NOT_REACHABLE do { \
52 panic("NOT_REACHABLE at %s:%d", __FILE__, __LINE__); \
53 for(;;); \
54 } while(0)
56 #define NOT_IMPLEMENTED do { \
57 panic("NOT_IMPLEMENTED at %s:%d", __FILE__, __LINE__); \
58 } while(0)
60 #ifdef CONFIG_BOOT_VERBOSE
61 #define BOOT_VERBOSE(x) x
62 #else
63 #define BOOT_VERBOSE(x)
64 #endif
66 #ifdef _SYSTEM
67 #define DEBUG_PRINT(params, level) do { \
68 if (verboseboot >= (level)) printf params; } while (0)
69 #define DEBUGBASIC(params) DEBUG_PRINT(params, VERBOSEBOOT_BASIC)
70 #define DEBUGEXTRA(params) DEBUG_PRINT(params, VERBOSEBOOT_EXTRA)
71 #define DEBUGMAX(params) DEBUG_PRINT(params, VERBOSEBOOT_MAX)
72 #endif
74 #endif /* DEBUG_H */