ReactOS 0.4.15-dev-8021-g7ce96fd
assert.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Run-Time Library
4 * PURPOSE: Implements RtlAssert used by the ASSERT
5 * and ASSERTMSG debugging macros
6 * FILE: lib/rtl/assert.c
7 * PROGRAMERS: Stefan Ginsberg (stefan.ginsberg@reactos.org)
8 */
9
10/* INCLUDES *****************************************************************/
11
12#include <rtl.h>
13#define NDEBUG
14#include <debug.h>
15
16/* PUBLIC FUNCTIONS **********************************************************/
17
18/*
19 * @implemented
20 */
21VOID
23RtlAssert(IN PVOID FailedAssertion,
27{
28 CHAR Action[2];
30
31 /* Capture caller's context for the debugger */
33
34 /* Enter prompt loop */
35 for (;;)
36 {
37 /* Print the assertion */
38 DbgPrint("\n*** Assertion failed: %s%s\n"
39 "*** Source File: %s, line %lu\n\n",
40 Message != NULL ? Message : "",
41 (PSTR)FailedAssertion,
44
45 /* Prompt for action */
46 DbgPrompt("Break repeatedly, break Once, Ignore, "
47 "terminate Process or terminate Thread (boipt)? ",
48 Action,
49 sizeof(Action));
50 switch (Action[0])
51 {
52 /* Break repeatedly / Break once */
53 case 'B': case 'b':
54 case 'O': case 'o':
55 DbgPrint("Execute '.cxr %p' to dump context\n", &Context);
56 /* Do a breakpoint, then prompt again or return */
58 if ((Action[0] == 'B') || (Action[0] == 'b'))
59 break;
60 /* else ('O','o'): fall through */
61
62 /* Ignore: Return to caller */
63 case 'I': case 'i':
64 return;
65
66 /* Terminate current process */
67 case 'P': case 'p':
68 ZwTerminateProcess(ZwCurrentProcess(), STATUS_UNSUCCESSFUL);
69 break;
70
71 /* Terminate current thread */
72 case 'T': case 't':
74 break;
75
76 /* Unrecognized: Prompt again */
77 default:
78 break;
79 }
80 }
81
82 /* Shouldn't get here */
84 ZwTerminateProcess(ZwCurrentProcess(), STATUS_UNSUCCESSFUL);
85}
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 LineNumber
Definition: acpixf.h:1220
#define NULL
Definition: types.h:112
static const WCHAR Message[]
Definition: register.c:74
#define DbgPrint
Definition: hal.h:12
NTSYSAPI void WINAPI DbgBreakPoint(void)
NTSYSAPI NTSTATUS NTAPI ZwTerminateThread(_In_ HANDLE ThreadHandle, _In_ NTSTATUS ExitStatus)
NTSYSAPI ULONG NTAPI DbgPrompt(_In_z_ PCCH Prompt, _Out_writes_bytes_(MaximumResponseLength) PCH Response, _In_ ULONG MaximumResponseLength)
NTSYSAPI VOID NTAPI RtlCaptureContext(_Out_ PCONTEXT ContextRecord)
VOID NTAPI RtlAssert(IN PVOID FailedAssertion, IN PVOID FileName, IN ULONG LineNumber, IN PCHAR Message OPTIONAL)
Definition: assert.c:23
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
char * PSTR
Definition: typedefs.h:51
#define NTAPI
Definition: typedefs.h:36
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
char * PCHAR
Definition: typedefs.h:51
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:510
char CHAR
Definition: xmlstorage.h:175
#define ZwCurrentThread()
#define ZwCurrentProcess()