.TH "sc::Debugger" 3 "Sun Oct 4 2020" "Version 2.3.1" "MPQC" \" -*- nroff -*- .ad l .nh .SH NAME sc::Debugger \- The \fBDebugger\fP class describes what should be done when a catastrophic error causes unexpected program termination\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBsc::SavableState\fP\&. .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBDebugger\fP (const char *exec=0)" .br .ti -1c .RI "\fBDebugger\fP (const \fBRef\fP< \fBKeyVal\fP > &)" .br .RI "The \fBKeyVal\fP constructor understands the following keywords: " .ti -1c .RI "\fBDebugger\fP (\fBStateIn\fP &)" .br .ti -1c .RI "virtual void \fBdebug\fP (const char *reason=0)" .br .RI "The debug member attempts to start a debugger running on the current process\&. " .ti -1c .RI "virtual void \fBtraceback\fP (const char *reason=0)" .br .RI "The traceback member attempts a stack traceback for the current process\&. " .ti -1c .RI "virtual void \fBset_debug_on_signal\fP (int)" .br .RI "Turn on or off debugging on a signel\&. The default is on\&. " .ti -1c .RI "virtual void \fBset_traceback_on_signal\fP (int)" .br .RI "Turn on or off traceback on a signel\&. The default is on\&. " .ti -1c .RI "virtual void \fBset_exit_on_signal\fP (int)" .br .RI "Turn on or off exit after a signel\&. The default is on\&. " .ti -1c .RI "virtual void \fBset_wait_for_debugger\fP (int)" .br .RI "Turn on or off running an infinite loop after the debugger is started\&. " .ti -1c .RI "virtual void \fBhandle\fP (int sig)" .br .RI "The \fBDebugger\fP will be actived when sig is caught\&. " .ti -1c .RI "virtual void \fBhandle_defaults\fP ()" .br .RI "This calls \fBhandle(int)\fP with all of the major signals\&. " .ti -1c .RI "virtual void \fBset_prefix\fP (const char *p)" .br .RI "This sets a prefix which preceeds all messages printing by \fBDebugger\fP\&. " .ti -1c .RI "virtual void \fBset_prefix\fP (int p)" .br .RI "Set the prefix to the decimal represention of p followed by a ': '\&. " .ti -1c .RI "virtual void \fBset_cmd\fP (const char *)" .br .RI "Sets the command to be exectuted when debug is called\&. " .ti -1c .RI "virtual void \fBdefault_cmd\fP ()" .br .RI "Calls set_cmd with a hopefully suitable default\&. " .ti -1c .RI "virtual void \fBset_exec\fP (const char *)" .br .RI "Set the name of the exectuble for the current process\&. " .ti -1c .RI "virtual void \fBgot_signal\fP (int sig)" .br .RI "Called with signal sig is received\&. This is mainly for internal use\&. " .ti -1c .RI "void \fBsave_data_state\fP (\fBStateOut\fP &)" .br .RI "Save the base classes (with save_data_state) and the members in the same order that the \fBStateIn\fP CTOR initializes them\&. " .in -1c .SS "Static Public Member Functions" .in +1c .ti -1c .RI "static void \fBset_default_debugger\fP (const \fBRef\fP< \fBDebugger\fP > &)" .br .RI "Set the global default debugger\&. The initial value is null\&. " .ti -1c .RI "static \fBDebugger\fP * \fBdefault_debugger\fP ()" .br .RI "Return the global default debugger\&. " .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "void \fBinit\fP ()" .br .in -1c .SS "Protected Attributes" .in +1c .ti -1c .RI "char * \fBprefix_\fP" .br .ti -1c .RI "char * \fBexec_\fP" .br .ti -1c .RI "char * \fBcmd_\fP" .br .ti -1c .RI "volatile int \fBdebugger_ready_\fP" .br .ti -1c .RI "int \fBdebug_\fP" .br .ti -1c .RI "int \fBtraceback_\fP" .br .ti -1c .RI "int \fBexit_on_signal_\fP" .br .ti -1c .RI "int \fBsleep_\fP" .br .ti -1c .RI "int \fBwait_for_debugger_\fP" .br .ti -1c .RI "int \fBhandle_sigint_\fP" .br .ti -1c .RI "int * \fBmysigs_\fP" .br .in -1c .SS "Static Protected Attributes" .in +1c .ti -1c .RI "static \fBDebugger\fP * \fBdefault_debugger_\fP" .br .in -1c .SH "Detailed Description" .PP The \fBDebugger\fP 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\&. .br .SH "Constructor & Destructor Documentation" .PP .SS "sc::Debugger::Debugger (const \fBRef\fP< \fBKeyVal\fP > &)" .PP The \fBKeyVal\fP constructor understands the following keywords: .IP "\fB\fCdebug\fP\fP" 1c Try to start a debugger when an error occurs\&. Doesn't work on all machines\&. The default is true, if possible\&. .PP .IP "\fB\fCtraceback\fP\fP" 1c Try to print out a traceback extracting return addresses from the call stack\&. Doesn't work on most machines\&. The default is true, if possible\&. .PP .IP "\fB\fCexit\fP\fP" 1c Exit on errors\&. The default is true\&. .PP .IP "\fB\fCwait_for_debugger\fP\fP" 1c When starting a debugger go into an infinite loop to give the debugger a chance to attach to the process\&. The default is true\&. .PP .IP "\fB\fCsleep\fP\fP" 1c When starting a debugger wait this many seconds to give the debugger a chance to attach to the process\&. The default is 0\&. .PP .IP "\fB\fChandle_defaults\fP\fP" 1c Handle a standard set of signals such as SIGBUS, SIGSEGV, etc\&. The default is true\&. .PP .IP "\fB\fCprefix\fP\fP" 1c Gives a string that is printed before each line that is printed by \fBDebugger\fP\&. The default is nothing\&. .PP .IP "\fB\fCcmd\fP\fP" 1c Gives a command to be executed to start the debugger\&. The default varies with machine\&. .PP .PP .SH "Member Function Documentation" .PP .SS "void sc::Debugger::save_data_state (\fBStateOut\fP &)\fC [virtual]\fP" .PP Save the base classes (with save_data_state) and the members in the same order that the \fBStateIn\fP CTOR initializes them\&. This must be implemented by the derived class if the class has data\&. .PP Reimplemented from \fBsc::SavableState\fP\&. .SS "virtual void sc::Debugger::set_cmd (const char *)\fC [virtual]\fP" .PP 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\&. .SS "virtual void sc::Debugger::set_exec (const char *)\fC [virtual]\fP" .PP Set the name of the exectuble for the current process\&. It is up to the programmer to set this, even if the \fBDebugger\fP is initialized with the \fBKeyVal\fP constructor\&. .SS "virtual void sc::Debugger::set_wait_for_debugger (int)\fC [virtual]\fP" .PP 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\&. .SS "virtual void sc::Debugger::traceback (const char * reason = \fC0\fP)\fC [virtual]\fP" .PP The traceback member attempts a stack traceback for the current process\&. A symbol table must be saved for the executable if any sense is to be made of the traceback\&. Tracebacks are currently available only for a limited number of architectures\&. .SH "Author" .PP Generated automatically by Doxygen for MPQC from the source code\&.