Collaboration diagram for TiledArray::Debugger:

Documentation

The Debugger class describes what should be done when a catastrophic error causes unexpected program termination. It can try things such as start a debugger running where the program died or it can attempt to produce a stack traceback showing roughly where the program died. These attempts will not always succeed.

Definition at line 280 of file bug.h.

Public Member Functions

 Debugger (const char *exec=nullptr)
 Programmatic construction of Debugger. More...
 
virtual ~Debugger ()
 
virtual void debug (const char *reason)
 
virtual void traceback (const char *reason)
 
virtual void set_debug_on_signal (int)
 Turn on or off debugging on a signel. The default is on. More...
 
virtual void set_traceback_on_signal (int)
 Turn on or off traceback on a signel. The default is on. More...
 
virtual void set_exit_on_signal (int)
 Turn on or off exit after a signel. The default is on. More...
 
virtual void set_wait_for_debugger (int)
 
virtual void handle (int sig)
 The Debugger will be activated when sig is caught. More...
 
virtual void release (int sig)
 
virtual void handle_defaults ()
 This calls handle(int) with all of the major signals. More...
 
virtual void set_prefix (const char *p)
 This sets a prefix which preceeds all messages printing by Debugger. More...
 
virtual void set_prefix (int p)
 Set the prefix to the decimal represention of p followed by a ": ". More...
 
virtual void set_cmd (const char *)
 
virtual void default_cmd ()
 Calls set_cmd with a hopefully suitable default. More...
 
virtual void set_exec (const char *)
 
virtual void got_signal (int sig)
 Called when signal sig is received. This is mainly for internal use. More...
 

Static Public Member Functions

static void set_default_debugger (const std::shared_ptr< Debugger > &)
 Set the global default debugger. The initial value is null. More...
 
static std::shared_ptr< Debuggerdefault_debugger ()
 Return the global default debugger. More...
 

Protected Member Functions

void init ()
 

Static Protected Member Functions

static void __traceback (const std::string &prefix, const char *reason=nullptr)
 

Protected Attributes

std::string prefix_
 
std::string exec_
 
std::string cmd_
 
volatile int debugger_ready_
 
bool debug_
 
bool traceback_
 
bool exit_on_signal_
 
bool sleep_
 
bool wait_for_debugger_
 
bool handle_sigint_
 
int * mysigs_
 

Static Protected Attributes

static std::shared_ptr< Debuggerdefault_debugger_
 

Constructor & Destructor Documentation

◆ Debugger()

TiledArray::Debugger::Debugger ( const char *  exec = nullptr)
explicit

Programmatic construction of Debugger.

Parameters
execthe executable name

Definition at line 58 of file bug.cpp.

Here is the call graph for this function:

◆ ~Debugger()

TiledArray::Debugger::~Debugger ( )
virtual

Definition at line 75 of file bug.cpp.

Member Function Documentation

◆ __traceback()

void TiledArray::Debugger::__traceback ( const std::string &  prefix,
const char *  reason = nullptr 
)
staticprotected

prints out a backtrace

Parameters
prefixthis string will be prepended at the beginning of each line of Backtrace
reasonoptional string specifying the reason for traceback
Returns
backtrace

Definition at line 328 of file bug.cpp.

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

◆ debug()

void TiledArray::Debugger::debug ( const char *  reason)
virtual

The debug member attempts to start a debugger running on the current process.

Definition at line 203 of file bug.cpp.

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

◆ default_cmd()

void TiledArray::Debugger::default_cmd ( )
virtual

Calls set_cmd with a hopefully suitable default.

Definition at line 172 of file bug.cpp.

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

◆ default_debugger()

std::shared_ptr< Debugger > TiledArray::Debugger::default_debugger ( )
static

Return the global default debugger.

Definition at line 317 of file bug.cpp.

◆ got_signal()

void TiledArray::Debugger::got_signal ( int  sig)
virtual

Called when signal sig is received. This is mainly for internal use.

Definition at line 267 of file bug.cpp.

Here is the call graph for this function:

◆ handle()

void TiledArray::Debugger::handle ( int  sig)
virtual

The Debugger will be activated when sig is caught.

Definition at line 105 of file bug.cpp.

Here is the caller graph for this function:

◆ handle_defaults()

void TiledArray::Debugger::handle_defaults ( )
virtual

This calls handle(int) with all of the major signals.

Definition at line 120 of file bug.cpp.

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

◆ init()

void TiledArray::Debugger::init ( )
protected

Definition at line 82 of file bug.cpp.

Here is the caller graph for this function:

◆ release()

void TiledArray::Debugger::release ( int  sig)
virtual

Reverts the effect of handle(sig) , i.e. the Debugger will not be activated when sig is caught.

Definition at line 113 of file bug.cpp.

Here is the caller graph for this function:

◆ set_cmd()

void TiledArray::Debugger::set_cmd ( const char *  cmd)
virtual

Sets the command to be exectuted when debug is called. The character sequence "$(EXEC)" is replaced by the executable name (see set_exec), "$(PID)" is replaced by the current process id, and "$(PREFIX)" is replaced by the prefix.

Definition at line 194 of file bug.cpp.

Here is the caller graph for this function:

◆ set_debug_on_signal()

void TiledArray::Debugger::set_debug_on_signal ( int  v)
virtual

Turn on or off debugging on a signel. The default is on.

Definition at line 305 of file bug.cpp.

◆ set_default_debugger()

void TiledArray::Debugger::set_default_debugger ( const std::shared_ptr< Debugger > &  d)
static

Set the global default debugger. The initial value is null.

Definition at line 313 of file bug.cpp.

◆ set_exec()

void TiledArray::Debugger::set_exec ( const char *  exec)
virtual

Set the name of the executable for the current process. It is up to the programmer to set this, even if the Debugger is initialized with the KeyVal constructor.

Definition at line 150 of file bug.cpp.

Here is the caller graph for this function:

◆ set_exit_on_signal()

void TiledArray::Debugger::set_exit_on_signal ( int  v)
virtual

Turn on or off exit after a signel. The default is on.

Definition at line 311 of file bug.cpp.

◆ set_prefix() [1/2]

void TiledArray::Debugger::set_prefix ( const char *  p)
virtual

This sets a prefix which preceeds all messages printing by Debugger.

Definition at line 158 of file bug.cpp.

Here is the caller graph for this function:

◆ set_prefix() [2/2]

void TiledArray::Debugger::set_prefix ( int  p)
virtual

Set the prefix to the decimal represention of p followed by a ": ".

Definition at line 166 of file bug.cpp.

Here is the call graph for this function:

◆ set_traceback_on_signal()

void TiledArray::Debugger::set_traceback_on_signal ( int  v)
virtual

Turn on or off traceback on a signel. The default is on.

Definition at line 307 of file bug.cpp.

◆ set_wait_for_debugger()

void TiledArray::Debugger::set_wait_for_debugger ( int  v)
virtual

Turn on or off running an infinite loop after the debugger is started. This loop gives the debugger a chance to attack to the process. The default is on.

Definition at line 309 of file bug.cpp.

◆ traceback()

void TiledArray::Debugger::traceback ( const char *  reason)
virtual

The traceback member attempts to produce a Backtrace for the current process. A symbol table must be saved for the executable if any sense is to be made of the traceback. This feature is available on platforms with (1) libunwind, (2) backtrace, or (3) certain platforms with hardwired unwinding.

Parameters
reasonoptional string specifying the reason for traceback

Definition at line 324 of file bug.cpp.

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

Member Data Documentation

◆ cmd_

std::string TiledArray::Debugger::cmd_
protected

Definition at line 284 of file bug.h.

◆ debug_

bool TiledArray::Debugger::debug_
protected

Definition at line 287 of file bug.h.

◆ debugger_ready_

volatile int TiledArray::Debugger::debugger_ready_
protected

Definition at line 285 of file bug.h.

◆ default_debugger_

std::shared_ptr< Debugger > TiledArray::Debugger::default_debugger_
staticprotected

Definition at line 297 of file bug.h.

◆ exec_

std::string TiledArray::Debugger::exec_
protected

Definition at line 283 of file bug.h.

◆ exit_on_signal_

bool TiledArray::Debugger::exit_on_signal_
protected

Definition at line 289 of file bug.h.

◆ handle_sigint_

bool TiledArray::Debugger::handle_sigint_
protected

Definition at line 292 of file bug.h.

◆ mysigs_

int* TiledArray::Debugger::mysigs_
protected

Definition at line 293 of file bug.h.

◆ prefix_

std::string TiledArray::Debugger::prefix_
protected

Definition at line 282 of file bug.h.

◆ sleep_

bool TiledArray::Debugger::sleep_
protected

Definition at line 290 of file bug.h.

◆ traceback_

bool TiledArray::Debugger::traceback_
protected

Definition at line 288 of file bug.h.

◆ wait_for_debugger_

bool TiledArray::Debugger::wait_for_debugger_
protected

Definition at line 291 of file bug.h.


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