Add xontrib-pdb. Runs pdb on SIGUSR1.

This commit is contained in:
David Strobach 2020-06-05 02:27:19 +02:00
parent 552338b324
commit bcffe825df
2 changed files with 19 additions and 0 deletions

View file

@ -164,6 +164,11 @@
"description": ["Get identifiers, names, paths, URLs and words from the previous command output ",
"and use them for the next command."]
},
{"name": "pdb",
"package": "xonsh",
"url": "http://xon.sh",
"description": ["Simple built-in debugger. Runs pdb on reception of SIGUSR1 signal."]
},
{"name": "powerline",
"package": "xontrib-powerline",
"url": "https://github.com/santagada/xontrib-powerline",

14
xontrib/pdb.py Normal file
View file

@ -0,0 +1,14 @@
"""Simple built-in debugger. Runs pdb on reception of SIGUSR1 signal."""
import signal
__all__ = ()
def handle_sigusr1(sig, frame):
print("\nSIGUSR1 signal received. Starting interactive debugger...", flush=True)
import pdb
pdb.Pdb().set_trace(frame)
signal.signal(signal.SIGUSR1, handle_sigusr1)