def set_trace(frame=None): update_stdout() wrap_sys_excepthook() if frame is None: frame = sys._getframe().f_back pdb = Pdb(def_colors) # set hook pdb.shell.set_hook('synchronize_with_editor', synchronize_with_editor) pdb.set_trace(frame)
def __init__(self, *args, **kwds): Pdb.__init__(self, *args, **kwds) if options.pdbrc is not None: try: rcFile = open(options.pdbrc) except IOError: pass else: for line in rcFile.readlines(): self.rcLines.append(line) rcFile.close() self.cont = False
def create_debugger(pdb=None): """Create debugger""" if pdb is None: with redirect_output(): try: from ipdb.__main__ import Pdb, def_colors pdb = Pdb(def_colors) except ImportError: from pdb import Pdb pdb = Pdb class NowDebugger(pdb): """Debugger that invokes both pdb tracer and noWorkflow""" def __init__(self, provider, *args, **kwargs): super(NowDebugger, self).__init__(*args, **kwargs) self.provider = provider def trace_dispatch(self, frame, event, arg): pdb.trace_dispatch(self, frame, event, arg) self.provider.tracer(frame, event, arg) return self.trace_dispatch return NowDebugger
def setup(self, f, t): Pdb.setup(self, f, t) # so 'enter' defaults to continue at start self.lastcmd = 'c'