Exemplo n.º 1
0
def _pdb(vim, attach=False):
    """Start the python debugger thread."""
    Vim.pdb_running = True
    vim.debugger = vim.clazz(vim.options)
    pdb = vim.debugger
    pdb.target_thread_ident = thread.get_ident()

    # use a daemon thread
    class ClewnThread(threading.Thread):
        def __init__(self):
            threading.Thread.__init__(self, name='Clewn-thread')
            self.setDaemon(True)
        def run(self):
            vim.run_pdb()

    ClewnThread().start()
    pdb.synchronisation_evt.wait(1)
    if not pdb.synchronisation_evt.isSet():
        print >> sys.stderr, 'Aborting, failed to start the clewn thread.'
        sys.exit(1)
    atexit.register(close_clewnthread, vim)

    if attach:
        if vim.options.run:
            pdb.let_target_run = True
        pdb.set_trace(sys._getframe(2))
    else:
        pydb.main(pdb, vim.options)
Exemplo n.º 2
0
def _pdb(vim, attach=False, testrun=False):
    """Start the python debugger thread."""
    Vim.pdb_running = True
    pdb = vim.create_debugger(testrun)
    pdb.target_thread_ident = thread.get_ident()

    # use a daemon thread
    class ClewnThread(threading.Thread):
        def __init__(self):
            threading.Thread.__init__(self, name='Clewn-thread')
            self.setDaemon(True)

        def run(self):
            vim.run_pdb()

    ClewnThread().start()
    pdb.synchronisation_evt.wait(1)
    if not pdb.synchronisation_evt.isSet():
        print >> sys.stderr, 'Aborting, failed to start the clewn thread.'
        sys.exit(1)
    atexit.register(close_clewnthread, vim)

    if attach:
        if vim.options.run:
            pdb.let_target_run = True
        pdb.set_trace(sys._getframe(2))
    else:
        pydb.main(pdb, vim.options)
Exemplo n.º 3
0
def _pdb(vim, attach=False):
    """Start the python debugger thread."""
    if os.name != "posix":
        print >>sys.stderr, "Error, pdb is only supported on unix systems."
        sys.exit(1)

    Vim.pdb_running = True
    atexit.register(vim73_workaround, vim)
    vim.debugger = vim.clazz(vim.options)
    pdb = vim.debugger
    pdb.target_thread_ident = thread.get_ident()

    # use a daemon thread
    class ClewnThread(threading.Thread):
        def __init__(self):
            threading.Thread.__init__(self, name="Clewn-thread")
            self.setDaemon(True)

        def run(self):
            vim.run_pdb()

    ClewnThread().start()
    pdb.started_event.wait(1)
    if not pdb.started_event.isSet():
        print >>sys.stderr, "Aborting, failed to start the clewn thread."
        sys.exit(1)

    if attach:
        if vim.options.run:
            pdb.let_target_run = True
        pdb.set_trace(sys._getframe(2))
    else:
        pydb.main(pdb, vim.options)
Exemplo n.º 4
0
def _pdb(vim, attach=False):
    """Start the python debugger thread."""
    if os.name != 'posix':
        print >> sys.stderr, 'Error, pdb is only supported on unix systems.'
        sys.exit(1)

    Vim.pdb_running = True
    atexit.register(vim73_workaround, vim)
    vim.debugger = vim.clazz(vim.options)
    pdb = vim.debugger
    pdb.target_thread_ident = thread.get_ident()

    # use a daemon thread
    class ClewnThread(threading.Thread):
        def __init__(self):
            threading.Thread.__init__(self, name='Clewn-thread')
            self.setDaemon(True)

        def run(self):
            vim.run_pdb()

    ClewnThread().start()
    pdb.started_event.wait(1)
    if not pdb.started_event.isSet():
        print >> sys.stderr, 'Aborting, failed to start the clewn thread.'
        sys.exit(1)

    if attach:
        if vim.options.run:
            pdb.let_target_run = True
        pdb.set_trace(sys._getframe(2))
    else:
        pydb.main(pdb, vim.options)