Skip to content

Commit

Permalink
Exclude files from being debugged. microsoft#997
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioz committed Jan 23, 2019
1 parent 1bc879c commit d215d5f
Show file tree
Hide file tree
Showing 32 changed files with 5,326 additions and 4,755 deletions.
13 changes: 3 additions & 10 deletions src/ptvsd/_vendored/pydevd/_pydev_bundle/pydev_imports.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from _pydevd_bundle.pydevd_constants import USE_LIB_COPY, izip


try:
try:
if USE_LIB_COPY:
Expand All @@ -12,7 +11,6 @@
except ImportError:
from _pydev_imps import _pydev_xmlrpclib as xmlrpclib


try:
try:
if USE_LIB_COPY:
Expand All @@ -25,28 +23,23 @@
except ImportError:
from _pydev_imps._pydev_SimpleXMLRPCServer import SimpleXMLRPCServer



try:
from StringIO import StringIO
except ImportError:
from io import StringIO


try:
execfile=execfile #Not in Py3k
execfile = execfile # Not in Py3k
except NameError:
from _pydev_imps._pydev_execfile import execfile


try:
if USE_LIB_COPY:
from _pydev_imps._pydev_saved_modules import _queue
else:
import Queue as _queue
except:
import queue as _queue #@UnresolvedImport

import queue as _queue # @UnresolvedImport

try:
from _pydevd_bundle.pydevd_exec import Exec
Expand All @@ -56,5 +49,5 @@
try:
from urllib import quote, quote_plus, unquote_plus
except:
from urllib.parse import quote, quote_plus, unquote_plus #@UnresolvedImport
from urllib.parse import quote, quote_plus, unquote_plus # @UnresolvedImport

6 changes: 3 additions & 3 deletions src/ptvsd/_vendored/pydevd/_pydev_bundle/pydev_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
from _pydev_imps._pydev_saved_modules import threading
currentThread = threading.currentThread


import traceback

WARN_ONCE_MAP = {}


def stderr_write(message):
sys.stderr.write(message)
sys.stderr.write("\n")


def debug(message):
if DebugInfoHolder.DEBUG_TRACE_LEVEL>2:
if DebugInfoHolder.DEBUG_TRACE_LEVEL > 2:
stderr_write(message)


def warn(message):
if DebugInfoHolder.DEBUG_TRACE_LEVEL>1:
if DebugInfoHolder.DEBUG_TRACE_LEVEL > 1:
stderr_write(message)


Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from _pydevd_bundle._debug_adapter.pydevd_schema_log import debug_exception
import json


class BaseSchema(object):

def to_json(self):
import json
return json.dumps(self.to_dict())


Expand Down Expand Up @@ -79,11 +79,13 @@ def from_dict(dct):
def from_json(json_msg):
if isinstance(json_msg, bytes):
json_msg = json_msg.decode('utf-8')
import json

return from_dict(json.loads(json_msg))


def get_response_class(request):
if request.__class__ == dict:
return _responses_to_types[request['command']]
return _responses_to_types[request.command]


Expand Down
26 changes: 23 additions & 3 deletions src/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ def set_ide_os_and_breakpoints_by(self, py_db, seq, ide_os, breakpoints_by):

return py_db.cmd_factory.make_version_message(seq)

def send_error_message(self, py_db, msg):
sys.stderr.write('pydevd: %s\n' % (msg,))

def set_show_return_values(self, py_db, show_return_values):
if show_return_values:
py_db.show_return_values = True
Expand Down Expand Up @@ -422,7 +425,7 @@ def remove_python_exception_breakpoint(self, py_db, exception):
pydev_log.debug("Error while removing exception %s" % sys.exc_info()[0])

py_db.on_breakpoints_changed(remove=True)

def remove_plugins_exception_breakpoint(self, py_db, exception_type, exception):
# I.e.: no need to initialize lazy (if we didn't have it in the first place, we can't remove
# anything from it anyways).
Expand All @@ -437,6 +440,23 @@ def remove_plugins_exception_breakpoint(self, py_db, exception_type, exception):
else:
raise NameError(exception_type)

py_db.on_breakpoints_changed(remove=True)

py_db.on_breakpoints_changed(remove=True)

def set_project_roots(self, py_db, project_roots):
'''
:param unicode project_roots:
'''
py_db.set_project_roots(project_roots)

# Add it to the namespace so that it's available as PyDevdAPI.ExcludeFilter
from _pydevd_bundle.pydevd_filtering import ExcludeFilter # noqa

def set_exclude_filters(self, py_db, exclude_filters):
'''
:param list(PyDevdAPI.ExcludeFilter) exclude_filters:
'''
py_db.set_exclude_filters(exclude_filters)

def set_use_libraries_filter(self, py_db, use_libraries_filter):
py_db.set_use_libraries_filter(use_libraries_filter)

3 changes: 0 additions & 3 deletions src/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@
except:
import io as StringIO


# CMD_XXX constants imported for backward compatibility
from _pydevd_bundle.pydevd_comm_constants import * # @UnusedWildImport

Expand Down Expand Up @@ -294,7 +293,6 @@ def _on_run(self):
self.handle_except()
return # Finished communication.


# Note: the java backend is always expected to pass utf-8 encoded strings. We now work with unicode
# internally and thus, we may need to convert to the actual encoding where needed (i.e.: filenames
# on python 2 may need to be converted to the filesystem encoding).
Expand All @@ -305,7 +303,6 @@ def _on_run(self):
sys.stderr.write(u'debugger: received >>%s<<\n' % (line,))
sys.stderr.flush()


args = line.split(u'\t', 2)
try:
cmd_id = int(args[0])
Expand Down
3 changes: 0 additions & 3 deletions src/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,6 @@ def dict_items(d):
except:
from io import StringIO




if IS_JYTHON:

def NO_FTRACE(frame, event, arg):
Expand Down
Loading

0 comments on commit d215d5f

Please sign in to comment.