TrinityCore
WheatyExceptionReport Class Reference

#include <WheatyExceptionReport.h>

Classes

struct  EnumerateSymbolsCallbackContext
 

Public Member Functions

 WheatyExceptionReport ()
 
 WheatyExceptionReport (WheatyExceptionReport const &)=delete
 
 WheatyExceptionReport (WheatyExceptionReport &&)=delete
 
WheatyExceptionReportoperator= (WheatyExceptionReport const &)=delete
 
WheatyExceptionReportoperator= (WheatyExceptionReport &&)=delete
 
 ~WheatyExceptionReport ()
 
LONG UnhandledExceptionFilterImpl (PEXCEPTION_POINTERS pExceptionInfo)
 
void printTracesForAllThreads (bool bWriteVariables)
 

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)
 

Private Types

typedef NTSTATUS(NTAPI * pRtlGetVersion) (PRTL_OSVERSIONINFOW lpVersionInformation)
 

Private Member Functions

void GenerateExceptionReport (PEXCEPTION_POINTERS pExceptionInfo)
 
void PrintSystemInfo ()
 
BOOL _GetWindowsVersion (TCHAR *szVersion, DWORD cntMax)
 
void WriteStackDetails (PCONTEXT pContext, bool bWriteVariables, HANDLE pThreadHandle)
 
bool FormatSymbolValue (PSYMBOL_INFO, EnumerateSymbolsCallbackContext *)
 
void DumpTypeIndex (DWORD64, DWORD, DWORD_PTR, bool &, char const *, char const *, bool, bool)
 
BasicType GetBasicType (DWORD typeIndex, DWORD64 modBase) const
 
int Log (const TCHAR *format,...)
 
bool StoreSymbol (DWORD type, DWORD_PTR offset)
 
void ClearSymbols ()
 
void PushSymbolDetail ()
 
void PopSymbolDetail ()
 
void PrintSymbolDetail ()
 

Static Private Member Functions

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 BOOL GetSymbolFromAddress (HANDLE hProcess, DWORD64 Address, ULONG InlineContext, PDWORD64 Displacement, PSYMBOL_INFO Symbol)
 
static BOOL GetSymbolLineFromAddress (HANDLE hProcess, DWORD64 qwAddr, ULONG InlineContext, PDWORD pdwDisplacement, PIMAGEHLP_LINE64 Line64)
 
static BOOL CALLBACK EnumerateSymbolsCallback (PSYMBOL_INFO, ULONG, PVOID)
 
static void FormatOutputValue (char *pszCurrBuffer, BasicType basicType, DWORD64 length, PVOID pAddress, size_t bufferSize, size_t countOverride=0)
 
static DWORD_PTR DereferenceUnsafePointer (DWORD_PTR address)
 
static Optional< DWORD_PTR > GetIntegerRegisterValue (PCONTEXT context, ULONG registerId)
 

Private Attributes

TCHAR m_logFileName [MAX_PATH]
 
TCHAR m_dumpFileName [MAX_PATH]
 
LPTOP_LEVEL_EXCEPTION_FILTER m_previousFilter
 
_invalid_parameter_handler m_previousCrtHandler
 
FILE * m_reportFile
 
HANDLE m_dumpFile
 
HANDLE m_process
 
SymbolPairs m_symbols
 
std::stack< SymbolDetailm_symbolDetails
 
bool m_alreadyCrashed
 
std::mutex m_alreadyCrashedLock
 
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 401 of file WheatyExceptionReport.h.

Constructor & Destructor Documentation

◆ WheatyExceptionReport() [1/3]

WheatyExceptionReport::WheatyExceptionReport ( )

Definition at line 67 of file WheatyExceptionReport.cpp.

◆ WheatyExceptionReport() [2/3]

WheatyExceptionReport::WheatyExceptionReport ( WheatyExceptionReport const &  )
delete

◆ WheatyExceptionReport() [3/3]

WheatyExceptionReport::WheatyExceptionReport ( WheatyExceptionReport &&  )
delete

◆ ~WheatyExceptionReport()

WheatyExceptionReport::~WheatyExceptionReport ( )

Definition at line 93 of file WheatyExceptionReport.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ _GetProcessorName()

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

Definition at line 201 of file WheatyExceptionReport.cpp.

+ Here is the caller graph for this function:

◆ _GetWindowsVersion()

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

Definition at line 237 of file WheatyExceptionReport.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _GetWindowsVersionFromWMI()

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

Definition at line 421 of file WheatyExceptionReport.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ClearSymbols()

void WheatyExceptionReport::ClearSymbols ( )
private

Definition at line 1876 of file WheatyExceptionReport.cpp.

+ Here is the caller graph for this function:

◆ DereferenceUnsafePointer()

DWORD_PTR WheatyExceptionReport::DereferenceUnsafePointer ( DWORD_PTR  address)
staticprivate

Definition at line 1846 of file WheatyExceptionReport.cpp.

+ Here is the caller graph for this function:

◆ DumpTypeIndex()

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

Definition at line 1404 of file WheatyExceptionReport.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EnumerateSymbolsCallback()

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

Definition at line 1117 of file WheatyExceptionReport.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FormatOutputValue()

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

Definition at line 1743 of file WheatyExceptionReport.cpp.

+ Here is the caller graph for this function:

◆ FormatSymbolValue()

bool WheatyExceptionReport::FormatSymbolValue ( PSYMBOL_INFO  pSym,
EnumerateSymbolsCallbackContext pCtx 
)
private

Definition at line 1327 of file WheatyExceptionReport.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GenerateExceptionReport()

void WheatyExceptionReport::GenerateExceptionReport ( PEXCEPTION_POINTERS  pExceptionInfo)
private

Definition at line 643 of file WheatyExceptionReport.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetBasicType()

BasicType WheatyExceptionReport::GetBasicType ( DWORD  typeIndex,
DWORD64  modBase 
) const
private

Definition at line 1822 of file WheatyExceptionReport.cpp.

+ Here is the caller graph for this function:

◆ GetExceptionString()

LPCTSTR WheatyExceptionReport::GetExceptionString ( DWORD  dwCode)
staticprivate

Definition at line 858 of file WheatyExceptionReport.cpp.

+ Here is the caller graph for this function:

◆ GetIntegerRegisterValue()

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

Definition at line 1137 of file WheatyExceptionReport.cpp.

+ Here is the caller graph for this function:

◆ GetLogicalAddress()

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

Definition at line 908 of file WheatyExceptionReport.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetSymbolFromAddress()

BOOL WheatyExceptionReport::GetSymbolFromAddress ( HANDLE  hProcess,
DWORD64  Address,
ULONG  InlineContext,
PDWORD64  Displacement,
PSYMBOL_INFO  Symbol 
)
staticprivate

Definition at line 970 of file WheatyExceptionReport.cpp.

+ Here is the caller graph for this function:

◆ GetSymbolLineFromAddress()

BOOL WheatyExceptionReport::GetSymbolLineFromAddress ( HANDLE  hProcess,
DWORD64  qwAddr,
ULONG  InlineContext,
PDWORD  pdwDisplacement,
PIMAGEHLP_LINE64  Line64 
)
staticprivate

Definition at line 978 of file WheatyExceptionReport.cpp.

+ Here is the caller graph for this function:

◆ Log()

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

Definition at line 1862 of file WheatyExceptionReport.cpp.

+ Here is the caller graph for this function:

◆ operator=() [1/2]

WheatyExceptionReport & WheatyExceptionReport::operator= ( WheatyExceptionReport &&  )
delete

◆ operator=() [2/2]

WheatyExceptionReport & WheatyExceptionReport::operator= ( WheatyExceptionReport const &  )
delete

◆ PopSymbolDetail()

void WheatyExceptionReport::PopSymbolDetail ( )
private

Definition at line 1890 of file WheatyExceptionReport.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PrintSymbolDetail()

void WheatyExceptionReport::PrintSymbolDetail ( )
private

Definition at line 1896 of file WheatyExceptionReport.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PrintSystemInfo()

void WheatyExceptionReport::PrintSystemInfo ( )
private

Definition at line 569 of file WheatyExceptionReport.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ printTracesForAllThreads()

void WheatyExceptionReport::printTracesForAllThreads ( bool  bWriteVariables)

Definition at line 593 of file WheatyExceptionReport.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PushSymbolDetail()

void WheatyExceptionReport::PushSymbolDetail ( )
private

Definition at line 1883 of file WheatyExceptionReport.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ StoreSymbol()

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

Definition at line 1871 of file WheatyExceptionReport.cpp.

+ Here is the caller graph for this function:

◆ UnhandledExceptionFilterImpl()

LONG WheatyExceptionReport::UnhandledExceptionFilterImpl ( PEXCEPTION_POINTERS  pExceptionInfo)

Definition at line 113 of file WheatyExceptionReport.cpp.

+ Here is the call graph for this function:

◆ 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 196 of file WheatyExceptionReport.cpp.

◆ WheatyUnhandledExceptionFilter()

LONG WINAPI WheatyExceptionReport::WheatyUnhandledExceptionFilter ( PEXCEPTION_POINTERS  pExceptionInfo)
static

Definition at line 107 of file WheatyExceptionReport.cpp.

◆ WriteStackDetails()

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

Definition at line 989 of file WheatyExceptionReport.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_alreadyCrashed

bool WheatyExceptionReport::m_alreadyCrashed
private

Definition at line 399 of file WheatyExceptionReport.h.

◆ m_alreadyCrashedLock

std::mutex WheatyExceptionReport::m_alreadyCrashedLock
private

Definition at line 400 of file WheatyExceptionReport.h.

◆ m_dumpFile

HANDLE WheatyExceptionReport::m_dumpFile
private

Definition at line 395 of file WheatyExceptionReport.h.

◆ m_dumpFileName

TCHAR WheatyExceptionReport::m_dumpFileName[MAX_PATH]
private

Definition at line 391 of file WheatyExceptionReport.h.

◆ m_logFileName

TCHAR WheatyExceptionReport::m_logFileName[MAX_PATH]
private

Definition at line 390 of file WheatyExceptionReport.h.

◆ m_previousCrtHandler

_invalid_parameter_handler WheatyExceptionReport::m_previousCrtHandler
private

Definition at line 393 of file WheatyExceptionReport.h.

◆ m_previousFilter

LPTOP_LEVEL_EXCEPTION_FILTER WheatyExceptionReport::m_previousFilter
private

Definition at line 392 of file WheatyExceptionReport.h.

◆ m_process

HANDLE WheatyExceptionReport::m_process
private

Definition at line 396 of file WheatyExceptionReport.h.

◆ m_reportFile

FILE* WheatyExceptionReport::m_reportFile
private

Definition at line 394 of file WheatyExceptionReport.h.

◆ m_symbolDetails

std::stack<SymbolDetail> WheatyExceptionReport::m_symbolDetails
private

Definition at line 398 of file WheatyExceptionReport.h.

◆ m_symbols

SymbolPairs WheatyExceptionReport::m_symbols
private

Definition at line 397 of file WheatyExceptionReport.h.

◆ RtlGetVersion

pRtlGetVersion WheatyExceptionReport::RtlGetVersion
private

Definition at line 402 of file WheatyExceptionReport.h.


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