2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: include/internal/debug.h
5 * PURPOSE: Useful debugging macros
6 * PROGRAMMER: David Welch (welch@mcmail.com)
12 * NOTES: Define DBG in configuration file for "checked" version
13 * Define NDEBUG before including this header to disable debugging
15 * Define NASSERT before including this header to disable assertions
18 #ifndef __INTERNAL_DEBUG
19 #define __INTERNAL_DEBUG
21 #include <internal/ntoskrnl.h>
22 #include <internal/dbg.h>
25 #define UNIMPLEMENTED do {DbgPrint("%s at %s:%d is unimplemented, have a nice day\n",__FUNCTION__,__FILE__,__LINE__); for(;;); } while(0);
30 /* Assert only on "checked" version */
32 #define assert(x) if (!(x)) {DbgPrint("Assertion "#x" failed at %s:%d\n", __FILE__,__LINE__); KeBugCheck(0); }
34 #define assertmsg(_c_, _m_) \
36 DbgPrint("(%s:%d)(%s) ", __FILE__, __LINE__, __FUNCTION__); \
44 #define assertmsg(_c_, _m_)
48 /* Print if using a "checked" version */
49 #define CPRINT(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
53 #define CPRINT(args...)
55 #define assertmsg(_c_, _m_)
59 #define DPRINT1(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
60 #define CHECKPOINT1 do { DbgPrint("%s:%d\n",__FILE__,__LINE__); } while(0);
62 #if defined(KDBG) && defined(NDEBUG) && defined(__NTOSKRNL__)
64 #define DPRINT(args...) do { \
65 if (DbgShouldPrint(__FILE__)) { \
66 DbgPrint("(%s:%d) ",__FILE__,__LINE__); \
73 #else /* KDBG && NDEBUG && __NTOSKRNL__ */
76 #define DPRINT(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
77 #define CHECKPOINT do { DbgPrint("%s:%d\n",__FILE__,__LINE__); ExAllocatePool(NonPagedPool,0); } while(0);
79 #define DPRINT(args...)
83 #endif /* KDBG && NDEBUG */
86 * FUNCTION: Assert a maximum value for the current irql
90 #define ASSERT_IRQL(x) assert(KeGetCurrentIrql()<=(x))
91 #define assert_irql(x) assert(KeGetCurrentIrql()<=(x))
93 #endif /* __INTERNAL_DEBUG */