1.3.3 Entering the Debugger from Outside the Program

It's possible to set things up so that when you send a signal to your program you enter the debugger. Up until that point though there will be no overhead associated with the debugger.

To do this, you need to create an instance of the SignalManager object and call that object's action method passing a string exactly like you would for the debugger's handle command. Here's an example:

  ...
  from pydb.sighandler import SignalManager
  ...
  h = SignalManager()
  h.action('SIGUSR1 stack print stop')
  ...

In the above example, a signal handler is set up so that when the SIGUSR1 signal is sent, we will print a message, show the stack trace and then stop inside the debugger. If you don't want to stop inside the debugger bug just see where you are omit the ``stop'' keyword or change it it ``nostop''.

See 1.2.13 for information parameters names used in the string and their meanings.

See About this document... for information on suggesting changes.