Ejemplo n.º 1
0
def trace_dispatch(py_db, frame, event, arg):
    #try:
    t = threadingCurrentThread()
    #except:
    #this could give an exception (python 2.5 bug), but should not be there anymore...
    #see http://mail.python.org/pipermail/python-bugs-list/2007-June/038796.html
    #and related bug: http://bugs.python.org/issue1733757
    #frame.f_trace = py_db.trace_dispatch
    #return py_db.trace_dispatch

    if getattr(t, 'pydev_do_not_trace', None):
        return None

    try:
        additional_info = t.additional_info
        if additional_info is None:
            raise AttributeError()
    except:
        additional_info = t.additional_info = PyDBAdditionalThreadInfo()

    thread_tracer = ThreadTracer((py_db, t, additional_info))
# IFDEF CYTHON
#     t._tracer = thread_tracer # Hack for cython to keep it alive while the thread is alive (just the method in the SetTrace is not enough).
# ELSE
# ENDIF
    SetTrace(thread_tracer.__call__)
    return thread_tracer.__call__(frame, event, arg)
Ejemplo n.º 2
0
def disable_tracing():
    from _pydevd_bundle.pydevd_tracing import SetTrace
    SetTrace(None)
    # debugger.disable_tracing_while_running()
    ipython_shell = get_ipython()
    ipython_shell.pydev_cell_info.latest_cell_id = 0
    if hasattr(ipython_shell, "debugger"):
        kill_pydev_threads(ipython_shell.debugger)
Ejemplo n.º 3
0
def trace_dispatch(py_db, frame, event, arg):
    t = threadingCurrentThread()

    if getattr(t, 'pydev_do_not_trace', None):
        return None

    try:
        additional_info = t.additional_info
        if additional_info is None:
            raise AttributeError()
    except:
        additional_info = t.additional_info = PyDBAdditionalThreadInfo()

    thread_tracer = ThreadTracer(
        (py_db, t, additional_info, global_cache_skips,
         global_cache_frame_skips))
    # IFDEF CYTHON
    #     t._tracer = thread_tracer # Hack for cython to keep it alive while the thread is alive (just the method in the SetTrace is not enough).
    # ELSE
    # ENDIF
    SetTrace(thread_tracer.__call__)
    return thread_tracer.__call__(frame, event, arg)
Ejemplo n.º 4
0
def enable_tracing():
    from _pydevd_bundle.pydevd_tracing import SetTrace
    debugger = get_ipython().debugger
    # SetTrace should be enough, because Jupyter creates new frame every time
    SetTrace(debugger.trace_dispatch)