sc::Debugger(3)

πŸ“¦
version 2.3.1 Β· 5 versions
, in ubuntu jammy

πŸ’… sc::Debugger(3) β€” the MPQC manual page, bestie πŸ¦‹

🌸 NAME 🌸

okay so sc::Debugger is literally the class that describes what should be done when a catastrophic error causes unexpected program termination. periodt. πŸ’–

✨ SYNOPSIS ✨

#include <bug.h>

Inherits sc::SavableState.

πŸ’– Public Member Functions πŸ’–

  • Debugger (const char *exec=0) β€” constructor vibes, with exec defaulting to 0.
  • Debugger (const Ref< KeyVal > &) β€” the KeyVal constructor; it understands the keywords listed down below, bestie.
  • Debugger (StateIn &) β€” constructor that takes a StateIn.
  • virtual void debug (const char *reason=0) β€” the debug member tries to start a debugger running on the current process.
  • virtual void traceback (const char *reason=0) β€” the traceback member attempts a stack traceback for the current process.
  • virtual void set_debug_on_signal (int) β€” turn debugging on or off on a signal. The default is on.
  • virtual void set_traceback_on_signal (int) β€” turn traceback on or off on a signal. The default is on.
  • virtual void set_exit_on_signal (int) β€” turn exit after a signal on or off. The default is on.
  • virtual void set_wait_for_debugger (int) β€” turn on or off running an infinite loop after the debugger is started.
  • virtual void handle (int sig) β€” the Debugger will get 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 precedes all messages printed by Debugger.
  • virtual void set_prefix (int p) β€” set the prefix to the decimal representation of p followed by a ': '.
  • virtual void set_cmd (const char *) β€” sets the command to be executed when debug is called.
  • virtual void default_cmd () β€” calls set_cmd with a hopefully suitable default.
  • virtual void set_exec (const char *) β€” set the name of the executable for the current process.
  • virtual void got_signal (int sig) β€” called when signal sig is received. This is mainly for internal use.
  • void save_data_state (StateOut &) β€” save the base classes (with save_data_state ) and the members in the same order that the StateIn CTOR initializes them.

✨ Static Public Member Functions ✨

  • static void set_default_debugger (const Ref< Debugger > &) β€” set the global default debugger. The initial value is null.
  • static Debugger * default_debugger () β€” return the global default debugger.

πŸŽ€ Protected Member Functions πŸŽ€

  • void init ()

πŸ¦‹ Protected Attributes πŸ¦‹

  • char * prefix_
  • char * exec_
  • char * cmd_
  • volatile int debugger_ready_
  • int debug_
  • int traceback_
  • int exit_on_signal_
  • int sleep_
  • int wait_for_debugger_
  • int handle_sigint_
  • int * mysigs_

🌸 Static Protected Attributes 🌸

  • static Debugger * default_debugger_

πŸ’– Detailed Description πŸ’–

okay so the Debugger class describes what should be done when a catastrophic error causes unexpected program termination. no cap. 😭

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 β€” lowkey important. πŸ’…

πŸŽ€ Constructor & Destructor Documentation πŸŽ€

πŸŽ€ sc::Debugger::Debugger (const Ref< KeyVal > &) πŸŽ€

The KeyVal constructor understands the following keywords, bestie:

  • debug β€” try to start a debugger when an error occurs. Doesn't work on all machines. The default is true, if possible.
  • traceback β€” 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.
  • exit β€” exit on errors. The default is true.
  • wait_for_debugger β€” when starting a debugger go into an infinite loop to give the debugger a chance to attach to the process. The default is true.
  • sleep β€” when starting a debugger wait this many seconds to give the debugger a chance to attach to the process. The default is 0.
  • handle_defaults β€” handle a standard set of signals such as SIGBUS, SIGSEGV, etc. The default is true.
  • prefix β€” gives a string that is printed before each line that is printed by Debugger. The default is nothing.
  • cmd β€” gives a command to be executed to start the debugger. The default varies with machine.

πŸ”₯ Member Function Documentation πŸ”₯

πŸ”₯ void sc::Debugger::save_data_state (StateOut &) [virtual] πŸ”₯

Save the base classes (with save_data_state ) and the members in the same order that the StateIn CTOR initializes them. This must be implemented by the derived class if the class has data. Reimplemented from sc::SavableState.

πŸ¦‹ virtual void sc::Debugger::set_cmd (const char *) [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.

πŸŽ€ virtual void sc::Debugger::set_exec (const char *) [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.

πŸ’œ virtual void sc::Debugger::set_wait_for_debugger (int) [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. 😭

πŸ’– virtual void sc::Debugger::traceback (const char * reason = 0) [virtual] πŸ’–

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.

πŸ’œ Author πŸ’œ

Generated automatically by Doxygen for MPQC from the source code.


πŸ’– cute sign-off: this iconic page is from MPQC, Version 2.3.1, dated Sun Oct 4 2020, and it’s the sc::Debugger(3) manual page. slay. πŸŽ€βœ¨

πŸ“¦ where this page comes from