Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenassert.c
Go to the documentation of this file.
00001 /* 00002 * COPYRIGHT: See COPYING in the top level directory 00003 * PROJECT: ReactOS Run-Time Library 00004 * PURPOSE: Implements RtlAssert used by the ASSERT 00005 * and ASSERTMSG debugging macros 00006 * FILE: lib/rtl/assert.c 00007 * PROGRAMERS: Stefan Ginsberg (stefan.ginsberg@reactos.org) 00008 */ 00009 00010 /* INCLUDES *****************************************************************/ 00011 00012 #include <rtl.h> 00013 #define NDEBUG 00014 #include <debug.h> 00015 00016 /* PUBLIC FUNCTIONS **********************************************************/ 00017 00018 /* 00019 * @implemented 00020 */ 00021 VOID 00022 NTAPI 00023 RtlAssert(IN PVOID FailedAssertion, 00024 IN PVOID FileName, 00025 IN ULONG LineNumber, 00026 IN PCHAR Message OPTIONAL) 00027 { 00028 #if 0 // Disabled until sysreg can handle debug prompts 00029 CHAR Action[2]; 00030 CONTEXT Context; 00031 00032 /* Capture caller's context for the debugger */ 00033 RtlCaptureContext(&Context); 00034 00035 /* Enter prompt loop */ 00036 for (;;) 00037 { 00038 /* Print the assertion */ 00039 DbgPrint("\n*** Assertion failed: %s%s\n" 00040 "*** Source File: %s, line %ld\n\n", 00041 Message != NULL ? Message : "", 00042 (PSTR)FailedAssertion, 00043 (PSTR)FileName, 00044 LineNumber); 00045 00046 /* Prompt for action */ 00047 DbgPrompt("Break repeatedly, break Once, Ignore," 00048 " terminate Process or terminate Thread (boipt)? ", 00049 Action, 00050 sizeof(Action)); 00051 switch (Action[0]) 00052 { 00053 /* Break repeatedly */ 00054 case 'B': case 'b': 00055 00056 /* Do a breakpoint, then prompt again */ 00057 DbgPrint("Execute '.cxr %p' to dump context\n", &Context); 00058 DbgBreakPoint(); 00059 break; 00060 00061 /* Ignore */ 00062 case 'I': case 'i': 00063 00064 /* Return to caller */ 00065 return; 00066 00067 /* Break once */ 00068 case 'O': case 'o': 00069 00070 /* Do a breakpoint and return */ 00071 DbgPrint("Execute '.cxr %p' to dump context\n", &Context); 00072 DbgBreakPoint(); 00073 return; 00074 00075 /* Terminate process*/ 00076 case 'P': case 'p': 00077 00078 /* Terminate us */ 00079 ZwTerminateProcess(ZwCurrentProcess(), STATUS_UNSUCCESSFUL); 00080 break; 00081 00082 /* Terminate thread */ 00083 case 'T': case 't': 00084 00085 /* Terminate us */ 00086 ZwTerminateThread(ZwCurrentThread(), STATUS_UNSUCCESSFUL); 00087 break; 00088 00089 /* Unrecognized */ 00090 default: 00091 00092 /* Prompt again */ 00093 break; 00094 } 00095 } 00096 00097 /* Shouldn't get here */ 00098 DbgBreakPoint(); 00099 ZwTerminateProcess(ZwCurrentProcess(), STATUS_UNSUCCESSFUL); 00100 #else 00101 if (NULL != Message) 00102 { 00103 DbgPrint("Assertion \'%s\' failed at %s line %d: %s\n", 00104 (PCHAR)FailedAssertion, 00105 (PCHAR)FileName, 00106 LineNumber, 00107 Message); 00108 } 00109 else 00110 { 00111 DbgPrint("Assertion \'%s\' failed at %s line %d\n", 00112 (PCHAR)FailedAssertion, 00113 (PCHAR)FileName, 00114 LineNumber); 00115 } 00116 00117 DbgBreakPoint(); 00118 #endif 00119 } Generated on Sat May 26 2012 04:35:20 for ReactOS by
1.7.6.1
|