Skip to content

Instantly share code, notes, and snippets.

@duckworthd
Created April 24, 2012 20:34
Show Gist options
  • Save duckworthd/2483503 to your computer and use it in GitHub Desktop.
Save duckworthd/2483503 to your computer and use it in GitHub Desktop.
Instant Debug
'''
A module that allows one to press CTRL+\ at any time to pause program execution.
The stack may be examined with `u` and `d`, and the process can be continued with
`c`. For example,
import instant_debug
import time
for i in xrange(10000):
print i
time.sleep(0.1)
'''
import signal
import ipdb
def handler(signum, frame):
ipdb.set_trace()
signal.signal(signal.SIGQUIT, handler)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment