1433d6423SLionel Sambuc #ifndef DEBUG_H 2433d6423SLionel Sambuc #define DEBUG_H 3433d6423SLionel Sambuc 4433d6423SLionel Sambuc /* This header file defines all debugging constants and macros, and declares 5433d6423SLionel Sambuc * some variables. Certain debugging features redefine standard constants 6433d6423SLionel Sambuc * and macros. Therefore, this header file should be included after the 7433d6423SLionel Sambuc * other kernel headers. 8433d6423SLionel Sambuc */ 9433d6423SLionel Sambuc 10433d6423SLionel Sambuc #ifndef __ASSEMBLY__ 11433d6423SLionel Sambuc #include <minix/debug.h> 12433d6423SLionel Sambuc #include "config.h" 13433d6423SLionel Sambuc #endif 14433d6423SLionel Sambuc 15433d6423SLionel Sambuc /* Debug info via serial (see ser_debug()) */ 16433d6423SLionel Sambuc #define DEBUG_SERIAL 1 17433d6423SLionel Sambuc 18433d6423SLionel Sambuc /* Enable prints such as 19433d6423SLionel Sambuc * . send/receive failed due to deadlock or dead source or dead destination 20433d6423SLionel Sambuc * . trap not allowed 21433d6423SLionel Sambuc * . bogus message pointer 22433d6423SLionel Sambuc * . kernel call number not allowed by this process 23433d6423SLionel Sambuc * 24433d6423SLionel Sambuc * Of course the call still fails, but nothing is printed if these warnings 25433d6423SLionel Sambuc * are disabled. 26433d6423SLionel Sambuc */ 27433d6423SLionel Sambuc #define DEBUG_ENABLE_IPC_WARNINGS 1 28433d6423SLionel Sambuc 29433d6423SLionel Sambuc /* Sanity checks. */ 30433d6423SLionel Sambuc #define DEBUG_SANITYCHECKS 0 31433d6423SLionel Sambuc 32433d6423SLionel Sambuc /* Verbose messages. */ 33433d6423SLionel Sambuc #define DEBUG_TRACE 0 34433d6423SLionel Sambuc 35433d6423SLionel Sambuc /* DEBUG_RACE makes every process preemptible, schedules 36433d6423SLionel Sambuc * every process on the same priority queue, and randomizes 37433d6423SLionel Sambuc * the next process to run, in order to help catch race 38433d6423SLionel Sambuc * conditions that could otherwise be masked. 39433d6423SLionel Sambuc */ 40433d6423SLionel Sambuc #define DEBUG_RACE 0 41433d6423SLionel Sambuc 42433d6423SLionel Sambuc /* DEBUG_DUMPIPC dumps all IPC to serial; due to the amount of logging it is 43433d6423SLionel Sambuc * strongly recommended to set "ctty 0" in the boot monitor and run inside a 44433d6423SLionel Sambuc * virtual machine if you enable this; on the hardware it would take forever 45433d6423SLionel Sambuc * just to boot 46433d6423SLionel Sambuc */ 47433d6423SLionel Sambuc #define DEBUG_DUMPIPC 0 48433d6423SLionel Sambuc 49c8a9900bSCristiano Giuffrida /* DEBUG_DUMPIPCF dumps filtered IPC to serial. 50c8a9900bSCristiano Giuffrida */ 51c8a9900bSCristiano Giuffrida #define DEBUG_DUMPIPCF 0 52c8a9900bSCristiano Giuffrida 53433d6423SLionel Sambuc /* If defined, restrict DEBUG_DUMPIPC to particular process names */ 54*c5da0dffSDavid van Moolenbroek /* #define DEBUG_DUMPIPC_NAMES { "tty", "pty" } */ 55433d6423SLionel Sambuc 56433d6423SLionel Sambuc /* DEBUG_IPCSTATS collects information on who sends messages to whom. */ 57433d6423SLionel Sambuc #define DEBUG_IPCSTATS 0 58433d6423SLionel Sambuc 59433d6423SLionel Sambuc #if !USE_SYSDEBUG 60433d6423SLionel Sambuc #undef DEBUG_SERIAL 61433d6423SLionel Sambuc #undef DEBUG_ENABLE_IPC_WARNINGS 62433d6423SLionel Sambuc #endif 63433d6423SLionel Sambuc 64433d6423SLionel Sambuc #if DEBUG_DUMPIPC || DEBUG_IPCSTATS /* either of these needs the hook */ 65433d6423SLionel Sambuc #define DEBUG_IPC_HOOK 1 66433d6423SLionel Sambuc #endif 67433d6423SLionel Sambuc 68433d6423SLionel Sambuc #if DEBUG_TRACE 69433d6423SLionel Sambuc 70433d6423SLionel Sambuc #define VF_SCHEDULING (1L << 1) 71433d6423SLionel Sambuc #define VF_PICKPROC (1L << 2) 72433d6423SLionel Sambuc 73433d6423SLionel Sambuc #define TRACE(code, statement) if(verboseflags & code) { printf("%s:%d: ", __FILE__, __LINE__); statement } 74433d6423SLionel Sambuc 75433d6423SLionel Sambuc #else 76433d6423SLionel Sambuc #define TRACE(code, statement) 77433d6423SLionel Sambuc #endif 78433d6423SLionel Sambuc 79433d6423SLionel Sambuc #ifdef CONFIG_BOOT_VERBOSE 80433d6423SLionel Sambuc #define BOOT_VERBOSE(x) x 81433d6423SLionel Sambuc #else 82433d6423SLionel Sambuc #define BOOT_VERBOSE(x) 83433d6423SLionel Sambuc #endif 84433d6423SLionel Sambuc 85433d6423SLionel Sambuc #ifdef _SYSTEM 86433d6423SLionel Sambuc #define DEBUG_PRINT(params, level) do { \ 87433d6423SLionel Sambuc if (verboseboot >= (level)) printf params; } while (0) 88433d6423SLionel Sambuc #define DEBUGBASIC(params) DEBUG_PRINT(params, VERBOSEBOOT_BASIC) 89433d6423SLionel Sambuc #define DEBUGEXTRA(params) DEBUG_PRINT(params, VERBOSEBOOT_EXTRA) 90433d6423SLionel Sambuc #define DEBUGMAX(params) DEBUG_PRINT(params, VERBOSEBOOT_MAX) 91433d6423SLionel Sambuc #endif 92433d6423SLionel Sambuc 93433d6423SLionel Sambuc #endif /* DEBUG_H */ 94