Last active
April 5, 2017 08:43
-
-
Save nazavode/44b14c484fab0e8779b9b00b8b69ca50 to your computer and use it in GitHub Desktop.
Attach pdb to running Python process
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def attach(sig, frame): | |
import pdb | |
pdb.Pdb().set_trace(frame) | |
if __name__ == '__main__': | |
import signal | |
signal.signal(signal.SIGUSR1, attach) | |
# ... | |
# kill -USR1 <pid> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment