1998-08-25 04:27:41 +00:00
/*
* COPYRIGHT : See COPYING in the top level directory
* PROJECT : ReactOS kernel
* FILE : include / internal / debug . h
* PURPOSE : Useful debugging macros
* PROGRAMMER : David Welch ( welch @ mcmail . com )
2007-10-19 23:21:45 +00:00
* UPDATE HISTORY :
1998-08-25 04:27:41 +00:00
* 28 / 05 / 98 : Created
*/
/*
* NOTE : Define NDEBUG before including this header to disable debugging
* macros
*/
# ifndef __INTERNAL_DEBUG
# define __INTERNAL_DEBUG
2007-12-14 15:59:14 +00:00
/* Define DbgPrint/DbgPrintEx/RtlAssert unless the NDK is used */
2009-02-09 22:50:40 +00:00
# if !defined(_RTLFUNCS_H) && !defined(_NTDDK_)
2005-11-25 00:17:40 +00:00
2006-01-08 19:50:52 +00:00
/* Make sure we have basic types (some people include us *before* SDK... */
2008-11-21 18:18:12 +00:00
# if !defined(_NTDEF_) && !defined(_NTDEF_H) && !defined(_WINDEF_) && !defined(_WINDEF_H)
2007-12-14 15:59:14 +00:00
# error Please include SDK first.
# endif
2005-11-25 00:17:40 +00:00
ULONG
__cdecl
DbgPrint (
2006-08-06 19:57:24 +00:00
IN PCCH Format ,
2005-11-25 00:17:40 +00:00
IN . . .
) ;
2007-12-14 15:59:14 +00:00
ULONG
__cdecl
DbgPrintEx (
IN ULONG ComponentId ,
IN ULONG Level ,
IN PCCH Format ,
IN . . .
) ;
2006-03-04 17:27:40 +00:00
NTSYSAPI
2005-11-25 00:17:40 +00:00
VOID
NTAPI
RtlAssert (
PVOID FailedAssertion ,
PVOID FileName ,
ULONG LineNumber ,
PCHAR Message
) ;
2006-01-08 19:50:52 +00:00
2005-11-25 00:17:40 +00:00
# endif
2002-11-13 Casper S. Hornstrup <chorns@users.sourceforge.net>
* drivers/bus/acpi/ospm/osl.c (acpi_os_readable, acpi_os_writable):
Match prototypes.
* include/ascii.h (AbortSystemShutdownA): Correct prototype.
* include/debug.h (assert): Wrap in #ifndef assert.
* include/funcs.h (AbortSystemShutdown): Remove duplicate prototype.
* include/ddk/rtltypes.h: Move ...
* include/ntos/rtltypes.h: ... here.
* include/ddk/rtl.h: Move ...
* include/ntos/rtl.h: ... here.
* include/ddk/zwtypes.h: Move ...
* include/ntos/zwtypes.h: ... here.
* include/ddk/zw.h: Move ...
* include/ntos/zw.h: ... here.
| include/ddk/cmfuncs.h: Remove file; Move NtCreateKey to ntos/zw.h.
* include/ntos.h: #include ntos/rtltypes.h, ntos/rtl.h, ntos/zwtypes.h,
and ntos/zw.h.
* include/unicode.h: (AbortSystemShutdownW): Correct prototype.
* include/ddk/ntddk.h: Include headers at new location; Don't include
removed files.
* include/defines.h: Wrap definitions in w32api in #ifndef __USE_W32API.
* include/ntos/zwtypes.h: Ditto.
* include/napi/lpc.h: Ditto.
* include/napi/shared_data.h: Ditto.
* include/napi/teb.h: Ditto.
* include/napi/types.h: Ditto.
* include/ntdll/ldr.h: Ditto.
* include/ntdll/rtl.h: Ditto.
* include/ntos/console.h: Ditto.
* include/ntos/disk.h: Ditto.
* include/ntos/except.h: Ditto.
* include/ntos/file.h: Ditto.
* include/ntos/gditypes.h: Ditto.
* include/ntos/heap.h: Ditto.
* include/ntos/keyboard.h: Ditto.
* include/ntos/mm.h: Ditto.
* include/ntos/ntdef.h: Ditto.
* include/ntos/ps.h: Ditto.
* include/ntos/registry.h: Ditto.
* include/ntos/security.h: Ditto.
* include/ntos/synch.h: Ditto.
* include/ntos/time.h: Ditto.
* include/ntos/types.h: Ditto.
* include/ntos/port.h: Ditto.
* lib/advapi32/misc/shutdown.c (AbortSystemShutdownW,
AbortSystemShutdownA): Correct prototype.
* lib/advapi32/reg/reg.c: #include ntos.h.
* lib/advapi32/sec/misc.c: Ditto.
* lib/advapi32/sec/sid.c: Ditto.
* lib/advapi32/service/sctrl.c: Ditto.
* lib/advapi32/token/token.c: Ditto.
* lib/kernel32/misc/dllmain.c: Ditto.
* ntoskrnl/ex/napi.c: Ditto.
* ntoskrnl/rtl/i386/exception.c: Ditto.
* lib/advapi32/sec/ac.c: Ditto.
(FindFirstFreeAce, GetAce): Change PACE* to PACE_HEADER*.
* lib/advapi32/service/scm.c (EnumServicesStatusExA,
EnumServicesStatusExW, QueryServiceStatusEx): Correct prototype.
* lib/ntdll/rtl/ppb.c (RtlDestroyProcessParameters): Match prototype.
* ntoskrnl/dbg/errinfo.c (DbgGetErrorText): Use %08x, not %08lx.
* ntoskrnl/io/arcname.c (IoCreateSystemRootLink): Use %u, not %lu.
* ntoskrnl/ke/main.c (ExpInitializeExecutive): Ditto.
* (_main): Use %d, not %ld.
* ntoskrnl/include/internal/i386/ke.h: Add #pragma GCC system_header.
* include/ddk/ntdef.h (NTSYSAPI, NTAPI, NTKERNELAPI): Define to STDCALL;
Check if already defined.
* include/base.h (STDCALL, CDECL, CALLBACK, PASCAL): Move to ntos/types.h.
svn path=/trunk/; revision=3755
2002-11-14 18:21:07 +00:00
# ifndef assert
1999-05-29 00:15:17 +00:00
# ifndef NASSERT
2001-09-01 15:36:45 +00:00
# define assert(x) if (!(x)) {RtlAssert("#x",__FILE__,__LINE__, ""); }
1998-11-29 19:11:10 +00:00
# else
# define assert(x)
# endif
2002-11-13 Casper S. Hornstrup <chorns@users.sourceforge.net>
* drivers/bus/acpi/ospm/osl.c (acpi_os_readable, acpi_os_writable):
Match prototypes.
* include/ascii.h (AbortSystemShutdownA): Correct prototype.
* include/debug.h (assert): Wrap in #ifndef assert.
* include/funcs.h (AbortSystemShutdown): Remove duplicate prototype.
* include/ddk/rtltypes.h: Move ...
* include/ntos/rtltypes.h: ... here.
* include/ddk/rtl.h: Move ...
* include/ntos/rtl.h: ... here.
* include/ddk/zwtypes.h: Move ...
* include/ntos/zwtypes.h: ... here.
* include/ddk/zw.h: Move ...
* include/ntos/zw.h: ... here.
| include/ddk/cmfuncs.h: Remove file; Move NtCreateKey to ntos/zw.h.
* include/ntos.h: #include ntos/rtltypes.h, ntos/rtl.h, ntos/zwtypes.h,
and ntos/zw.h.
* include/unicode.h: (AbortSystemShutdownW): Correct prototype.
* include/ddk/ntddk.h: Include headers at new location; Don't include
removed files.
* include/defines.h: Wrap definitions in w32api in #ifndef __USE_W32API.
* include/ntos/zwtypes.h: Ditto.
* include/napi/lpc.h: Ditto.
* include/napi/shared_data.h: Ditto.
* include/napi/teb.h: Ditto.
* include/napi/types.h: Ditto.
* include/ntdll/ldr.h: Ditto.
* include/ntdll/rtl.h: Ditto.
* include/ntos/console.h: Ditto.
* include/ntos/disk.h: Ditto.
* include/ntos/except.h: Ditto.
* include/ntos/file.h: Ditto.
* include/ntos/gditypes.h: Ditto.
* include/ntos/heap.h: Ditto.
* include/ntos/keyboard.h: Ditto.
* include/ntos/mm.h: Ditto.
* include/ntos/ntdef.h: Ditto.
* include/ntos/ps.h: Ditto.
* include/ntos/registry.h: Ditto.
* include/ntos/security.h: Ditto.
* include/ntos/synch.h: Ditto.
* include/ntos/time.h: Ditto.
* include/ntos/types.h: Ditto.
* include/ntos/port.h: Ditto.
* lib/advapi32/misc/shutdown.c (AbortSystemShutdownW,
AbortSystemShutdownA): Correct prototype.
* lib/advapi32/reg/reg.c: #include ntos.h.
* lib/advapi32/sec/misc.c: Ditto.
* lib/advapi32/sec/sid.c: Ditto.
* lib/advapi32/service/sctrl.c: Ditto.
* lib/advapi32/token/token.c: Ditto.
* lib/kernel32/misc/dllmain.c: Ditto.
* ntoskrnl/ex/napi.c: Ditto.
* ntoskrnl/rtl/i386/exception.c: Ditto.
* lib/advapi32/sec/ac.c: Ditto.
(FindFirstFreeAce, GetAce): Change PACE* to PACE_HEADER*.
* lib/advapi32/service/scm.c (EnumServicesStatusExA,
EnumServicesStatusExW, QueryServiceStatusEx): Correct prototype.
* lib/ntdll/rtl/ppb.c (RtlDestroyProcessParameters): Match prototype.
* ntoskrnl/dbg/errinfo.c (DbgGetErrorText): Use %08x, not %08lx.
* ntoskrnl/io/arcname.c (IoCreateSystemRootLink): Use %u, not %lu.
* ntoskrnl/ke/main.c (ExpInitializeExecutive): Ditto.
* (_main): Use %d, not %ld.
* ntoskrnl/include/internal/i386/ke.h: Add #pragma GCC system_header.
* include/ddk/ntdef.h (NTSYSAPI, NTAPI, NTKERNELAPI): Define to STDCALL;
Check if already defined.
* include/base.h (STDCALL, CDECL, CALLBACK, PASCAL): Move to ntos/types.h.
svn path=/trunk/; revision=3755
2002-11-14 18:21:07 +00:00
# endif
1998-11-29 19:11:10 +00:00
2004-10-22 20:02:32 +00:00
# ifndef ASSERT
# ifndef NASSERT
# define ASSERT(x) if (!(x)) {RtlAssert("#x",__FILE__,__LINE__, ""); }
# else
# define ASSERT(x)
# endif
# endif
# ifndef ASSERTMSG
# ifndef NASSERT
# define ASSERTMSG(x,m) if (!(x)) {RtlAssert("#x",__FILE__,__LINE__, m); }
# else
# define ASSERTMSG(x)
# endif
# endif
2005-07-29 00:14:05 +00:00
/* Print stuff only on Debug Builds*/
2008-01-08 09:51:53 +00:00
# define DPFLTR_DEFAULT_ID -1
2009-06-17 12:44:05 +00:00
# if DBG
2007-10-19 23:21:45 +00:00
2005-07-29 00:14:05 +00:00
/* These are always printed */
# define DPRINT1 DbgPrint("(%s:%d) ",__FILE__,__LINE__), DbgPrint
/* These are printed only if NDEBUG is NOT defined */
# ifndef NDEBUG
2007-10-19 23:21:45 +00:00
2005-07-29 00:14:05 +00:00
# define DPRINT DbgPrint("(%s:%d) ",__FILE__,__LINE__), DbgPrint
2007-10-19 23:21:45 +00:00
2005-07-29 00:14:05 +00:00
# else
2006-01-07 02:06:22 +00:00
# ifdef _MSC_VER
static __inline void DPRINT ( const char * fmt , . . . )
{
2006-06-26 15:32:53 +00:00
UNREFERENCED_PARAMETER ( fmt ) ;
2006-01-07 02:06:22 +00:00
}
# else
2005-11-17 21:59:57 +00:00
# define DPRINT(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
# endif
2005-07-29 00:14:05 +00:00
# endif
1999-11-02 08:55:45 +00:00
2008-02-27 19:58:48 +00:00
# define UNIMPLEMENTED DbgPrint("WARNING: %s at %s:%d is UNIMPLEMENTED!\n",__FUNCTION__,__FILE__,__LINE__);
2008-06-19 22:03:22 +00:00
/* The ##__VA_ARGS__ syntax is not a standard and was only tested with MSVC and GCC. If other compilers support them as well, add them to this #if block. */
# if defined(_MSC_VER) || defined(__GNUC__)
# define ERR_(ch, fmt, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_ERROR_LEVEL, "(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
# define WARN_(ch, fmt, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_WARNING_LEVEL, "(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
# define TRACE_(ch, fmt, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_TRACE_LEVEL, "(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
# define INFO_(ch, fmt, ...) DbgPrintEx(DPFLTR_##ch##_ID, DPFLTR_INFO_LEVEL, "(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__)
# endif
2003-07-24 19:00:42 +00:00
# else
2005-07-29 00:14:05 +00:00
/* On non-debug builds, we never show these */
2006-01-10 21:36:42 +00:00
# define DPRINT1(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
# define DPRINT(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
2006-01-07 02:06:22 +00:00
2005-11-05 06:44:03 +00:00
# define UNIMPLEMENTED
2007-12-14 15:59:14 +00:00
# define ERR_(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
# define WARN_(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
# define TRACE_(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
# define INFO_(ch, ...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0)
2005-07-29 00:14:05 +00:00
# endif
1998-08-25 04:27:41 +00:00
2008-08-30 15:14:12 +00:00
# define ASSERT_IRQL_LESS_OR_EQUAL(x) ASSERT(KeGetCurrentIrql()<=(x))
# define ASSERT_IRQL_EQUAL(x) ASSERT(KeGetCurrentIrql()==(x))
# define ASSERT_IRQL_LESS(x) ASSERT(KeGetCurrentIrql()<(x))
2005-06-17 13:13:37 +00:00
1998-08-25 04:27:41 +00:00
# endif /* __INTERNAL_DEBUG */