Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

excptdbg.c File Reference

#include "ntrtlp.h"

Go to the source code of this file.

Functions

VOID RtlInitializeExceptionLog (IN ULONG Entries)
ULONG RtlpLogExceptionHandler (IN PEXCEPTION_RECORD ExceptionRecord, IN PCONTEXT ContextRecord, IN ULONG_PTR ControlPc, IN PVOID HandlerData, IN ULONG Size)
VOID RtlpLogLastExceptionDisposition (ULONG LogIndex, EXCEPTION_DISPOSITION Disposition)

Variables

PLAST_EXCEPTION_LOG RtlpExceptionLog
ULONG RtlpExceptionLogCount
ULONG RtlpExceptionLogSize


Function Documentation

VOID RtlInitializeExceptionLog IN ULONG  Entries  ) 
 

Definition at line 29 of file excptdbg.c.

References ExAllocatePoolWithTag, NonPagedPool, RtlpExceptionLog, and RtlpExceptionLogSize.

00034 : 00035 00036 This routine allocates space for the exception dispatcher logging 00037 facility, and records the address and size of the log area in globals 00038 where they can be found by the debugger. 00039 00040 If memory is not available, the table pointer will remain NULL 00041 and the logging functions will do nothing. 00042 00043 Arguments: 00044 00045 Entries - Supplies the number of entries to allocate for 00046 00047 Return Value: 00048 00049 None 00050 00051 --*/ 00052 { 00053 #if defined(NTOS_KERNEL_RUNTIME) 00054 RtlpExceptionLog = (PLAST_EXCEPTION_LOG)ExAllocatePoolWithTag( NonPagedPool, sizeof(LAST_EXCEPTION_LOG) * Entries, 'gbdE' ); 00055 #else 00056 //RtlpExceptionLog = (PLAST_EXCEPTION_LOG)RtlAllocateHeap( RtlProcessHeap(), 0, sizeof(LAST_EXCEPTION_LOG) * Entries ); 00057 #endif 00058 if (RtlpExceptionLog) { 00059 RtlpExceptionLogSize = Entries; 00060 } 00061 }

ULONG RtlpLogExceptionHandler IN PEXCEPTION_RECORD  ExceptionRecord,
IN PCONTEXT  ContextRecord,
IN ULONG_PTR  ControlPc,
IN PVOID  HandlerData,
IN ULONG  Size
 

Definition at line 65 of file excptdbg.c.

References ASSERT, RtlpExceptionLog, RtlpExceptionLogCount, and Size.

Referenced by RtlDispatchException().

00074 : 00075 00076 Records the dispatching of exceptions to frame-based handlers. 00077 The debugger may inspect the table later and interpret the data 00078 to discover the address of the filters and handlers. 00079 00080 Arguments: 00081 00082 ExceptionRecord - Supplies an exception record 00083 00084 ContextRecord - Supplies the context at the exception 00085 00086 ControlPc - Supplies the PC where control left the frame being 00087 dispatched to. 00088 00089 HandlerData - Supplies a pointer to the host-dependent exception 00090 data. On the RISC machines this is a RUNTIME_FUNCTION record; 00091 on x86 it is the registration record from the stack frame. 00092 00093 Size - Supplies the size of HandlerData 00094 00095 Returns: 00096 00097 The index to the log entry used, so that if the handler returns 00098 a disposition it may be recorded. 00099 00100 --*/ 00101 { 00102 #if !defined(NTOS_KERNEL_RUNTIME) 00103 00104 return 0; 00105 00106 #else 00107 00108 ULONG LogIndex; 00109 00110 if (!RtlpExceptionLog) { 00111 return 0; 00112 } 00113 00114 ASSERT(Size <= MAX_EXCEPTION_LOG_DATA_SIZE * sizeof(ULONG)); 00115 00116 do { 00117 LogIndex = RtlpExceptionLogCount; 00118 } while (LogIndex != (ULONG)InterlockedCompareExchange( 00119 (PLONG)&RtlpExceptionLogCount, 00120 ((LogIndex + 1) % MAX_EXCEPTION_LOG), 00121 LogIndex)); 00122 00123 // 00124 // the debugger will have to interpret the exception handler 00125 // data, because it cannot be done safely here. 00126 // 00127 00128 RtlCopyMemory(RtlpExceptionLog[LogIndex].HandlerData, 00129 HandlerData, 00130 Size); 00131 RtlpExceptionLog[LogIndex].ExceptionRecord = *ExceptionRecord; 00132 RtlpExceptionLog[LogIndex].ContextRecord = *ContextRecord; 00133 RtlpExceptionLog[LogIndex].Disposition = -1; 00134 00135 return LogIndex; 00136 #endif // !NTOS_KERNEL_RUNTIME 00137 }

VOID RtlpLogLastExceptionDisposition ULONG  LogIndex,
EXCEPTION_DISPOSITION  Disposition
 

Definition at line 141 of file excptdbg.c.

References RtlpExceptionLog.

00147 : 00148 00149 Records the disposition from an exception handler. 00150 00151 Arguments: 00152 00153 LogIndex - Supplies the entry number of the exception log record. 00154 00155 Disposition - Supplies the disposition code 00156 00157 Return Value: 00158 00159 None 00160 00161 --*/ 00162 00163 { 00164 // If MAX_EXCEPTION_LOG or more exceptions were dispatched while 00165 // this one was being handled, this disposition will get written 00166 // on the wrong record. Oh well. 00167 if (RtlpExceptionLog) { 00168 RtlpExceptionLog[LogIndex].Disposition = Disposition; 00169 } 00170 }


Variable Documentation

PLAST_EXCEPTION_LOG RtlpExceptionLog
 

Definition at line 23 of file excptdbg.c.

Referenced by RtlInitializeExceptionLog(), RtlpLogExceptionHandler(), and RtlpLogLastExceptionDisposition().

ULONG RtlpExceptionLogCount
 

Definition at line 24 of file excptdbg.c.

Referenced by RtlpLogExceptionHandler().

ULONG RtlpExceptionLogSize
 

Definition at line 25 of file excptdbg.c.

Referenced by RtlInitializeExceptionLog().


Generated on Sat May 15 19:43:35 2004 for test by doxygen 1.3.7