예제 #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)
예제 #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)
예제 #3
0
파일: vim.py 프로젝트: vim-scripts/VimLite
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)
예제 #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)