class CrashHandler

Saves crash data and notifies the user when a crash occurs.

Public

Constructors

CrashHandler

CrashHandler(const CrashHandlerSettings &settings)

Methods

~CrashHandler

~CrashHandler() noexcept

staticStartUp

static void StartUp(const CrashHandlerSettings &settings = CrashHandlerSettings())

Constructs and starts the module.

staticShutDown

static void ShutDown()

Shuts down this module and frees any resources it is using.

staticInstance

static CrashHandler &Instance()

Returns a reference to the module instance.

ReportCrash

void ReportCrash(const String &type, const String &description, const String &function = StringUtility::kBlank, const String &file = StringUtility::kBlank, u32 line = 0) const

Records a crash with a custom error message.

type
Type of the crash that occurred. For example "InvalidParameter".
description
More detailed description of the issue that caused the crash.
function
Optional name of the function where the error occurred.
file
Optional name of the source code file in which the code that crashed the program exists.
line
Optional source code line at which the crash was triggered at.

ReportCrash

int ReportCrash(void *exceptionData) const

Records a crash resulting from a Windows-specific SEH exception.

exceptionData
Exception data returned from GetExceptionInformation()

Returns: Code that signals the __except exception handler on how to proceed.

staticGetStackTrace

static String GetStackTrace()

Returns a string containing a current stack trace.

If function can be found in the symbol table its readable name will be present in the stack trace, otherwise just its address.

Returns: String containing the call stack with each function on its own line.

Private

Methods

LogErrorAndStackTrace

void LogErrorAndStackTrace(const String &message, const String &stackTrace) const

Does what it says.

Internal utility function used by reportCrash().

LogErrorAndStackTrace

void LogErrorAndStackTrace(const String &type, const String &description, const String &function, const String &file, u32 line) const

Does what it says.

Internal utility function used by reportCrash().

SaveCrashLog

void SaveCrashLog() const

Does what it says.

Internal utility function used by reportCrash().

staticGetCrashFolder

static const Path &GetCrashFolder()

Creates the crash report directory and returns its path.

staticGetCrashTimestamp

static String GetCrashTimestamp()

Returns the current time as a string timestamp.

This is used to name the crash report directory..

staticInstanceInternal

static CrashHandler *&InstanceInternal()

Returns a singleton instance of this module.

Fields

mSettings

Handling customization callbacks

m

Data * m