PyDev fixes: Fix tracing when attaching to process on Windows (PY-32021)

GitOrigin-RevId: abc41dc91d41044812858a61ce96984030bba096
This commit is contained in:
Andrey Lisin
2019-07-04 15:03:18 +03:00
committed by intellij-monorepo-bot
parent 1953f3d178
commit c0593b39c1
30 changed files with 889 additions and 723 deletions
@@ -20,9 +20,6 @@ envs {
python "python27_64", "2.7.15", "64"
virtualenv "py27_64", "python27_64", ["cython"]
python "python34_64", "3.4.4", "64"
virtualenv "py34_64", "python34_64", ["cython"]
python "python35_64", "3.5.4", "64"
virtualenv "py35_64", "python35_64", ["cython"]
@@ -36,9 +33,6 @@ envs {
python "python27_32", "2.7.15", "32"
virtualenv "py27_32", "python27_32", ["cython"]
python "python34_32", "3.4.4", "32"
virtualenv "py34_32", "python34_32", ["cython"]
python "python35_32", "3.5.4", "32"
virtualenv "py35_32", "python35_32", ["cython"]
@@ -7,7 +7,7 @@ from _pydev_bundle import pydev_log
from _pydevd_bundle.pydevd_frame import PyDBFrame
# ENDIF
version = 16
version = 17
if not hasattr(sys, '_current_frames'):
@@ -77,10 +77,10 @@ else:
# Only available for CPython!
if (
(sys.version_info[0] == 2 and sys.version_info[1] >= 7)
or (sys.version_info[0] == 3 and sys.version_info[1] >= 4)
or (sys.version_info[0] == 3 and sys.version_info[1] >= 5)
or (sys.version_info[0] > 3)
):
# Supported in 2.7 or 3.4 onwards (32 or 64)
# Supported in 2.7 or 3.5 onwards (32 or 64)
CYTHON_SUPPORTED = True
#=======================================================================================================================
File diff suppressed because it is too large Load Diff
@@ -13,7 +13,7 @@ pydev_log.debug("Using Cython speedups")
# from _pydevd_bundle.pydevd_frame import PyDBFrame
# ENDIF
version = 16
version = 17
if not hasattr(sys, '_current_frames'):
@@ -973,7 +973,7 @@ import traceback
from _pydev_bundle.pydev_is_thread_alive import is_thread_alive
from _pydev_imps._pydev_saved_modules import threading
from _pydevd_bundle.pydevd_constants import get_current_thread_id, IS_IRONPYTHON, NO_FTRACE
from _pydevd_bundle.pydevd_constants import get_current_thread_id, IS_IRONPYTHON, NO_FTRACE, IS_WINDOWS
from _pydevd_bundle.pydevd_dont_trace_files import DONT_TRACE
from _pydevd_bundle.pydevd_kill_all_pydevd_threads import kill_all_pydev_threads
from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame, NORM_PATHS_AND_BASE_CONTAINER
@@ -1092,7 +1092,12 @@ def fix_top_level_trace_and_get_trace_func(py_db, frame):
if threading_get_ident is not None:
thread = threading._active.get(threading_get_ident())
if thread is None:
return None, False
if IS_WINDOWS and f_unhandled and not f_unhandled.f_code.co_filename.startswith('threading'):
# When attaching to a process on Windows, its main thread ID may not be in `threading._active`
# unless the module imports `threading` by its own.
thread = threadingCurrentThread()
else:
return None, False
else:
# Jython does not have threading.get_ident().
thread = threadingCurrentThread()
@@ -2,7 +2,7 @@ import traceback
from _pydev_bundle.pydev_is_thread_alive import is_thread_alive
from _pydev_imps._pydev_saved_modules import threading
from _pydevd_bundle.pydevd_constants import get_current_thread_id, IS_IRONPYTHON, NO_FTRACE
from _pydevd_bundle.pydevd_constants import get_current_thread_id, IS_IRONPYTHON, NO_FTRACE, IS_WINDOWS
from _pydevd_bundle.pydevd_dont_trace_files import DONT_TRACE
from _pydevd_bundle.pydevd_kill_all_pydevd_threads import kill_all_pydev_threads
from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame, NORM_PATHS_AND_BASE_CONTAINER
@@ -121,7 +121,12 @@ def fix_top_level_trace_and_get_trace_func(py_db, frame):
if threading_get_ident is not None:
thread = threading._active.get(threading_get_ident())
if thread is None:
return None, False
if IS_WINDOWS and f_unhandled and not f_unhandled.f_code.co_filename.startswith('threading'):
# When attaching to a process on Windows, its main thread ID may not be in `threading._active`
# unless the module imports `threading` by its own.
thread = threadingCurrentThread()
else:
return None, False
else:
# Jython does not have threading.get_ident().
thread = threadingCurrentThread()
-11
View File
@@ -129,17 +129,6 @@ def build():
env.update(get_environment_from_batch_command(
[vcvarsall, 'x86'],
initial=os.environ.copy()))
elif sys.version_info[:2] == (3, 4):
if is_python_64bit():
env.update(get_environment_from_batch_command(
[r"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd", '/x64'],
initial=os.environ.copy()))
else:
env.update(get_environment_from_batch_command(
[r"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd", '/x86'],
initial=os.environ.copy()))
else:
raise AssertionError('Unable to setup environment for Python: %s' % (sys.version,))
@@ -8,7 +8,6 @@ import sys
miniconda64_envs = os.getenv('MINICONDA64_ENVS')
python_installations = [
r'%s/py27_64/bin/python' % miniconda64_envs,
r'%s/py34_64/bin/python' % miniconda64_envs,
r'%s/py35_64/bin/python' % miniconda64_envs,
r'%s/py36_64/bin/python' % miniconda64_envs,
r'%s/py37_64/bin/python' % miniconda64_envs,
@@ -20,13 +20,11 @@ miniconda64_envs = os.getenv('MINICONDA64_ENVS', r'C:\tools\Miniconda\envs')
python_installations = [
r'%s\py27_32\Scripts\python.exe' % miniconda32_envs,
r'%s\py34_32\Scripts\python.exe' % miniconda32_envs,
r'%s\py35_32\Scripts\python.exe' % miniconda32_envs,
r'%s\py36_32\Scripts\python.exe' % miniconda32_envs,
r'%s\py37_32\Scripts\python.exe' % miniconda32_envs,
r'%s\py27_64\Scripts\python.exe' % miniconda64_envs,
r'%s\py34_64\Scripts\python.exe' % miniconda64_envs,
r'%s\py35_64\Scripts\python.exe' % miniconda64_envs,
r'%s\py36_64\Scripts\python.exe' % miniconda64_envs,
r'%s\py37_64\Scripts\python.exe' % miniconda64_envs,