hydrogen 1.2.6
Reporter Class Reference

Crash reporter class. More...

#include <Reporter.h>

Inheritance diagram for Reporter:

Public Slots

void on_finished (int exitCode, QProcess::ExitStatus exitStatus)
 
void on_openLog (void)
 
void on_readyReadStandardError (void)
 
void on_readyReadStandardOutput (void)
 

Public Member Functions

 Reporter (QProcess *child)
 
 ~Reporter ()
 

Static Public Member Functions

static void handleSignal (int nSignal)
 
static void report (void)
 Report some crash details in a crashing child (mostly, the Logger 'crash context' string)
 
static void spawn (int argc, char *argv[])
 Potentially spawn child process.
 

Private Member Functions

void addLine (QString s)
 
void waitForFinished ()
 

Private Attributes

std::deque< QString > m_lines
 
QProcess * m_pChild
 
QString m_sContext
 

Static Private Attributes

static std::set< QProcess * > m_children
 
static QString m_sLogFile
 
static QString m_sPrefix = "Fatal error in: "
 

Detailed Description

Crash reporter class.

The crash reporter provides a split-process model for reporting crashes from Hydrogen, with a simple GUI giving options to view the log file, other details or open a browser to the issue tracker.

Early on, the calling process should call Reporter::spawn(). For the parent process, this causes the child to be spawned (adding "--child" to command line arguments), and the parent process will wait for the termination of the child, and report a crash if an abnormal exit occurs, or just exit silently otherwise. The parent never returns from Reporter::spawn().

The child process will identify itself through having "--child" in the command line arguments, and continue as normal.

The Logger 'crash context' can be reported by the child process during a crash by using Reporter::report().

The parent process passes through stdout and sterr from the child process, but also notes any reported crash context, which is communicated by stderr with a specific prefix. Recent lines from stderr / stdout are recorded in the parent (reporter) process to be displayed as crash details if needed.

Definition at line 54 of file Reporter.h.

Constructor & Destructor Documentation

◆ Reporter()

Reporter ( QProcess * child)

Definition at line 66 of file Reporter.cpp.

◆ ~Reporter()

~Reporter ( )

Definition at line 84 of file Reporter.cpp.

Member Function Documentation

◆ addLine()

void addLine ( QString s)
private

Definition at line 40 of file Reporter.cpp.

◆ handleSignal()

void handleSignal ( int nSignal)
static

Definition at line 203 of file Reporter.cpp.

◆ on_finished

void on_finished ( int exitCode,
QProcess::ExitStatus exitStatus )
slot

Definition at line 131 of file Reporter.cpp.

◆ on_openLog

void on_openLog ( void )
slot

Definition at line 125 of file Reporter.cpp.

◆ on_readyReadStandardError

void on_readyReadStandardError ( void )
slot

Definition at line 111 of file Reporter.cpp.

◆ on_readyReadStandardOutput

void on_readyReadStandardOutput ( void )
slot

Definition at line 118 of file Reporter.cpp.

◆ report()

void report ( void )
static

Report some crash details in a crashing child (mostly, the Logger 'crash context' string)

Definition at line 98 of file Reporter.cpp.

◆ spawn()

void spawn ( int argc,
char * argv[] )
static

Potentially spawn child process.

Definition at line 225 of file Reporter.cpp.

◆ waitForFinished()

void waitForFinished ( )
private

Definition at line 89 of file Reporter.cpp.

Field Documentation

◆ m_children

std::set< QProcess * > m_children
staticprivate

Definition at line 69 of file Reporter.h.

◆ m_lines

std::deque< QString > m_lines
private

Definition at line 59 of file Reporter.h.

◆ m_pChild

QProcess* m_pChild
private

Definition at line 58 of file Reporter.h.

◆ m_sContext

QString m_sContext
private

Definition at line 62 of file Reporter.h.

◆ m_sLogFile

QString m_sLogFile
staticprivate

Definition at line 63 of file Reporter.h.

◆ m_sPrefix

QString m_sPrefix = "Fatal error in: "
staticprivate

Definition at line 61 of file Reporter.h.