Leviathan  0.8.0.0
Leviathan game engine
Leviathan::CrashHandler Class Reference

An orchestrator for crashing. More...

#include <CrashHandler.h>

Public Member Functions

 CrashHandler ()=delete
 

Static Public Member Functions

static void DoBreakpadCrashDumpIfRegistered ()
 Triggers Breakpad callback if registered. More...
 
static void DoBreakpadSEHCrashDumpIfRegistered (void *data)
 Triggers Breakpad callback if registered. More...
 
static DLLEXPORT void RegisterBreakpadGenericHandler (std::function< void()> callback)
 Handler for when BSF gets called first, should call the google_breakpad::ExceptionHandler::SimulateSignalDelivery or Windows equivalent. More...
 
static DLLEXPORT void RegisterBreakpadWindowsSEHHandler (std::function< void(void *data)> callback)
 Handler for SEH, this is separate to allow the data pointer to be passed. More...
 
static DLLEXPORT void DoBSFCallStackAfterBreakpad ()
 Called after creating a Breakpad dump in order to also print the accessible callstack with BSF. More...
 
static DLLEXPORT bool IsBreakpadRegistered ()
 

Detailed Description

An orchestrator for crashing.

Manages the disparencies between BSF and Breakpad (if application main has Breakpad enabled)

Definition at line 14 of file CrashHandler.h.

Constructor & Destructor Documentation

◆ CrashHandler()

Leviathan::CrashHandler::CrashHandler ( )
delete

Member Function Documentation

◆ DoBreakpadCrashDumpIfRegistered()

void CrashHandler::DoBreakpadCrashDumpIfRegistered ( )
static

Triggers Breakpad callback if registered.

Definition at line 13 of file CrashHandler.cpp.

14 {
15  BSFTriggered = true;
16  if(GenericCallback)
17  GenericCallback();
18 }

◆ DoBreakpadSEHCrashDumpIfRegistered()

void CrashHandler::DoBreakpadSEHCrashDumpIfRegistered ( void *  data)
static

Triggers Breakpad callback if registered.

Definition at line 20 of file CrashHandler.cpp.

21 {
22  BSFTriggered = true;
23  if(SEHCallback)
24  SEHCallback(data);
25 }

◆ DoBSFCallStackAfterBreakpad()

DLLEXPORT void CrashHandler::DoBSFCallStackAfterBreakpad ( )
static

Called after creating a Breakpad dump in order to also print the accessible callstack with BSF.

Definition at line 38 of file CrashHandler.cpp.

39 {
40  if(!BSFTriggered) {
41  BSFTriggered = true;
42 
43  auto log = Logger::Get();
44 
45  if(log) {
46 
47  log->Write("Attempting to dump stack trace with BSF:");
48  log->Write(bs::CrashHandler::getStackTrace().c_str());
49  log->Save();
50  }
51  }
52 }
static DLLEXPORT Logger * Get()
Definition: Logger.cpp:106

◆ IsBreakpadRegistered()

DLLEXPORT bool CrashHandler::IsBreakpadRegistered ( )
static
Returns
True when Breakpad is registered

This is used to skip writing the crash reports to disk (and showing the popup dialog on windows) from BSF.

Definition at line 54 of file CrashHandler.cpp.

55 {
56  return GenericCallback || SEHCallback;
57 }

◆ RegisterBreakpadGenericHandler()

DLLEXPORT void CrashHandler::RegisterBreakpadGenericHandler ( std::function< void()>  callback)
static

Handler for when BSF gets called first, should call the google_breakpad::ExceptionHandler::SimulateSignalDelivery or Windows equivalent.

Definition at line 27 of file CrashHandler.cpp.

28 {
29  GenericCallback = callback;
30 }

◆ RegisterBreakpadWindowsSEHHandler()

DLLEXPORT void CrashHandler::RegisterBreakpadWindowsSEHHandler ( std::function< void(void *data)>  callback)
static

Handler for SEH, this is separate to allow the data pointer to be passed.

Definition at line 32 of file CrashHandler.cpp.

34 {
35  SEHCallback = callback;
36 }

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