xref: /minix/minix/kernel/debug.h (revision fb9c64b2)
1 #ifndef DEBUG_H
2 #define DEBUG_H
3 
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  */
9 
10 #ifndef __ASSEMBLY__
11 #include <minix/debug.h>
12 #include "config.h"
13 #endif
14 
15 /* Debug info via serial (see ser_debug()) */
16 #define DEBUG_SERIAL			1
17 
18 /* Enable prints such as
19  *  . send/receive failed due to deadlock or dead source or dead destination
20  *  . trap not allowed
21  *  . bogus message pointer
22  *  . kernel call number not allowed by this process
23  *
24  * Of course the call still fails, but nothing is printed if these warnings
25  * are disabled.
26  */
27 #define DEBUG_ENABLE_IPC_WARNINGS	1
28 
29 /* Sanity checks. */
30 #define DEBUG_SANITYCHECKS		0
31 
32 /* Verbose messages. */
33 #define DEBUG_TRACE			0
34 
35 /* DEBUG_RACE makes every process preemptible, schedules
36  * every process on the same priority queue, and randomizes
37  * the next process to run, in order to help catch race
38  * conditions that could otherwise be masked.
39  */
40 #define DEBUG_RACE			0
41 
42 /* DEBUG_DUMPIPC dumps all IPC to serial; due to the amount of logging it is
43  * strongly recommended to set "ctty 0" in the boot monitor and run inside a
44  * virtual machine if you enable this; on the hardware it would take forever
45  * just to boot
46  */
47 #define DEBUG_DUMPIPC			0
48 
49 /* DEBUG_DUMPIPCF dumps filtered IPC to serial.
50  */
51 #define DEBUG_DUMPIPCF			0
52 
53 /* If defined, restrict DEBUG_DUMPIPC to particular process names */
54 /* #define DEBUG_DUMPIPC_NAMES		{ "tty", "pty" } */
55 
56 /* DEBUG_IPCSTATS collects information on who sends messages to whom. */
57 #define DEBUG_IPCSTATS			0
58 
59 #if !USE_SYSDEBUG
60 #undef DEBUG_SERIAL
61 #undef DEBUG_ENABLE_IPC_WARNINGS
62 #endif
63 
64 #if DEBUG_DUMPIPC || DEBUG_IPCSTATS	/* either of these needs the hook */
65 #define DEBUG_IPC_HOOK			1
66 #endif
67 
68 #if DEBUG_TRACE
69 
70 #define VF_SCHEDULING		(1L << 1)
71 #define VF_PICKPROC		(1L << 2)
72 
73 #define TRACE(code, statement) if(verboseflags & code) { printf("%s:%d: ", __FILE__, __LINE__); statement }
74 
75 #else
76 #define TRACE(code, statement)
77 #endif
78 
79 #ifdef CONFIG_BOOT_VERBOSE
80 #define BOOT_VERBOSE(x)	x
81 #else
82 #define BOOT_VERBOSE(x)
83 #endif
84 
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 DEBUGEXTRA(params) DEBUG_PRINT(params, VERBOSEBOOT_EXTRA)
90 #define DEBUGMAX(params)   DEBUG_PRINT(params, VERBOSEBOOT_MAX)
91 #endif
92 
93 #endif /* DEBUG_H */
94