Three little enhancements/mini-bugs:
1) Adding the following lines to the "main part" of pdb.py
gives it the ability to stay in pdb if the program crashes.
Very handy!
# Ensure that we end up in pdb if we crash
def pdb_on_crash(type, value, tb):
sys.__excepthook__(type, value, tb)
post_mortem(tb)
sys.excepthook = pdb_on_crash
2) There's also a problem in the last lines of pdb.py:
# Insert script directory in front of module search path
sys.path.insert(0, os.path.dirname(filename))
This leaves the directory path under which pdb.py was
invoked in sys.path. This is a problem if pdb.py was
invoked e.g. via a link a la /usr/pdb. This leads to the last
and related suggestion.
3) It would be very convenient if a pyhon installation would
also install a link /usr/pdb -> /usr/lib/python2.3/pdb.py.
This provides for easy invocation and, for example, it's also
the default command used by Emacs' pdb-mode.
|