Today I created library to analyze hanged up programs in Python. The idea is very simple, but for people that are not used to debugging programs from console level may seems to a little bit unusual.
The source code and samples of usages are very short:
Import:
from super_debugger import super_debugger
Usage:
# The simplest basic usage:
sd = super_debugger(turn_on_filepath='a.txt', sleeping_time=1) # sleeping time is 60 by default
# To turn off debugger from scipt:
sd.turn_off = True
# We can turn off debuger by file also, be_verbose=True tell us what's going on with our thread
super_debugger(turn_on_filepath='a.txt', turn_off_filepath='b.txt', sleeping_time=1, be_verbose=True)
# We can call debugger by ctrl-c
super_debugger(ctrl_c_turn_on=True, sleeping_time=2)
Whole essence of this solution is based on separated thread which checks if specified trigger happended.
After we set trigger(file or ctrl-c) our thread starts set_trace() and in that moment we'are in debugger.
Once we're inside, we only have to change context to interesting one. (In most cases we landed out in our debug func or in signal library).
Installation (library works on Python2 and 3):
pip install super_debugger
Source code:
Github Super Debugger
Onsite super_debugger.zip