Merge pull request #3606 from laloch/xontrib-pdb

Add pdb xontrib
This commit is contained in:
Anthony Scopatz 2020-08-01 13:34:20 -05:00 committed by GitHub
commit 8d676bd061
Failed to generate hash of commit
3 changed files with 42 additions and 0 deletions

23
news/xontrib-pdb.rst Normal file
View file

@ -0,0 +1,23 @@
**Added:**
* ``pdb`` xontrib, that runs pdb debugger on reception of SIGUSR1 signal.
**Changed:**
* <news item>
**Deprecated:**
* <news item>
**Removed:**
* <news item>
**Fixed:**
* <news item>
**Security:**
* <news item>

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)