Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Merging master > dbg_adapter_refactor. #1758

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
8413411
Remove more unused code. (#1459)
karthiknadig May 22, 2019
9a263f9
Add json-dap command line and debug options (#1461)
karthiknadig May 23, 2019
016b557
Properly validate breakpoints. Fixes #1191 (#1462)
fabioz May 25, 2019
862a0c1
Show message when stepping into library code with justMyCode=true. Fi…
fabioz May 30, 2019
7c33548
Stepping in multi-threaded case should continue other threads. Fixes …
fabioz Jun 13, 2019
7f76c4b
Don't fail attach to pid if 'ProgramFiles' env var is not available. …
fabioz Jun 13, 2019
f3b0bb0
Add systeminfo to pydevd (#1514)
karthiknadig Jun 13, 2019
59ef763
Move more code to pydevd (#1519)
karthiknadig Jun 13, 2019
1fce9be
Support attach to pid with Python 3.7. Fixes #846 (#1521)
fabioz Jun 17, 2019
daf9206
Support running code in target process to attach to pid in Linux. Par…
fabioz Jun 19, 2019
71e90ff
Restore formatting of command line switch table.
int19h Jun 19, 2019
161b201
Add API to selectively enable and disable tracing. (#1536)
int19h Jun 20, 2019
1b5f6ef
Ensure port is set on enable_attach (#1537)
karthiknadig Jun 24, 2019
57e50a6
Trace existing threads on settrace. Fixes #509 (#1541)
fabioz Jun 26, 2019
9666eac
Update Debug Adapter Protocol links
SamB Jun 29, 2019
27e6388
Send continued event when all threads resume. Fixes #1530. (#1554)
fabioz Jul 3, 2019
4df8531
Update debugOptions in docs (#1561)
karthiknadig Jul 3, 2019
f3aaa3b
Option to break on SystemExit == 0 in pydevd. Fixes #1223 (#1565)
fabioz Jul 7, 2019
65c50f8
Add source mapping to support ipython cells. Fixes #1503
fabioz Jul 4, 2019
95c456d
Don't trace <string> files unless it's the one from python -c. Fixes …
fabioz Jul 5, 2019
4d87f56
Add a conda-forge badge (#1572)
dhirschfeld Jul 10, 2019
70ae96f
Temporarily use older flask for CI (#1584)
karthiknadig Jul 11, 2019
6283741
Use set_additional_thread_info to obtain the additional thread info. …
fabioz Jul 12, 2019
76863a9
Attach to pid fixes with threading. Fixes #1542,#1520 (#1582)
fabioz Jul 12, 2019
62501ba
Don't try to patch arguments when not dealing with python. Fixes #15…
fabioz Jul 12, 2019
8929cbb
Minor update to TROUBLESHOOTING.md
karthiknadig Jul 14, 2019
12ea929
Update DAP (#1598)
karthiknadig Jul 16, 2019
0e173e9
Fix for breakpoint binding issue in VS (#1601)
karthiknadig Jul 17, 2019
7ceda11
Update contributing instructions
karthiknadig Jul 26, 2019
f6d04ea
Create question.md
karthiknadig Jul 31, 2019
81ac055
Ensure stopped on goto changes focus (#1668)
karthiknadig Aug 9, 2019
152edeb
Different implementation to set tracing to other threads for Python 3…
fabioz Aug 9, 2019
46e1b75
Only set PyDB as the global debugger after it's initialized. Fixes #1…
fabioz Aug 13, 2019
a08708d
Autoreload in CherryPy no longer blocked by pydevd threads. Fixes #16…
fabioz Aug 20, 2019
90298c4
Password no longer echoed in getpass (in Windows). Fixes #1723
fabioz Aug 29, 2019
fd20f00
Merge master > dbg_adapter_refactor
fabioz Sep 10, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 56 additions & 43 deletions src/ptvsd/_vendored/pydevd/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,102 +20,115 @@ matrix:
- python: 2.7
env:
- PYDEVD_USE_CYTHON=NO
- PYDEVD_TEST_JYTHON=YES
- PYDEVD_TEST_VM=JYTHON
- JYTHON_URL=http://search.maven.org/remotecontent?filepath=org/python/jython-installer/2.7.1/jython-installer-2.7.1.jar

# PyPy
- python: 2.7
env:
- PYDEVD_PYTHON_VERSION=3.6
- PYDEVD_USE_CYTHON=NO
- PYDEVD_TEST_VM=PYPY

# Python 2.6 (with and without cython)
- python: 2.7
env:
- PYDEVD_PYTHON_VERSION=2.6
- PYDEVD_USE_CYTHON=NO
- PYDEVD_TEST_JYTHON=NO
- PYDEVD_TEST_VM=CPYTHON
# - python: 2.7
# env:
# - PYDEVD_PYTHON_VERSION=2.6
# - PYDEVD_USE_CYTHON=YES
# - PYDEVD_TEST_JYTHON=NO
# - PYDEVD_TEST_VM=CPYTHON

# Python 2.7 (with and without cython)
- python: 2.7
env:
- PYDEVD_PYTHON_VERSION=2.7
- PYDEVD_USE_CYTHON=NO
- PYDEVD_TEST_JYTHON=NO
# env:
# - PYDEVD_PYTHON_VERSION=2.7
# - PYDEVD_USE_CYTHON=NO
# - PYDEVD_TEST_VM=CPYTHON
- python: 2.7
env:
- PYDEVD_PYTHON_VERSION=2.7
- PYDEVD_USE_CYTHON=YES
- PYDEVD_TEST_JYTHON=NO
- PYDEVD_TEST_VM=CPYTHON

# Python 3.5 (with and without cython)
# - python: 2.7
# env:
# - PYDEVD_PYTHON_VERSION=3.5
# - PYDEVD_USE_CYTHON=NO
# - PYDEVD_TEST_JYTHON=NO
# - PYDEVD_TEST_VM=CPYTHON
- python: 2.7
env:
- PYDEVD_PYTHON_VERSION=3.5
- PYDEVD_USE_CYTHON=YES
- PYDEVD_TEST_JYTHON=NO
- PYDEVD_TEST_VM=CPYTHON

# Python 3.6 (with and without cython)
# - python: 2.7
# env:
# - PYDEVD_PYTHON_VERSION=3.6
# - PYDEVD_USE_CYTHON=NO
# - PYDEVD_TEST_JYTHON=NO
- python: 2.7
env:
- PYDEVD_PYTHON_VERSION=3.6
- PYDEVD_USE_CYTHON=YES
- PYDEVD_TEST_JYTHON=NO
- PYDEVD_USE_CYTHON=NO
- PYDEVD_TEST_VM=CPYTHON
# - python: 2.7
# env:
# - PYDEVD_PYTHON_VERSION=3.6
# - PYDEVD_USE_CYTHON=YES
# - PYDEVD_TEST_VM=CPYTHON

# Python 3.7 (with and without cython)
- python: 2.7
env:
- PYDEVD_PYTHON_VERSION=3.7
- PYDEVD_USE_CYTHON=NO
- PYDEVD_TEST_JYTHON=NO
# - python: 2.7
# env:
# - PYDEVD_PYTHON_VERSION=3.7
# - PYDEVD_USE_CYTHON=YES
# - PYDEVD_TEST_JYTHON=NO
# - PYDEVD_USE_CYTHON=NO
# - PYDEVD_TEST_VM=CPYTHON
- python: 2.7
env:
- PYDEVD_PYTHON_VERSION=3.7
- PYDEVD_USE_CYTHON=YES
- PYDEVD_TEST_VM=CPYTHON

before_install:
# CPython setup
- if [ "$PYDEVD_TEST_JYTHON" == "NO" ]; then wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh; fi
- if [ "$PYDEVD_TEST_JYTHON" == "NO" ]; then chmod +x miniconda.sh; fi
- if [ "$PYDEVD_TEST_JYTHON" == "NO" ]; then ./miniconda.sh -b; fi
- if [ "$PYDEVD_TEST_JYTHON" == "NO" ]; then export PATH=/home/travis/miniconda2/bin:$PATH; fi
- if [ "$PYDEVD_TEST_JYTHON" == "NO" ]; then conda update --yes conda; fi
# CPython / Pypy setup
- if [[ "$PYDEVD_TEST_VM" == "CPYTHON" || "$PYDEVD_TEST_VM" == "PYPY" ]]; then wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh; fi
- if [[ "$PYDEVD_TEST_VM" == "CPYTHON" || "$PYDEVD_TEST_VM" == "PYPY" ]]; then chmod +x miniconda.sh; fi
- if [[ "$PYDEVD_TEST_VM" == "CPYTHON" || "$PYDEVD_TEST_VM" == "PYPY" ]]; then ./miniconda.sh -b; fi
- if [[ "$PYDEVD_TEST_VM" == "CPYTHON" || "$PYDEVD_TEST_VM" == "PYPY" ]]; then export PATH=/home/travis/miniconda2/bin:$PATH; fi
- if [[ "$PYDEVD_TEST_VM" == "CPYTHON" || "$PYDEVD_TEST_VM" == "PYPY" ]]; then conda update --yes conda; fi
# Jython setup
- if [ "$PYDEVD_TEST_JYTHON" == "YES" ]; then wget $JYTHON_URL -O jython_installer.jar; java -jar jython_installer.jar -s -d $HOME/jython; export PATH=$HOME/jython:$HOME/jython/bin:$PATH; fi
- if [ "$PYDEVD_TEST_JYTHON" == "YES" ]; then jython -c "print('')"; fi
- if [ "$PYDEVD_TEST_VM" == "JYTHON" ]; then wget $JYTHON_URL -O jython_installer.jar; java -jar jython_installer.jar -s -d $HOME/jython; export PATH=$HOME/jython:$HOME/jython/bin:$PATH; fi
- if [ "$PYDEVD_TEST_VM" == "JYTHON" ]; then jython -c "print('')"; fi
# Fix issue with testGui
- "export DISPLAY=:99.0"
# Install packages
install:
- sudo sysctl kernel.yama.ptrace_scope=0
# Both
- export PYTHONPATH=.
# Python setup
- if [ "$PYDEVD_TEST_JYTHON" == "NO" ]; then conda create --yes -n build_env python=$PYDEVD_PYTHON_VERSION; fi
- if [ "$PYDEVD_TEST_JYTHON" == "NO" ]; then source activate build_env; fi
- if [ "$PYDEVD_TEST_JYTHON" == "NO" ]; then chmod +x ./.travis_install_python_deps.sh; fi
- if [ "$PYDEVD_TEST_JYTHON" == "NO" ]; then ./.travis_install_python_deps.sh; fi
- if [ "$PYDEVD_TEST_JYTHON" == "NO" ]; then source activate build_env; python build_tools/build.py; fi
# CPython setup
- if [ "$PYDEVD_TEST_VM" == "CPYTHON" ]; then conda create --yes -n build_env python=$PYDEVD_PYTHON_VERSION; fi
- if [ "$PYDEVD_TEST_VM" == "CPYTHON" ]; then source activate build_env; fi
- if [ "$PYDEVD_TEST_VM" == "CPYTHON" ]; then chmod +x ./.travis_install_python_deps.sh; fi
- if [ "$PYDEVD_TEST_VM" == "CPYTHON" ]; then ./.travis_install_python_deps.sh; fi
- if [ "$PYDEVD_TEST_VM" == "CPYTHON" ]; then source activate build_env; python build_tools/build.py; fi
# Pypy setup
- if [ "$PYDEVD_TEST_VM" == "PYPY" ]; then conda create --yes -n build_env -c conda-forge pypy3.6; fi
- if [ "$PYDEVD_TEST_VM" == "PYPY" ]; then source activate build_env; fi
- if [ "$PYDEVD_TEST_VM" == "PYPY" ]; then chmod +x ./.travis_install_pypy_deps.sh; fi
- if [ "$PYDEVD_TEST_VM" == "PYPY" ]; then ./.travis_install_pypy_deps.sh; fi
# Jython setup
- if [ "$PYDEVD_TEST_JYTHON" == "YES" ]; then chmod +x ./.travis_install_jython_deps.sh; fi
- if [ "$PYDEVD_TEST_JYTHON" == "YES" ]; then ./.travis_install_jython_deps.sh; fi
- if [ "$PYDEVD_TEST_VM" == "JYTHON" ]; then chmod +x ./.travis_install_jython_deps.sh; fi
- if [ "$PYDEVD_TEST_VM" == "JYTHON" ]; then ./.travis_install_jython_deps.sh; fi

# Run test
# On local machine with jython: c:\bin\jython2.7.0\bin\jython.exe -Dpython.path=.;jython_test_deps/ant.jar;jython_test_deps/junit.jar -m pytest
# On remove machine with python: c:\bin\python27\python.exe -m pytest
script:
# pytest-xdist not available for python == 2.6 and timing out without output with 2.7
- if [[ ("$PYDEVD_TEST_JYTHON" == "NO") && ("$PYDEVD_PYTHON_VERSION" == "2.6" || "$PYDEVD_PYTHON_VERSION" == "2.7") ]]; then source activate build_env; python -m pytest; fi
- if [[ ("$PYDEVD_TEST_JYTHON" == "NO") && ("$PYDEVD_PYTHON_VERSION" != "2.6" && "$PYDEVD_PYTHON_VERSION" != "2.7") ]]; then source activate build_env; python -m pytest -n auto; fi
- if [ "$PYDEVD_TEST_JYTHON" == "YES" ]; then jython -Dpython.path=.:jython_test_deps/ant.jar:jython_test_deps/junit.jar -m pytest; fi
- if [[ ("$PYDEVD_TEST_VM" == "CPYTHON") && ("$PYDEVD_PYTHON_VERSION" == "2.6" || "$PYDEVD_PYTHON_VERSION" == "2.7") ]]; then source activate build_env; python -m pytest; fi
- if [[ ("$PYDEVD_TEST_VM" == "CPYTHON") && ("$PYDEVD_PYTHON_VERSION" != "2.6" && "$PYDEVD_PYTHON_VERSION" != "2.7") ]]; then source activate build_env; python -m pytest -n auto; fi
- if [ "$PYDEVD_TEST_VM" == "PYPY" ]; then source activate build_env; pypy3 -m pytest -n auto; fi
- if [ "$PYDEVD_TEST_VM" == "JYTHON" ]; then jython -Dpython.path=.:jython_test_deps/ant.jar:jython_test_deps/junit.jar -m pytest; fi

15 changes: 15 additions & 0 deletions src/ptvsd/_vendored/pydevd/.travis_install_pypy_deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -ev

source activate build_env

pypy3 -m ensurepip

pypy3 -m pip install pytest
pypy3 -m pip install pytest-xdist
pypy3 -m pip install pytest-timeout
pypy3 -m pip install colorama
pypy3 -m pip install psutil
pypy3 -m pip install numpy
pypy3 -m pip install ipython
pypy3 -m pip install untangle
54 changes: 35 additions & 19 deletions src/ptvsd/_vendored/pydevd/_pydev_bundle/pydev_console_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
from _pydev_imps._pydev_saved_modules import thread
from _pydevd_bundle import pydevd_vars
from _pydevd_bundle import pydevd_xml
from _pydevd_bundle.pydevd_constants import IS_JYTHON, dict_iter_items, NEXT_VALUE_SEPARATOR, Null
from _pydevd_bundle.pydevd_constants import (IS_JYTHON, dict_iter_items, NEXT_VALUE_SEPARATOR, Null,
get_global_debugger)
import signal
from contextlib import contextmanager
from _pydev_bundle import pydev_log

try:
import cStringIO as StringIO # may not always be available @UnusedImport
Expand Down Expand Up @@ -109,31 +112,44 @@ class DebugConsoleStdIn(BaseStdIn):
Object to be added to stdin (to emulate it as non-blocking while the next line arrives)
'''

def __init__(self, dbg, original_stdin):
def __init__(self, py_db, original_stdin):
'''
:param py_db:
If None, get_global_debugger() is used.
'''
BaseStdIn.__init__(self, original_stdin)
self.debugger = dbg
self._py_db = py_db
self._in_notification = 0

def __pydev_run_command(self, is_started):
def __send_input_requested_message(self, is_started):
try:
cmd = self.debugger.cmd_factory.make_input_requested_message(is_started)
self.debugger.writer.add_command(cmd)
py_db = self._py_db
if py_db is None:
py_db = get_global_debugger()
cmd = py_db.cmd_factory.make_input_requested_message(is_started)
py_db.writer.add_command(cmd)
except Exception:
traceback.print_exc()
return '\n'
pydev_log.exception()

@contextmanager
def notify_input_requested(self):
self._in_notification += 1
if self._in_notification == 1:
self.__send_input_requested_message(True)
try:
yield
finally:
self._in_notification -= 1
if self._in_notification == 0:
self.__send_input_requested_message(False)

def readline(self, *args, **kwargs):
# Notify Java side about input and call original function
self.__pydev_run_command(True)
result = self.original_stdin.readline(*args, **kwargs)
self.__pydev_run_command(False)
return result
with self.notify_input_requested():
return self.original_stdin.readline(*args, **kwargs)

def read(self, *args, **kwargs):
# Notify Java side about input and call original function
self.__pydev_run_command(True)
result = self.original_stdin.read(*args, **kwargs)
self.__pydev_run_command(False)
return result
with self.notify_input_requested():
return self.original_stdin.read(*args, **kwargs)


class CodeFragment:
Expand Down Expand Up @@ -220,7 +236,7 @@ def create_std_in(self, debugger=None, original_std_in=None):
if debugger is None:
return StdIn(self, self.host, self.client_port, original_stdin=original_std_in)
else:
return DebugConsoleStdIn(dbg=debugger, original_stdin=original_std_in)
return DebugConsoleStdIn(py_db=debugger, original_stdin=original_std_in)

def add_exec(self, code_fragment, debugger=None):
# In case sys.excepthook called, use original excepthook #PyDev-877: Debug console freezes with Python 3.5+
Expand Down
9 changes: 8 additions & 1 deletion src/ptvsd/_vendored/pydevd/_pydev_bundle/pydev_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@ def _pydevd_log(level, msg, *args):
msg = msg % args
except:
msg = '%s - %s' % (msg, args)
DebugInfoHolder.DEBUG_STREAM.write('%s\n' % (msg,))
msg = '%s\n' % (msg,)
try:
DebugInfoHolder.DEBUG_STREAM.write(msg)
except TypeError:
if isinstance(msg, bytes):
# Depending on the StringIO flavor, it may only accept unicode.
msg = msg.decode('utf-8', 'replace')
DebugInfoHolder.DEBUG_STREAM.write(msg)
DebugInfoHolder.DEBUG_STREAM.flush()
except:
pass
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import sys
from _pydevd_bundle.pydevd_constants import STATE_RUN, PYTHON_SUSPEND, IS_JYTHON, IS_IRONPYTHON
from _pydevd_bundle.pydevd_constants import (STATE_RUN, PYTHON_SUSPEND, IS_JYTHON,
USE_CUSTOM_SYS_CURRENT_FRAMES, USE_CUSTOM_SYS_CURRENT_FRAMES_MAP)
from _pydev_bundle import pydev_log
# IFDEF CYTHON
# pydev_log.debug("Using Cython speedups")
Expand All @@ -9,7 +10,7 @@

version = 11

if not hasattr(sys, '_current_frames'):
if USE_CUSTOM_SYS_CURRENT_FRAMES:

# Some versions of Jython don't have it (but we can provide a replacement)
if IS_JYTHON:
Expand Down Expand Up @@ -40,7 +41,7 @@ def _current_frames():
ret[thread.getId()] = frame
return ret

elif IS_IRONPYTHON:
elif USE_CUSTOM_SYS_CURRENT_FRAMES_MAP:
_tid_to_last_frame = {}

# IronPython doesn't have it. Let's use our workaround...
Expand Down
7 changes: 5 additions & 2 deletions src/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1155,8 +1155,11 @@ def build_exception_info_response(dbg, thread_id, request_seq, set_additional_th
break
frame = frame.f_back

while trace_obj.tb_next is not None:
trace_obj = trace_obj.tb_next
while True:
tb_next = getattr(trace_obj, 'tb_next', None)
if tb_next is None:
break
trace_obj = tb_next

info = dbg.suspended_frames_manager.get_topmost_frame_and_frame_id_to_line(thread_id)
if info is not None:
Expand Down
21 changes: 8 additions & 13 deletions src/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_console.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
class ConsoleMessage:
"""Console Messages
"""

def __init__(self):
self.more = False
# List of tuple [('error', 'error_message'), ('message_list', 'output_message')]
Expand Down Expand Up @@ -62,15 +63,16 @@ def to_xml(self):


#=======================================================================================================================
# DebugConsoleStdIn
# _DebugConsoleStdIn
#=======================================================================================================================
class DebugConsoleStdIn(BaseStdIn):
class _DebugConsoleStdIn(BaseStdIn):

@overrides(BaseStdIn.readline)
def readline(self, *args, **kwargs):
sys.stderr.write('Warning: Reading from stdin is still not supported in this console.\n')
return '\n'


#=======================================================================================================================
# DebugConsole
#=======================================================================================================================
Expand All @@ -87,8 +89,7 @@ def create_std_in(self, *args, **kwargs):
except:
pass

return DebugConsoleStdIn() #If buffered, raw_input is not supported in this console.

return _DebugConsoleStdIn() # If buffered, raw_input is not supported in this console.

@overrides(InteractiveConsole.push)
def push(self, line, frame, buffer_output=True):
Expand Down Expand Up @@ -121,7 +122,7 @@ def push(self, line, frame, buffer_output=True):
else:
sys.stderr.write("Internal Error: %s\n" % (exc,))
finally:
#Remove frame references.
# Remove frame references.
self.frame = None
frame = None
if buffer_output:
Expand All @@ -133,12 +134,10 @@ def push(self, line, frame, buffer_output=True):
else:
return more, [], []


@overrides(BaseInterpreterInterface.do_add_exec)
def do_add_exec(self, line):
return InteractiveConsole.push(self, line)


@overrides(InteractiveConsole.runcode)
def runcode(self, code):
"""Execute a code object.
Expand Down Expand Up @@ -183,7 +182,7 @@ class InteractiveConsoleCache:
interactive_console_instance = None


#Note: On Jython 2.1 we can't use classmethod or staticmethod, so, just make the functions below free-functions.
# Note: On Jython 2.1 we can't use classmethod or staticmethod, so, just make the functions below free-functions.
def get_interactive_console(thread_id, frame_id, frame, console_message):
"""returns the global interactive console.
interactive console should have been initialized by this time
Expand All @@ -198,7 +197,7 @@ def get_interactive_console(thread_id, frame_id, frame, console_message):

console_stacktrace = traceback.extract_stack(frame, limit=1)
if console_stacktrace:
current_context = console_stacktrace[0] # top entry from stacktrace
current_context = console_stacktrace[0] # top entry from stacktrace
context_message = 'File "%s", line %s, in %s' % (current_context[0], current_context[1], current_context[2])
console_message.add_console_message(CONSOLE_OUTPUT, "[Current context]: %s" % (context_message,))
return InteractiveConsoleCache.interactive_console_instance
Expand Down Expand Up @@ -247,7 +246,3 @@ def get_completions(frame, act_tok):
"""
return _pydev_completer.generate_completions_as_xml(frame, act_tok)





Loading