1 # This is startup file for interactive python debugger pdb.
2 # Use it like this in ~/.pdbrc:
4 # x = execfile("pdbrc.py")
5 # See http://wiki.python.org/moin/PdbRcIdea
13 # Command line history:
14 histfile = os.path.expanduser("~/.pdb_history")
17 readline.read_history_file(histfile)
22 def savehist(histfile=histfile):
26 histfilesize = os.environ.get('HISTFILESIZE') \
27 or os.environ.get('HISTSIZE')
30 histfilesize = int(histfilesize)
34 readline.set_history_length(histfilesize)
35 readline.write_history_file(histfile)
37 atexit.register(savehist)
40 def info(type, value, tb):
41 # return to debugger after fatal exception (Python cookbook 14.5):
46 if hasattr(sys, 'ps1') or not sys.stderr.isatty():
47 sys.__excepthook__(type, value, tb)
48 traceback.print_exception(type, value, tb)
56 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/498182
57 # https://github.com/giampaolo/sysconf/blob/master/home/.pdbrc.py
60 pdb.Pdb.complete = rlcompleter.Completer(locals()).complete
62 # Cleanup any variables that could otherwise clutter up the namespace.
63 del pdb, readline, rlcompleter