25#if !defined(_M_IX86) && !defined(_M_AMD64)
77#pragma warning(disable:4717)
138 PVOID Frames[2 * 64];
152 if (FrameCount <= FramesToSkip)
return 0;
158 if ((FramesToSkip +
i) >= FrameCount)
break;
161 BackTrace[
i] = Frames[FramesToSkip +
i];
179 char* psz,
size_t nChars)
187 *module_start_addr = 0;
196 *module_start_addr = 0;
213 DbgPrint(
"EDX: %.8x EBP: %.8x ESI: %.8x ESP: %.8x\n", pc->
Edx,
216#elif defined(_M_AMD64)
220 DbgPrint(
"RAX: %I64x RBX: %I64x RCX: %I64x RDI: %I64x\n", pc->Rax, pc->Rbx, pc->Rcx, pc->Rdi);
221 DbgPrint(
"RDX: %I64x RBP: %I64x RSI: %I64x RSP: %I64x\n", pc->Rdx, pc->Rbp, pc->Rsi, pc->Rsp);
222 DbgPrint(
"R8: %I64x R9: %I64x R10: %I64x R11: %I64x\n", pc->
R8, pc->
R9, pc->
R10, pc->
R11);
223 DbgPrint(
"R12: %I64x R13: %I64x R14: %I64x R15: %I64x\n", pc->
R12, pc->R13, pc->R14, pc->R15);
227 DbgPrint(
"R0: %lx R1: %lx R2: %lx R3: %lx\n", pc->
R0, pc->
R1, pc->
R2, pc->
R3);
228 DbgPrint(
"R4: %lx R5: %lx R6: %lx R7: %lx\n", pc->
R4, pc->
R5, pc->
R6, pc->
R7);
232#pragma message ("Unknown architecture")
240 CHAR szMod[128] =
"";
263 DbgPrint(
"Address:\n %8x+%-8x %s\n",
275 for (
i = 0; Frame[1] != 0 && Frame[1] != 0xdeadbeef &&
i < 128;
i++)
280 DbgPrint(
" %8x%9s %s\n", Frame[1],
"<invalid address>",
" ");
285 szMod,
sizeof(szMod));
292 if (Frame[0] == 0)
break;
296 Frame = (
PULONG) Frame[0];
BOOLEAN NTAPI RtlpCheckForActiveDebugger(VOID)
ULONG NTAPI RtlWalkFrameChain(OUT PVOID *Callers, IN ULONG Count, IN ULONG Flags)
#define ERROR_CALL_NOT_IMPLEMENTED
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
static int Hash(const char *)
_In_ ULONG FramesToCapture
_In_ ULONG _Out_opt_ PULONG BackTraceHash
GLenum const GLvoid * addr
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
NTSYSAPI PVOID WINAPI RtlEncodePointer(PVOID)
#define EXCEPTION_EXECUTE_HANDLER
#define RtlFillMemoryUlong(dst, len, val)
NTSYSAPI NTSTATUS NTAPI ZwContinue(_In_ PCONTEXT Context, _In_ BOOLEAN TestAlert)
NTSYSAPI NTSTATUS NTAPI ZwRaiseException(_In_ PEXCEPTION_RECORD ExceptionRecord, _In_ PCONTEXT Context, _In_ BOOLEAN SearchFrames)
NTSYSAPI BOOLEAN NTAPI RtlDispatchException(_In_ PEXCEPTION_RECORD ExceptionRecord, _In_ PCONTEXT Context)
NTSYSAPI VOID NTAPI RtlCaptureContext(_Out_ PCONTEXT ContextRecord)
RTLP_UNHANDLED_EXCEPTION_FILTER * PRTLP_UNHANDLED_EXCEPTION_FILTER
_IRQL_requires_same_ _In_ PVOID _Inout_ struct _CONTEXT * ContextRecord
#define STATUS_ACCESS_VIOLATION
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
VOID NTAPI RtlRaiseException(IN PEXCEPTION_RECORD ExceptionRecord)
PRTLP_UNHANDLED_EXCEPTION_FILTER RtlpUnhandledExceptionFilter
static VOID PrintStackTrace(struct _EXCEPTION_POINTERS *ExceptionInfo)
LONG NTAPI RtlUnhandledExceptionFilter2(_In_ PEXCEPTION_POINTERS ExceptionInfo, _In_ ULONG Flags)
VOID NTAPI RtlSetUnhandledExceptionFilter(IN PRTLP_UNHANDLED_EXCEPTION_FILTER TopLevelExceptionFilter)
static const char * _module_name_from_addr(const void *addr, void **module_start_addr, char *psz, size_t nChars)
static VOID _dump_context(PCONTEXT pc)
USHORT NTAPI RtlCaptureStackBackTrace(IN ULONG FramesToSkip, IN ULONG FramesToCapture, OUT PVOID *BackTrace, OUT PULONG BackTraceHash OPTIONAL)
LONG NTAPI RtlUnhandledExceptionFilter(IN struct _EXCEPTION_POINTERS *ExceptionInfo)
VOID NTAPI RtlRaiseStatus(IN NTSTATUS Status)
PULONG MinorVersion OPTIONAL
PEXCEPTION_RECORD ExceptionRecord
struct _EXCEPTION_RECORD * ExceptionRecord
ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]
#define EXCEPTION_NONCONTINUABLE
SIZE_T NTAPI VirtualQuery(IN LPCVOID lpAddress, OUT PMEMORY_BASIC_INFORMATION lpBuffer, IN SIZE_T dwLength)
_Must_inspect_result_ _In_ ULONG Flags