ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

debug.h
Go to the documentation of this file.
00001 /*
00002  * COPYRIGHT:       See COPYING in the top level directory
00003  * PROJECT:         ReactOS kernel
00004  * FILE:            include/internal/debug.h
00005  * PURPOSE:         Useful debugging macros
00006  * PROGRAMMER:      David Welch (welch@mcmail.com)
00007  * UPDATE HISTORY:
00008  *                28/05/98: Created
00009  */
00010 
00011 /*
00012  * NOTE: Define NDEBUG before including this header to disable debugging
00013  * macros
00014  */
00015 
00016 #ifndef __INTERNAL_DEBUG
00017 #define __INTERNAL_DEBUG
00018 
00019 /* Define DbgPrint/DbgPrintEx/RtlAssert unless the NDK is used */
00020 #if !defined(_RTLFUNCS_H) && !defined(_NTDDK_)
00021 
00022 /* Make sure we have basic types (some people include us *before* SDK... */
00023 #if !defined(_NTDEF_) && !defined(_NTDEF_H) && !defined(_WINDEF_) && !defined(_WINDEF_H)
00024 #error Please include SDK first.
00025 #endif
00026 
00027 ULONG
00028 __cdecl
00029 DbgPrint(
00030     IN PCCH  Format,
00031     IN ...
00032 );
00033 
00034 NTSYSAPI
00035 ULONG
00036 __cdecl
00037 DbgPrintEx(
00038     IN ULONG ComponentId,
00039     IN ULONG Level,
00040     IN PCCH  Format,
00041     IN ...
00042 );
00043 
00044 NTSYSAPI
00045 VOID
00046 NTAPI
00047 RtlAssert(
00048     PVOID FailedAssertion,
00049     PVOID FileName,
00050     ULONG LineNumber,
00051     PCHAR Message
00052 );
00053 
00054 #endif /* !defined(_RTLFUNCS_H) && !defined(_NTDDK_) */
00055 
00056 #ifndef assert
00057 #ifndef NASSERT
00058 #define assert(x) if (!(x)) {RtlAssert((PVOID)#x,(PVOID)__FILE__,__LINE__, ""); }
00059 #else
00060 #define assert(x)
00061 #endif
00062 #endif
00063 
00064 #ifndef ASSERT
00065 #ifndef NASSERT
00066 #define ASSERT(x) if (!(x)) {RtlAssert((PVOID)#x,(PVOID)__FILE__,__LINE__, ""); }
00067 #else
00068 #define ASSERT(x)
00069 #endif
00070 #endif
00071 
00072 #ifndef ASSERTMSG
00073 #ifndef NASSERT
00074 #define ASSERTMSG(x,m) if (!(x)) {RtlAssert((PVOID)#x,__FILE__,__LINE__, m); }
00075 #else
00076 #define ASSERTMSG(x)
00077 #endif
00078 #endif
00079 
00080 /* Print stuff only on Debug Builds*/
00081 #define DPFLTR_DEFAULT_ID -1
00082 #if DBG
00083 
00084     /* These are always printed */
00085     #define DPRINT1(fmt, ...) do { \
00086         if (DbgPrint("(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__))  \
00087             DbgPrint("(%s:%d) DbgPrint() failed!\n", __FILE__, __LINE__); \
00088     } while (0)
00089 
00090     /* These are printed only if NDEBUG is NOT defined */
00091     #ifndef NDEBUG
00092 
00093         #define DPRINT(fmt, ...) do { \
00094             if (DbgPrint("(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__))  \
00095                 DbgPrint("(%s:%d) DbgPrint() failed!\n", __FILE__, __LINE__); \
00096         } while (0)
00097 
00098     #else
00099 
00100         #define DPRINT(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
00101 
00102     #endif
00103 
00104     #define UNIMPLEMENTED         DbgPrint("WARNING:  %s at %s:%d is UNIMPLEMENTED!\n",__FUNCTION__,__FILE__,__LINE__);
00105 
00106     #define ERR_(ch, fmt, ...)    DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_ERROR_LEVEL, "(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
00107     #define WARN_(ch, fmt, ...)   DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_WARNING_LEVEL, "(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
00108     #define TRACE_(ch, fmt, ...)  DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_TRACE_LEVEL, "(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
00109     #define INFO_(ch, fmt, ...)   DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_INFO_LEVEL, "(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
00110     
00111     #define ERR__(ch, fmt, ...)    DbgPrintEx(ch, DPFLTR_ERROR_LEVEL, "(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
00112     #define WARN__(ch, fmt, ...)   DbgPrintEx(ch, DPFLTR_WARNING_LEVEL, "(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
00113     #define TRACE__(ch, fmt, ...)  DbgPrintEx(ch, DPFLTR_TRACE_LEVEL, "(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
00114     #define INFO__(ch, fmt, ...)   DbgPrintEx(ch, DPFLTR_INFO_LEVEL, "(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
00115 #else /* not DBG */
00116 
00117     /* On non-debug builds, we never show these */
00118     #define DPRINT1(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
00119     #define DPRINT(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
00120 
00121     #define UNIMPLEMENTED
00122 
00123     #define ERR_(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
00124     #define WARN_(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
00125     #define TRACE_(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
00126     #define INFO_(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
00127     
00128     #define ERR__(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
00129     #define WARN__(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
00130     #define TRACE__(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
00131     #define INFO__(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
00132 #endif /* not DBG */
00133 
00134 #define ASSERT_IRQL_LESS_OR_EQUAL(x) ASSERT(KeGetCurrentIrql()<=(x))
00135 #define ASSERT_IRQL_EQUAL(x) ASSERT(KeGetCurrentIrql()==(x))
00136 #define ASSERT_IRQL_LESS(x) ASSERT(KeGetCurrentIrql()<(x))
00137 
00138 #endif /* __INTERNAL_DEBUG */

Generated on Fri May 25 2012 04:15:52 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.