1 /* $NetBSD: kerndebug.h,v 1.3 2005/12/11 12:19:02 christos Exp $ */
5 * Digital Equipment Corporation. All rights reserved.
7 * This software is furnished under license and may be used and
8 * copied only in accordance with the following terms and conditions.
9 * Subject to these conditions, you may download, copy, install,
10 * use, modify and distribute this software in source and/or binary
11 * form. No title or ownership is transferred hereby.
13 * 1) Any source code used, modified or distributed must reproduce
14 * and retain this copyright notice and list of conditions as
15 * they appear in the source file.
17 * 2) No right is granted to use any trade name, trademark, or logo of
18 * Digital Equipment Corporation. Neither the "Digital Equipment
19 * Corporation" name nor any trademark or logo of Digital Equipment
20 * Corporation may be used to endorse or promote products derived
21 * from this software without the prior written permission of
22 * Digital Equipment Corporation.
24 * 3) This software is provided "AS-IS" and any express or implied
25 * warranties, including but not limited to, any implied warranties
26 * of merchantability, fitness for a particular purpose, or
27 * non-infringement are disclaimed. In no event shall DIGITAL be
28 * liable for any damages whatsoever, and in particular, DIGITAL
29 * shall not be liable for special, indirect, consequential, or
30 * incidental damages or damages for lost profits, loss of
31 * revenue or loss of use, whether such damages arise in contract,
32 * negligence, tort, under statute, in equity, at law or otherwise,
33 * even if advised of the possibility of such damage.
45 ** This header provides generic debugging capabilities using printf.
46 ** All debugging can be compiled out by not defining the
47 ** KERNEL_DEBUG macro. In addition the amount of debug output is
48 ** defined by individual variables controlled by each subsystem
49 ** using this utility. Finally note that the two middle bytes of
50 ** the kern debug flags (bits 16 to 23) are free for individual
51 ** subsystems to use as they please (eg. define switches for
52 ** individual functions etc).
58 ** CREATION DATE: 2-Feb-1992
60 ** MODIFICATION HISTORY:
67 #define KERN_DEBUG_INFO 0x00000001
68 #define KERN_DEBUG_WARNING 0x00000002
69 #define KERN_DEBUG_ERROR 0x00000010
70 #define KERN_DEBUG_SMP 0x00000020
71 #define KERN_DEBUG_PANIC 0x40000000
72 #define KERN_REAL_PANIC 0x80000000
73 #define KERN_DEBUG_ALL KERN_DEBUG_INFO | KERN_DEBUG_WARNING | \
74 KERN_DEBUG_ERROR | KERN_DEBUG_PANIC
76 ** Define the type for debugging flag subsystem variables
78 typedef unsigned int Kern_Debug_Flags
;
80 ** Set up source line location macro for extra debugging and panics
83 #define KERN_DEBUG_LOC ":%s:%d:=\n\t",__FILE__,__LINE__
85 #define KERN_DEBUG_LOC ":__FILE__ not supported :=\n\t"
89 ** This is real nasty in that it requires several printf's but is
90 ** unavoidable due to the differences between
91 ** preprocessors supporting standard ANSI C and others.
93 ** NOTE: The format of calls to this macro must be
95 ** KERN_DEBUG((Kern_Debug_Flags)CntrlVar, KERN_DEBUG_xxxx,
96 ** (normal printf arguments));
98 ** pay special attention to the extra set of () around the
103 #define KERN_DEBUG(CntrlVar,Level,Output) \
105 if ( (CntrlVar) & (Level) ) \
107 if ( (CntrlVar) & (Level) & KERN_DEBUG_PANIC ) \
109 printf ("KERNEL:DEBUG PANIC"); \
110 printf (KERN_DEBUG_LOC); \
112 panic("KERN_DEBUG Panicking"); \
120 #else /* else KERNEL_DEBUG not defined */
121 #define KERN_DEBUG(CntrlVar,Level,Output)
122 #endif /* end else KERNEL_DEBUG not defined */
124 #endif /* _KERNDEBUG_H_ */