ttg 1.0.0
Template Task Graph (TTG): flowgraph-based programming model for high-performance distributed-memory algorithms
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
ttg::Debugger Class Reference

#include <bug.h>

Public Member Functions

 Debugger (const char *exec=nullptr)
 Programmatic construction of Debugger.
 
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.
 
virtual void set_traceback_on_signal (int)
 Turn on or off traceback on a signel. The default is on.
 
virtual void set_exit_on_signal (int)
 Turn on or off exit after a signel. The default is on.
 
virtual void set_wait_for_debugger (int)
 
virtual void handle (int sig)
 The Debugger will be activated when sig is caught.
 
virtual void release (int sig)
 Reverts the effect of handle(sig) , i.e. the Debugger will not be activated when sig is caught.
 
virtual void handle_defaults ()
 This calls handle(int) with all of the major signals.
 
virtual void set_prefix (const char *p)
 This sets a prefix which preceeds all messages printing by Debugger.
 
virtual void set_prefix (int p)
 Set the prefix to the decimal represention of p followed by a ": ".
 
virtual void set_cmd (const char *)
 
virtual void default_cmd ()
 Calls set_cmd with a hopefully suitable default.
 
virtual void set_exec (const char *)
 
virtual void got_signal (int sig)
 Called when signal sig is received. This is mainly for internal use.
 

Static Public Member Functions

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

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_
 

Detailed Description

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 271 of file bug.h.

Constructor & Destructor Documentation

◆ Debugger()

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

Programmatic construction of Debugger.

Parameters
execthe executable name

Definition at line 158 of file bug.cpp.

Here is the call graph for this function:

◆ ~Debugger()

Debugger::~Debugger ( )
virtual

Definition at line 175 of file bug.cpp.

Member Function Documentation

◆ __traceback()

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

prints out a backtrace to std::cout

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

Definition at line 415 of file bug.cpp.

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

◆ debug()

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

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

Definition at line 299 of file bug.cpp.

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

◆ default_cmd()

void Debugger::default_cmd ( )
virtual

Calls set_cmd with a hopefully suitable default.

Definition at line 272 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 > Debugger::default_debugger ( )
static

Return the global default debugger.

Definition at line 409 of file bug.cpp.

Here is the caller graph for this function:

◆ got_signal()

void Debugger::got_signal ( int  sig)
virtual

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

Definition at line 361 of file bug.cpp.

Here is the call graph for this function:

◆ handle()

void Debugger::handle ( int  sig)
virtual

The Debugger will be activated when sig is caught.

Definition at line 205 of file bug.cpp.

Here is the caller graph for this function:

◆ handle_defaults()

void Debugger::handle_defaults ( )
virtual

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

Definition at line 220 of file bug.cpp.

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

◆ init()

void Debugger::init ( )
protected

Definition at line 182 of file bug.cpp.

Here is the caller graph for this function:

◆ release()

void 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 213 of file bug.cpp.

Here is the caller graph for this function:

◆ set_cmd()

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

Sets the command to be executed 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 290 of file bug.cpp.

Here is the caller graph for this function:

◆ set_debug_on_signal()

void Debugger::set_debug_on_signal ( int  v)
virtual

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

Definition at line 399 of file bug.cpp.

◆ set_default_debugger()

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

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

Definition at line 407 of file bug.cpp.

Here is the caller graph for this function:

◆ set_exec()

void 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 250 of file bug.cpp.

Here is the caller graph for this function:

◆ set_exit_on_signal()

void Debugger::set_exit_on_signal ( int  v)
virtual

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

Definition at line 405 of file bug.cpp.

◆ set_prefix() [1/2]

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

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

Definition at line 258 of file bug.cpp.

Here is the caller graph for this function:

◆ set_prefix() [2/2]

void Debugger::set_prefix ( int  p)
virtual

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

Definition at line 266 of file bug.cpp.

Here is the call graph for this function:

◆ set_traceback_on_signal()

void Debugger::set_traceback_on_signal ( int  v)
virtual

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

Definition at line 401 of file bug.cpp.

◆ set_wait_for_debugger()

void 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 403 of file bug.cpp.

◆ traceback()

void 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 413 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 ttg::Debugger::cmd_
protected

Definition at line 275 of file bug.h.

◆ debug_

bool ttg::Debugger::debug_
protected

Definition at line 278 of file bug.h.

◆ debugger_ready_

volatile int ttg::Debugger::debugger_ready_
protected

Definition at line 276 of file bug.h.

◆ default_debugger_

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

Definition at line 288 of file bug.h.

◆ exec_

std::string ttg::Debugger::exec_
protected

Definition at line 274 of file bug.h.

◆ exit_on_signal_

bool ttg::Debugger::exit_on_signal_
protected

Definition at line 280 of file bug.h.

◆ handle_sigint_

bool ttg::Debugger::handle_sigint_
protected

Definition at line 283 of file bug.h.

◆ mysigs_

int* ttg::Debugger::mysigs_
protected

Definition at line 284 of file bug.h.

◆ prefix_

std::string ttg::Debugger::prefix_
protected

Definition at line 273 of file bug.h.

◆ sleep_

bool ttg::Debugger::sleep_
protected

Definition at line 281 of file bug.h.

◆ traceback_

bool ttg::Debugger::traceback_
protected

Definition at line 279 of file bug.h.

◆ wait_for_debugger_

bool ttg::Debugger::wait_for_debugger_
protected

Definition at line 282 of file bug.h.


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