mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 16:32:59 +00:00
[REACTOS]
- Fix the debugging macros I've introduced in r58132; in particular do not use while(true); for forbidding the user to continue execution, but instead raise an exception with EXCEPTION_NONCONTINUABLE flag (included when called RtlRaiseStatus). - Adjust the definition of RtlRaiseStatus (in kernel-mode it is ExRaiseStatus which is used). svn path=/trunk/; revision=58135
This commit is contained in:
parent
6d9be19636
commit
959e4790c6
1 changed files with 40 additions and 13 deletions
|
@ -15,7 +15,7 @@
|
||||||
#ifndef __INTERNAL_DEBUG
|
#ifndef __INTERNAL_DEBUG
|
||||||
#define __INTERNAL_DEBUG
|
#define __INTERNAL_DEBUG
|
||||||
|
|
||||||
/* Define DbgPrint/DbgPrintEx/RtlAssert unless the NDK is used */
|
/* Define DbgPrint/DbgPrintEx/RtlAssert/RtlRaiseStatus unless the NDK is used */
|
||||||
#if !defined(_RTLFUNCS_H) && !defined(_NTDDK_)
|
#if !defined(_RTLFUNCS_H) && !defined(_NTDDK_)
|
||||||
|
|
||||||
/* Make sure we have basic types (some people include us *before* SDK)... */
|
/* Make sure we have basic types (some people include us *before* SDK)... */
|
||||||
|
@ -51,8 +51,28 @@ RtlAssert(
|
||||||
PCHAR Message
|
PCHAR Message
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifndef _NTDEF_ /* Guard against redefinition from ntdef.h */
|
||||||
|
typedef _Return_type_success_(return >= 0) LONG NTSTATUS;
|
||||||
|
#endif
|
||||||
|
__analysis_noreturn
|
||||||
|
NTSYSAPI
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
RtlRaiseStatus(
|
||||||
|
_In_ NTSTATUS Status
|
||||||
|
);
|
||||||
|
|
||||||
#endif /* !defined(_RTLFUNCS_H) && !defined(_NTDDK_) */
|
#endif /* !defined(_RTLFUNCS_H) && !defined(_NTDDK_) */
|
||||||
|
|
||||||
|
|
||||||
|
/* Fix usage of RtlRaiseStatus */
|
||||||
|
#if !defined(_RTLFUNCS_H) && defined(_NTDDK_)
|
||||||
|
#define RaiseStatus ExRaiseStatus
|
||||||
|
#else
|
||||||
|
#define RaiseStatus RtlRaiseStatus
|
||||||
|
#endif /* !defined(_RTLFUNCS_H) && defined(_NTDDK_) */
|
||||||
|
|
||||||
|
|
||||||
#ifndef assert
|
#ifndef assert
|
||||||
#ifndef NASSERT
|
#ifndef NASSERT
|
||||||
#define assert(x) if (!(x)) { RtlAssert((PVOID)#x, (PVOID)__FILE__, __LINE__, ""); }
|
#define assert(x) if (!(x)) { RtlAssert((PVOID)#x, (PVOID)__FILE__, __LINE__, ""); }
|
||||||
|
@ -136,11 +156,7 @@ RtlAssert(
|
||||||
|
|
||||||
#endif /* not DBG */
|
#endif /* not DBG */
|
||||||
|
|
||||||
/*
|
/******************************************************************************/
|
||||||
* These macros are designed to display an optional printf-like
|
|
||||||
* user-defined message and to break into the debugger.
|
|
||||||
* After that they allow to continue the program execution.
|
|
||||||
*/
|
|
||||||
/* For internal purposes only */
|
/* For internal purposes only */
|
||||||
#define __ERROR_DBGBREAK(...) \
|
#define __ERROR_DBGBREAK(...) \
|
||||||
do { \
|
do { \
|
||||||
|
@ -148,6 +164,18 @@ do { \
|
||||||
DbgBreakPoint(); \
|
DbgBreakPoint(); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
/* For internal purposes only */
|
||||||
|
#define __ERROR_FATAL(Status, ...) \
|
||||||
|
do { \
|
||||||
|
DbgPrint("" __VA_ARGS__); \
|
||||||
|
RaiseStatus((Status)); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These macros are designed to display an optional printf-like
|
||||||
|
* user-defined message and to break into the debugger.
|
||||||
|
* After that they allow to continue the program execution.
|
||||||
|
*/
|
||||||
#define ERROR_DBGBREAK(...) \
|
#define ERROR_DBGBREAK(...) \
|
||||||
do { \
|
do { \
|
||||||
__NOTICE(ERROR, "\n"); \
|
__NOTICE(ERROR, "\n"); \
|
||||||
|
@ -165,19 +193,18 @@ do { \
|
||||||
* user-defined message and to break into the debugger.
|
* user-defined message and to break into the debugger.
|
||||||
* After that they halt the execution of the current thread.
|
* After that they halt the execution of the current thread.
|
||||||
*/
|
*/
|
||||||
#define ERROR_FATAL(...) \
|
#define ERROR_FATAL(...) \
|
||||||
do { \
|
do { \
|
||||||
__NOTICE(UNRECOVERABLE ERROR, "\n"); \
|
__NOTICE(UNRECOVERABLE ERROR, "\n"); \
|
||||||
__ERROR_DBGBREAK(__VA_ARGS__); \
|
__ERROR_FATAL(STATUS_ASSERTION_FAILURE, __VA_ARGS__); \
|
||||||
while (TRUE); \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define UNIMPLEMENTED_FATAL(...) \
|
#define UNIMPLEMENTED_FATAL(...) \
|
||||||
do { \
|
do { \
|
||||||
__NOTICE(UNRECOVERABLE ERROR, "is UNIMPLEMENTED!\n"); \
|
__NOTICE(UNRECOVERABLE ERROR, "is UNIMPLEMENTED!\n"); \
|
||||||
__ERROR_DBGBREAK(__VA_ARGS__); \
|
__ERROR_FATAL(STATUS_NOT_IMPLEMENTED, __VA_ARGS__); \
|
||||||
while (TRUE); \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
#define ASSERT_IRQL_LESS_OR_EQUAL(x) ASSERT(KeGetCurrentIrql()<=(x))
|
#define ASSERT_IRQL_LESS_OR_EQUAL(x) ASSERT(KeGetCurrentIrql()<=(x))
|
||||||
#define ASSERT_IRQL_EQUAL(x) ASSERT(KeGetCurrentIrql()==(x))
|
#define ASSERT_IRQL_EQUAL(x) ASSERT(KeGetCurrentIrql()==(x))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue