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)
|
|
|
|
* UPDATE HISTORY:
|
|
|
|
* 28/05/98: Created
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2001-05-01 23:08:21 +00:00
|
|
|
* NOTES: Define DBG in configuration file for "checked" version
|
|
|
|
* Define NDEBUG before including this header to disable debugging
|
|
|
|
* macros
|
|
|
|
* Define NASSERT before including this header to disable assertions
|
1998-08-25 04:27:41 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __INTERNAL_DEBUG
|
|
|
|
#define __INTERNAL_DEBUG
|
|
|
|
|
1999-11-02 08:55:45 +00:00
|
|
|
#include <internal/ntoskrnl.h>
|
2001-05-01 23:08:21 +00:00
|
|
|
#include <internal/config.h>
|
2001-05-05 19:13:10 +00:00
|
|
|
#include <internal/dbg.h>
|
1998-09-13 15:55:55 +00:00
|
|
|
|
1998-10-05 04:50:07 +00:00
|
|
|
#define UNIMPLEMENTED do {DbgPrint("%s at %s:%d is unimplemented, have a nice day\n",__FUNCTION__,__FILE__,__LINE__); for(;;); } while(0);
|
1998-08-25 04:27:41 +00:00
|
|
|
|
1998-11-29 19:11:10 +00:00
|
|
|
|
2001-05-01 23:08:21 +00:00
|
|
|
#ifdef DBG
|
|
|
|
|
|
|
|
/* Assert only on "checked" version */
|
1999-05-29 00:15:17 +00:00
|
|
|
#ifndef NASSERT
|
|
|
|
#define assert(x) if (!(x)) {DbgPrint("Assertion "#x" failed at %s:%d\n", __FILE__,__LINE__); KeBugCheck(0); }
|
1998-11-29 19:11:10 +00:00
|
|
|
#else
|
|
|
|
#define assert(x)
|
|
|
|
#endif
|
|
|
|
|
2001-05-01 23:08:21 +00:00
|
|
|
/* Print if using a "checked" version */
|
|
|
|
#define CPRINT(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
|
|
|
|
|
|
|
|
#else /* DBG */
|
|
|
|
|
|
|
|
#define CPRINT(args...)
|
|
|
|
#define assert(x)
|
|
|
|
|
|
|
|
#endif /* DBG */
|
|
|
|
|
2001-03-28 04:43:02 +00:00
|
|
|
#define DPRINT1(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
|
2001-03-28 03:06:55 +00:00
|
|
|
#define CHECKPOINT1 do { DbgPrint("%s:%d\n",__FILE__,__LINE__); } while(0);
|
1999-11-02 08:55:45 +00:00
|
|
|
|
2001-08-21 20:13:17 +00:00
|
|
|
#if defined(KDBG) && defined(NDEBUG) && defined(__NTOSKRNL__)
|
1999-11-02 08:55:45 +00:00
|
|
|
|
2001-05-05 19:13:10 +00:00
|
|
|
#define DPRINT(args...) do { \
|
|
|
|
if (DbgShouldPrint(__FILE__)) { \
|
|
|
|
DbgPrint("(%s:%d) ",__FILE__,__LINE__); \
|
|
|
|
DbgPrint(args); \
|
|
|
|
} \
|
|
|
|
} while(0);
|
|
|
|
|
|
|
|
#define CHECKPOINT
|
|
|
|
|
2001-08-21 20:13:17 +00:00
|
|
|
#else /* KDBG && NDEBUG && __NTOSKRNL__ */
|
1999-11-02 08:55:45 +00:00
|
|
|
|
1998-08-25 04:27:41 +00:00
|
|
|
#ifndef NDEBUG
|
2001-05-05 19:13:10 +00:00
|
|
|
#define DPRINT(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
|
1998-10-05 04:50:07 +00:00
|
|
|
#define CHECKPOINT do { DbgPrint("%s:%d\n",__FILE__,__LINE__); ExAllocatePool(NonPagedPool,0); } while(0);
|
2001-05-05 19:13:10 +00:00
|
|
|
#else /* NDEBUG */
|
1998-10-05 04:50:07 +00:00
|
|
|
#define DPRINT(args...)
|
1998-08-25 04:27:41 +00:00
|
|
|
#define CHECKPOINT
|
|
|
|
#endif /* NDEBUG */
|
|
|
|
|
2001-05-05 19:13:10 +00:00
|
|
|
#endif /* KDBG && NDEBUG */
|
|
|
|
|
1998-08-25 04:27:41 +00:00
|
|
|
/*
|
|
|
|
* FUNCTION: Assert a maximum value for the current irql
|
|
|
|
* ARGUMENTS:
|
|
|
|
* x = Maximum irql
|
|
|
|
*/
|
|
|
|
#define ASSERT_IRQL(x) assert(KeGetCurrentIrql()<=(x))
|
|
|
|
#define assert_irql(x) assert(KeGetCurrentIrql()<=(x))
|
|
|
|
|
|
|
|
#endif /* __INTERNAL_DEBUG */
|