Tracer  v0.0.1
A platform independant stack trace generator
tracer::SystemInfoPrinter Class Reference

Prints additional information before the first stack frame. More...

#include <SystemInfoPrinter.hpp>

+ Inheritance diagram for tracer::SystemInfoPrinter:
+ Collaboration diagram for tracer::SystemInfoPrinter:

Classes

struct  InfoEntry
 An system information entry (library version, etc) More...
 

Public Member Functions

void setSignum (int sNum)
 Sets the signal number to display.
 
void addSystemEntry (InfoEntry e)
 Adds a new entry to print.
 
std::string getOSString ()
 Returns a string with the name and version of the current OS.
 
- Public Member Functions inherited from tracer::DefaultPrinter
void setConfig (Config newCfg)
 Sets the new config.
 
Config getConfig () const
 Returns the current.
 
- Public Member Functions inherited from tracer::AbstractPrinter
 AbstractPrinter ()
 Default constructor.
 
std::string genStringPreFrame (size_t frameNum)
 Generates a string for the frame information (prefix) More...
 
std::string genStringForFrame (size_t frameNum)
 Generates a string for the frame information. More...
 
std::string genStringPostFrame (size_t frameNum)
 Generates a string for the frame information (suffix) More...
 
std::string generateString ()
 Generates a string for the complete stack trace. More...
 
void printToFile (std::string file, bool append=true)
 Prints the stack trace to a file. More...
 
void printToStdOut ()
 prints the stack trace to STDOUT
 
void printToStdErr ()
 prints the stack trace to STDERR
 
void enableColor ()
 Enables colored output (ANSI escape sequences)
 
void disableColor ()
 Disables colored output (ANSI escape sequences)
 
void setTrace (Tracer *t)
 Sets the trace to print. More...
 

Static Public Member Functions

static std::string sigNum2Str (int sNum)
 Converts a signal number to a string. More...
 

Protected Member Functions

std::string genStringPreFrameIMPL (size_t frameNum) override
 Generate string for the frame info prefix. More...
 
- Protected Member Functions inherited from tracer::DefaultPrinter
std::string genStringForFrameIMPL (size_t frameNum) override
 Generate string for the frame info.
 
void setupTrace () override
 This function will be called when the trace is sets.
 
- Protected Member Functions inherited from tracer::AbstractPrinter
virtual std::string genStringPostFrameIMPL (size_t frameNum)
 Generate string for the frame info suffix. More...
 

Additional Inherited Members

- Protected Attributes inherited from tracer::AbstractPrinter
Tracertrace = nullptr
 Pointer to the trace.
 
bool disableColorB = false
 Whether to disable colored output or not.
 

Detailed Description

Prints additional information before the first stack frame.

Automatically detects the current operating system

Definition at line 55 of file SystemInfoPrinter.hpp.

Member Function Documentation

◆ genStringPreFrameIMPL()

string SystemInfoPrinter::genStringPreFrameIMPL ( size_t  frameNum)
overrideprotectedvirtual

Generate string for the frame info prefix.

Default implementation.

Reimplemented from tracer::AbstractPrinter.

Definition at line 281 of file SystemInfoPrinter.cpp.

◆ sigNum2Str()

string SystemInfoPrinter::sigNum2Str ( int  sNum)
static

Converts a signal number to a string.

Parameters
sNumThe number to convert
Returns
The resulting string

Definition at line 237 of file SystemInfoPrinter.cpp.


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