TrinityCore
Loading...
Searching...
No Matches
WheatyExceptionReport Class Reference

#include <WheatyExceptionReport.h>

Classes

struct  EnumerateSymbolsCallbackContext
 

Public Member Functions

 WheatyExceptionReport ()
 
 ~WheatyExceptionReport ()
 

Static Public Member Functions

static LONG WINAPI WheatyUnhandledExceptionFilter (PEXCEPTION_POINTERS pExceptionInfo)
 
static void __cdecl WheatyCrtHandler (wchar_t const *expression, wchar_t const *function, wchar_t const *file, unsigned int line, uintptr_t pReserved)
 
static void printTracesForAllThreads (bool)
 

Private Types

typedef NTSTATUS(NTAPI * pRtlGetVersion) (PRTL_OSVERSIONINFOW lpVersionInformation)
 

Static Private Member Functions

static void GenerateExceptionReport (PEXCEPTION_POINTERS pExceptionInfo)
 
static void PrintSystemInfo ()
 
static BOOL _GetWindowsVersion (TCHAR *szVersion, DWORD cntMax)
 
static BOOL _GetWindowsVersionFromWMI (TCHAR *szVersion, DWORD cntMax)
 
static BOOL _GetProcessorName (TCHAR *sProcessorName, DWORD maxcount)
 
static LPCTSTR GetExceptionString (DWORD dwCode)
 
static BOOL GetLogicalAddress (PVOID addr, PTSTR szModule, DWORD len, DWORD &section, DWORD_PTR &offset)
 
static void WriteStackDetails (PCONTEXT pContext, bool bWriteVariables, HANDLE pThreadHandle)
 
static BOOL CALLBACK EnumerateSymbolsCallback (PSYMBOL_INFO, ULONG, PVOID)
 
static bool FormatSymbolValue (PSYMBOL_INFO, EnumerateSymbolsCallbackContext *)
 
static void DumpTypeIndex (DWORD64, DWORD, DWORD_PTR, bool &, char const *, char const *, bool, bool)
 
static void FormatOutputValue (char *pszCurrBuffer, BasicType basicType, DWORD64 length, PVOID pAddress, size_t bufferSize, size_t countOverride=0)
 
static BasicType GetBasicType (DWORD typeIndex, DWORD64 modBase)
 
static DWORD_PTR DereferenceUnsafePointer (DWORD_PTR address)
 
static int __cdecl Log (const TCHAR *format,...)
 
static bool StoreSymbol (DWORD type, DWORD_PTR offset)
 
static void ClearSymbols ()
 
static Optional< DWORD_PTR > GetIntegerRegisterValue (PCONTEXT context, ULONG registerId)
 
static void PushSymbolDetail ()
 
static void PopSymbolDetail ()
 
static void PrintSymbolDetail ()
 

Static Private Attributes

static TCHAR m_szLogFileName [MAX_PATH]
 
static TCHAR m_szDumpFileName [MAX_PATH]
 
static LPTOP_LEVEL_EXCEPTION_FILTER m_previousFilter
 
static _invalid_parameter_handler m_previousCrtHandler
 
static FILE * m_hReportFile
 
static HANDLE m_hDumpFile
 
static HANDLE m_hProcess
 
static SymbolPairs symbols
 
static std::stack< SymbolDetail > symbolDetails
 
static bool alreadyCrashed
 
static std::mutex alreadyCrashedLock
 
static pRtlGetVersion RtlGetVersion
 

Detailed Description

Definition at line 326 of file WheatyExceptionReport.h.

Member Typedef Documentation

◆ pRtlGetVersion

typedef NTSTATUS(NTAPI * WheatyExceptionReport::pRtlGetVersion) (PRTL_OSVERSIONINFOW lpVersionInformation)
private

Definition at line 391 of file WheatyExceptionReport.h.

Constructor & Destructor Documentation

◆ WheatyExceptionReport()

WheatyExceptionReport::WheatyExceptionReport ( )

◆ ~WheatyExceptionReport()

WheatyExceptionReport::~WheatyExceptionReport ( )

Definition at line 91 of file WheatyExceptionReport.cpp.

References ClearSymbols(), m_previousCrtHandler, and m_previousFilter.

Member Function Documentation

◆ _GetProcessorName()

BOOL WheatyExceptionReport::_GetProcessorName ( TCHAR *  sProcessorName,
DWORD  maxcount 
)
staticprivate

Definition at line 198 of file WheatyExceptionReport.cpp.

Referenced by PrintSystemInfo().

◆ _GetWindowsVersion()

BOOL WheatyExceptionReport::_GetWindowsVersion ( TCHAR *  szVersion,
DWORD  cntMax 
)
staticprivate

Definition at line 234 of file WheatyExceptionReport.cpp.

References _GetWindowsVersionFromWMI(), RtlGetVersion, and ToTchar().

Referenced by PrintSystemInfo().

◆ _GetWindowsVersionFromWMI()

BOOL WheatyExceptionReport::_GetWindowsVersionFromWMI ( TCHAR *  szVersion,
DWORD  cntMax 
)
staticprivate

Definition at line 412 of file WheatyExceptionReport.cpp.

References ToTchar().

Referenced by _GetWindowsVersion().

◆ ClearSymbols()

void WheatyExceptionReport::ClearSymbols ( )
staticprivate

Definition at line 1853 of file WheatyExceptionReport.cpp.

References symbolDetails, and symbols.

Referenced by EnumerateSymbolsCallback(), and ~WheatyExceptionReport().

◆ DereferenceUnsafePointer()

DWORD_PTR WheatyExceptionReport::DereferenceUnsafePointer ( DWORD_PTR  address)
staticprivate

Definition at line 1823 of file WheatyExceptionReport.cpp.

Referenced by DumpTypeIndex().

◆ DumpTypeIndex()

void WheatyExceptionReport::DumpTypeIndex ( DWORD64  modBase,
DWORD  dwTypeIndex,
DWORD_PTR  offset,
bool &  bHandled,
char const *  Name,
char const *  ,
bool  newSymbol,
bool  logChildren 
)
staticprivate

◆ EnumerateSymbolsCallback()

BOOL CALLBACK WheatyExceptionReport::EnumerateSymbolsCallback ( PSYMBOL_INFO  pSymInfo,
ULONG  ,
PVOID  UserContext 
)
staticprivate

Definition at line 1095 of file WheatyExceptionReport.cpp.

References ClearSymbols(), and FormatSymbolValue().

Referenced by WriteStackDetails().

◆ FormatOutputValue()

void WheatyExceptionReport::FormatOutputValue ( char *  pszCurrBuffer,
BasicType  basicType,
DWORD64  length,
PVOID  pAddress,
size_t  bufferSize,
size_t  countOverride = 0 
)
staticprivate

Definition at line 1720 of file WheatyExceptionReport.cpp.

References btChar, btFloat, btStdString, and bufferSize.

Referenced by DumpTypeIndex(), and FormatSymbolValue().

◆ FormatSymbolValue()

◆ GenerateExceptionReport()

void WheatyExceptionReport::GenerateExceptionReport ( PEXCEPTION_POINTERS  pExceptionInfo)
staticprivate

◆ GetBasicType()

BasicType WheatyExceptionReport::GetBasicType ( DWORD  typeIndex,
DWORD64  modBase 
)
staticprivate

Definition at line 1799 of file WheatyExceptionReport.cpp.

References btNoType, and m_hProcess.

Referenced by DumpTypeIndex(), and FormatSymbolValue().

◆ GetExceptionString()

LPCTSTR WheatyExceptionReport::GetExceptionString ( DWORD  dwCode)
staticprivate

Definition at line 858 of file WheatyExceptionReport.cpp.

References EXCEPTION.

Referenced by GenerateExceptionReport().

◆ GetIntegerRegisterValue()

Optional< DWORD_PTR > WheatyExceptionReport::GetIntegerRegisterValue ( PCONTEXT  context,
ULONG  registerId 
)
staticprivate

Definition at line 1114 of file WheatyExceptionReport.cpp.

References CPU_REG, CV_AMD64_AH, CV_AMD64_AL, CV_AMD64_AX, CV_AMD64_BH, CV_AMD64_BL, CV_AMD64_BP, CV_AMD64_BPL, CV_AMD64_BX, CV_AMD64_CH, CV_AMD64_CL, CV_AMD64_CX, CV_AMD64_DH, CV_AMD64_DI, CV_AMD64_DIL, CV_AMD64_DL, CV_AMD64_DX, CV_AMD64_EAX, CV_AMD64_EBP, CV_AMD64_EBX, CV_AMD64_ECX, CV_AMD64_EDI, CV_AMD64_EDX, CV_AMD64_ESI, CV_AMD64_ESP, CV_AMD64_R10, CV_AMD64_R10B, CV_AMD64_R10D, CV_AMD64_R10W, CV_AMD64_R11, CV_AMD64_R11B, CV_AMD64_R11D, CV_AMD64_R11W, CV_AMD64_R12, CV_AMD64_R12B, CV_AMD64_R12D, CV_AMD64_R12W, CV_AMD64_R13, CV_AMD64_R13B, CV_AMD64_R13D, CV_AMD64_R13W, CV_AMD64_R14, CV_AMD64_R14B, CV_AMD64_R14D, CV_AMD64_R14W, CV_AMD64_R15, CV_AMD64_R15B, CV_AMD64_R15D, CV_AMD64_R15W, CV_AMD64_R8, CV_AMD64_R8B, CV_AMD64_R8D, CV_AMD64_R8W, CV_AMD64_R9, CV_AMD64_R9B, CV_AMD64_R9D, CV_AMD64_R9W, CV_AMD64_RAX, CV_AMD64_RBP, CV_AMD64_RBX, CV_AMD64_RCX, CV_AMD64_RDI, CV_AMD64_RDX, CV_AMD64_RIP, CV_AMD64_RSI, CV_AMD64_RSP, CV_AMD64_SI, CV_AMD64_SIL, CV_AMD64_SP, CV_AMD64_SPL, CV_ARM64_FP, CV_ARM64_IP0, CV_ARM64_IP1, CV_ARM64_LR, CV_ARM64_SP, CV_ARM64_W0, CV_ARM64_W1, CV_ARM64_W10, CV_ARM64_W11, CV_ARM64_W12, CV_ARM64_W13, CV_ARM64_W14, CV_ARM64_W15, CV_ARM64_W16, CV_ARM64_W17, CV_ARM64_W18, CV_ARM64_W19, CV_ARM64_W2, CV_ARM64_W20, CV_ARM64_W21, CV_ARM64_W22, CV_ARM64_W23, CV_ARM64_W24, CV_ARM64_W25, CV_ARM64_W26, CV_ARM64_W27, CV_ARM64_W28, CV_ARM64_W29, CV_ARM64_W3, CV_ARM64_W30, CV_ARM64_W4, CV_ARM64_W5, CV_ARM64_W6, CV_ARM64_W7, CV_ARM64_W8, CV_ARM64_W9, CV_ARM64_WZR, CV_ARM64_X0, CV_ARM64_X1, CV_ARM64_X10, CV_ARM64_X11, CV_ARM64_X12, CV_ARM64_X13, CV_ARM64_X14, CV_ARM64_X15, CV_ARM64_X18, CV_ARM64_X19, CV_ARM64_X2, CV_ARM64_X20, CV_ARM64_X21, CV_ARM64_X22, CV_ARM64_X23, CV_ARM64_X24, CV_ARM64_X25, CV_ARM64_X26, CV_ARM64_X27, CV_ARM64_X28, CV_ARM64_X3, CV_ARM64_X4, CV_ARM64_X5, CV_ARM64_X6, CV_ARM64_X7, CV_ARM64_X8, CV_ARM64_X9, CV_ARM64_ZR, CV_REG_AH, CV_REG_AL, CV_REG_AX, CV_REG_BH, CV_REG_BL, CV_REG_BP, CV_REG_BX, CV_REG_CH, CV_REG_CL, CV_REG_CX, CV_REG_DH, CV_REG_DI, CV_REG_DL, CV_REG_DX, CV_REG_EAX, CV_REG_EBP, CV_REG_EBX, CV_REG_ECX, CV_REG_EDI, CV_REG_EDX, CV_REG_EIP, CV_REG_ESI, CV_REG_ESP, CV_REG_SI, CV_REG_SP, REG_E, REG_H, REG_L, REG_R, and REG_X.

Referenced by FormatSymbolValue().

◆ GetLogicalAddress()

BOOL WheatyExceptionReport::GetLogicalAddress ( PVOID  addr,
PTSTR  szModule,
DWORD  len,
DWORD &  section,
DWORD_PTR &  offset 
)
staticprivate

Definition at line 908 of file WheatyExceptionReport.cpp.

Referenced by GenerateExceptionReport(), and WriteStackDetails().

◆ Log()

int __cdecl WheatyExceptionReport::Log ( const TCHAR *  format,
  ... 
)
staticprivate

Definition at line 1839 of file WheatyExceptionReport.cpp.

References m_hReportFile.

◆ PopSymbolDetail()

void WheatyExceptionReport::PopSymbolDetail ( )
staticprivate

Definition at line 1867 of file WheatyExceptionReport.cpp.

References PrintSymbolDetail(), and symbolDetails.

Referenced by DumpTypeIndex(), and FormatSymbolValue().

◆ PrintSymbolDetail()

void WheatyExceptionReport::PrintSymbolDetail ( )
staticprivate

Definition at line 1873 of file WheatyExceptionReport.cpp.

References symbolDetails.

Referenced by PopSymbolDetail(), and PushSymbolDetail().

◆ PrintSystemInfo()

void WheatyExceptionReport::PrintSystemInfo ( )
staticprivate

Definition at line 568 of file WheatyExceptionReport.cpp.

References _GetProcessorName(), and _GetWindowsVersion().

Referenced by GenerateExceptionReport().

◆ printTracesForAllThreads()

void WheatyExceptionReport::printTracesForAllThreads ( bool  bWriteVariables)
static

Definition at line 592 of file WheatyExceptionReport.cpp.

References m_hProcess, and WriteStackDetails().

Referenced by GenerateExceptionReport().

◆ PushSymbolDetail()

void WheatyExceptionReport::PushSymbolDetail ( )
staticprivate

Definition at line 1860 of file WheatyExceptionReport.cpp.

References PrintSymbolDetail(), and symbolDetails.

Referenced by DumpTypeIndex(), and FormatSymbolValue().

◆ StoreSymbol()

bool WheatyExceptionReport::StoreSymbol ( DWORD  type,
DWORD_PTR  offset 
)
staticprivate

Definition at line 1848 of file WheatyExceptionReport.cpp.

References symbols.

Referenced by DumpTypeIndex().

◆ WheatyCrtHandler()

void __cdecl WheatyExceptionReport::WheatyCrtHandler ( wchar_t const *  expression,
wchar_t const *  function,
wchar_t const *  file,
unsigned int  line,
uintptr_t  pReserved 
)
static

Definition at line 193 of file WheatyExceptionReport.cpp.

Referenced by WheatyExceptionReport().

◆ WheatyUnhandledExceptionFilter()

LONG WINAPI WheatyExceptionReport::WheatyUnhandledExceptionFilter ( PEXCEPTION_POINTERS  pExceptionInfo)
static

◆ WriteStackDetails()

void WheatyExceptionReport::WriteStackDetails ( PCONTEXT  pContext,
bool  bWriteVariables,
HANDLE  pThreadHandle 
)
staticprivate

Member Data Documentation

◆ alreadyCrashed

bool WheatyExceptionReport::alreadyCrashed
staticprivate

◆ alreadyCrashedLock

std::mutex WheatyExceptionReport::alreadyCrashedLock
staticprivate

Definition at line 390 of file WheatyExceptionReport.h.

Referenced by WheatyUnhandledExceptionFilter().

◆ m_hDumpFile

HANDLE WheatyExceptionReport::m_hDumpFile
staticprivate

Definition at line 385 of file WheatyExceptionReport.h.

Referenced by WheatyUnhandledExceptionFilter().

◆ m_hProcess

HANDLE WheatyExceptionReport::m_hProcess
staticprivate

◆ m_hReportFile

FILE * WheatyExceptionReport::m_hReportFile
staticprivate

Definition at line 384 of file WheatyExceptionReport.h.

Referenced by Log(), and WheatyUnhandledExceptionFilter().

◆ m_previousCrtHandler

_invalid_parameter_handler WheatyExceptionReport::m_previousCrtHandler
staticprivate

Definition at line 383 of file WheatyExceptionReport.h.

Referenced by WheatyExceptionReport(), and ~WheatyExceptionReport().

◆ m_previousFilter

LPTOP_LEVEL_EXCEPTION_FILTER WheatyExceptionReport::m_previousFilter
staticprivate

◆ m_szDumpFileName

TCHAR WheatyExceptionReport::m_szDumpFileName
staticprivate

Definition at line 381 of file WheatyExceptionReport.h.

Referenced by WheatyUnhandledExceptionFilter().

◆ m_szLogFileName

TCHAR WheatyExceptionReport::m_szLogFileName
staticprivate

Definition at line 380 of file WheatyExceptionReport.h.

Referenced by WheatyUnhandledExceptionFilter().

◆ RtlGetVersion

WheatyExceptionReport::pRtlGetVersion WheatyExceptionReport::RtlGetVersion
staticprivate

Definition at line 392 of file WheatyExceptionReport.h.

Referenced by _GetWindowsVersion(), and WheatyExceptionReport().

◆ symbolDetails

std::stack< SymbolDetail > WheatyExceptionReport::symbolDetails
staticprivate

◆ symbols

SymbolPairs WheatyExceptionReport::symbols
staticprivate

Definition at line 387 of file WheatyExceptionReport.h.

Referenced by ClearSymbols(), and StoreSymbol().


The documentation for this class was generated from the following files: