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

Fix #325: Debuggee no longer terminates #424

Merged
merged 1 commit into from
May 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion ptvsd/_vendored/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ def vendored(project, root=None):
try:
yield root
finally:
#del sys.path[0]
sys.path.remove(root)


Expand Down
13 changes: 12 additions & 1 deletion ptvsd/_vendored/force_pydevd.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from importlib import import_module
import warnings

from . import check_modules, prefix_matcher, preimport
from . import check_modules, prefix_matcher, preimport, vendored


# Ensure that pydevd is our vendored copy.
Expand All @@ -13,6 +14,16 @@
warnings.warn(msg + ':\n {}'.format('\n '.join(_unvendored)))


# Constants must be set before importing any other pydevd module
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related, but gets rid of the Cython warning (again).

# # due to heavy use of "from" in them.
with vendored('pydevd'):
pydevd_constants = import_module('_pydevd_bundle.pydevd_constants')
# Disable this, since we aren't packaging the Cython modules at the moment.
pydevd_constants.CYTHON_SUPPORTED = False
# We limit representation size in our representation provider when needed.
pydevd_constants.MAXIMUM_VARIABLE_REPRESENTATION_SIZE = 2**32


# Now make sure all the top-level modules and packages in pydevd are
# loaded. Any pydevd modules that aren't loaded at this point, will
# be loaded using their parent package's __path__ (i.e. one of the
Expand Down
11 changes: 4 additions & 7 deletions ptvsd/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@
import warnings
from xml.sax import SAXParseException

import _pydevd_bundle.pydevd_constants as pydevd_constants
# Disable this, since we aren't packaging the Cython modules at the moment.
pydevd_constants.CYTHON_SUPPORTED = False
# We limit representation size in our representation provider when needed.
pydevd_constants.MAXIMUM_VARIABLE_REPRESENTATION_SIZE = 2**32

import _pydevd_bundle.pydevd_comm as pydevd_comm # noqa
import _pydevd_bundle.pydevd_extension_api as pydevd_extapi # noqa
import _pydevd_bundle.pydevd_extension_utils as pydevd_extutil # noqa
Expand Down Expand Up @@ -67,6 +61,7 @@
supportsSetExpression=True,
supportsModulesRequest=True,
supportsLogPoints=True,
supportTerminateDebuggee=True,
exceptionBreakpointFilters=[
{
'filter': 'raised',
Expand Down Expand Up @@ -853,7 +848,9 @@ def _handle_disconnect(self, request):
self.disconnect_request_event.set()
self._notify_disconnecting(not self._closed)
if not self._closed:
self.close()
# Closing the socket causes pydevd to resume all threads,
# so just terminate the process altogether.
sys.exit(0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this prevent re-attach?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will, but in this scenario (launch), there's not supposed to be one - disconnect after launch means terminate debuggee, or at least that's how we have always implemented it so far in the old debugger.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right, on_disconnect() doesn't call _handle_disconnect() in the "attach" case.


def _wait_for_server_thread(self):
if self.server_thread is None:
Expand Down