Merge branch 'main' into v2

This commit is contained in:
Pavel Minaev 2023-12-20 12:18:15 -08:00
commit 81ed1ca909
22 changed files with 105 additions and 17 deletions

5
.github/CODEOWNERS vendored
View file

@ -4,7 +4,4 @@
# in the repository, i.e. bar/baz will match /bar/baz and /foo/bar/baz.
# The default owners for everything that is not overridden by specific patterns below.
* @int19h @karthiknadig @AdamYoblick
# Order is important: the last matching pattern overrides all the preceding ones.
/src/ptvsd/_vendored/pydevd/ @fabioz
* @int19h @AdamYoblick

View file

@ -39,7 +39,7 @@ jobs:
- script: "python3 -m pip install -U ruff"
displayName: "Install ruff"
- script: "python3 -m ruff check --format=junit --output-file=$(Build.ArtifactStagingDirectory)/lint-ruff.xml ."
- script: "python3 -m ruff check --output-format=junit --output-file=$(Build.ArtifactStagingDirectory)/lint-ruff.xml ."
displayName: "Run ruff"
- task: "PublishTestResults@2"

View file

@ -176,7 +176,14 @@ if __name__ == "__main__":
"License :: OSI Approved :: MIT License",
],
package_dir={"": "src"},
packages=setuptools.find_namespace_packages(where="src", include=["debugpy*"]),
packages=[
"debugpy",
"debugpy.adapter",
"debugpy.common",
"debugpy.launcher",
"debugpy.server",
"debugpy._vendored",
],
package_data={
"debugpy": ["ThirdPartyNotices.txt"],
"debugpy._vendored": [

View file

@ -20,7 +20,7 @@ class SafeRepr(object):
# most level, and truncated to maxstring_inner characters inside
# collections.
maxstring_outer = 2 ** 16
maxstring_inner = 30
maxstring_inner = 128
string_types = (str, bytes)
bytes = bytes
set_info = (set, '{', '}', False)
@ -31,7 +31,7 @@ class SafeRepr(object):
# Collection types are recursively iterated for each limit in
# maxcollection.
maxcollection = (15, 10)
maxcollection = (60, 20)
# Specifies type, prefix string, suffix string, and whether to include a
# comma if there is only one element. (Using a sequence rather than a
@ -60,7 +60,7 @@ class SafeRepr(object):
# All other types are treated identically to strings, but using
# different limits.
maxother_outer = 2 ** 16
maxother_inner = 30
maxother_inner = 128
convert_to_hex = False
raw_value = False

View file

@ -8,29 +8,29 @@ setlocal
call "%VSDIR%\VC\Auxiliary\Build\vcvarsall.bat" x86 -vcvars_spectre_libs=spectre
cl -DUNICODE -D_UNICODE /EHsc /Zi /O1 /W3 /LD /MD /Qspectre attach.cpp /link /DEBUG /OPT:REF /OPT:ICF /GUARD:CF /out:attach_x86.dll
cl -DUNICODE -D_UNICODE /EHsc /Zi /O1 /W3 /LD /MD /Qspectre attach.cpp /link /PROFILE /GUARD:CF /out:attach_x86.dll
copy attach_x86.dll ..\attach_x86.dll /Y
copy attach_x86.pdb ..\attach_x86.pdb /Y
cl -DUNICODE -D_UNICODE /EHsc /Zi /O1 /W3 /LD /MD /D BITS_32 /Qspectre run_code_on_dllmain.cpp /link /DEBUG /OPT:REF /OPT:ICF /GUARD:CF /out:run_code_on_dllmain_x86.dll
cl -DUNICODE -D_UNICODE /EHsc /Zi /O1 /W3 /LD /MD /D BITS_32 /Qspectre run_code_on_dllmain.cpp /link /PROFILE /GUARD:CF /out:run_code_on_dllmain_x86.dll
copy run_code_on_dllmain_x86.dll ..\run_code_on_dllmain_x86.dll /Y
copy run_code_on_dllmain_x86.pdb ..\run_code_on_dllmain_x86.pdb /Y
cl /EHsc /Zi /O1 /W3 /Qspectre inject_dll.cpp /link /DEBUG /OPT:REF /OPT:ICF /GUARD:CF /out:inject_dll_x86.exe
cl /EHsc /Zi /O1 /W3 /Qspectre inject_dll.cpp /link /DEBUG /OPT:REF /OPT:ICF /GUARD:CF /out:inject_dll_x86.exe
copy inject_dll_x86.exe ..\inject_dll_x86.exe /Y
copy inject_dll_x86.pdb ..\inject_dll_x86.pdb /Y
call "%VSDIR%\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64 -vcvars_spectre_libs=spectre
cl -DUNICODE -D_UNICODE /EHsc /Zi /O1 /W3 /LD /MD /Qspectre attach.cpp /link /DEBUG /OPT:REF /OPT:ICF /GUARD:CF /out:attach_amd64.dll
cl -DUNICODE -D_UNICODE /EHsc /Zi /O1 /W3 /LD /MD /Qspectre attach.cpp /link /PROFILE /GUARD:CF /out:attach_amd64.dll
copy attach_amd64.dll ..\attach_amd64.dll /Y
copy attach_amd64.pdb ..\attach_amd64.pdb /Y
cl -DUNICODE -D_UNICODE /EHsc /Zi /O1 /W3 /LD /MD /D BITS_64 /Qspectre run_code_on_dllmain.cpp /link /DEBUG /OPT:REF /OPT:ICF /GUARD:CF /out:run_code_on_dllmain_amd64.dll
cl -DUNICODE -D_UNICODE /EHsc /Zi /O1 /W3 /LD /MD /D BITS_64 /Qspectre run_code_on_dllmain.cpp /link /PROFILE /GUARD:CF /out:run_code_on_dllmain_amd64.dll
copy run_code_on_dllmain_amd64.dll ..\run_code_on_dllmain_amd64.dll /Y
copy run_code_on_dllmain_amd64.pdb ..\run_code_on_dllmain_amd64.pdb /Y
cl /EHsc /Zi /O1 /W3 /Qspectre inject_dll.cpp /link /DEBUG /OPT:REF /OPT:ICF /GUARD:CF /out:inject_dll_amd64.exe
cl /EHsc /Zi /O1 /W3 /Qspectre inject_dll.cpp /link /DEBUG /OPT:REF /OPT:ICF /GUARD:CF /out:inject_dll_amd64.exe
copy inject_dll_amd64.exe ..\inject_dll_amd64.exe /Y
copy inject_dll_amd64.pdb ..\inject_dll_amd64.pdb /Y

View file

@ -0,0 +1,2 @@
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)

View file

@ -0,0 +1,2 @@
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)

View file

@ -0,0 +1,2 @@
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)

View file

@ -0,0 +1,77 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.
from tests import debug
from tests.patterns import some
def test_ndarray(pyfile, target, run):
@pyfile
def code_to_debug():
import numpy
import debuggee
debuggee.setup()
a = numpy.array([123, 456], numpy.int32)
print(a) # @bp
with debug.Session() as session:
session.config["variablePresentation"] = {"all": "hide", "protected": "inline"}
with run(session, target(code_to_debug)):
session.set_breakpoints(code_to_debug, all)
stop = session.wait_for_stop()
scopes = session.request("scopes", {"frameId": stop.frame_id})["scopes"]
globals_ref = scopes[0]["variablesReference"]
vars = session.request(
"variables",
{"variablesReference": globals_ref},
)["variables"]
print(vars)
# Fetch children variables of the array.
(a,) = (v for v in vars if v["name"] == "a")
a_vars = session.request(
"variables",
{"variablesReference": a["variablesReference"]},
)["variables"]
print(a_vars)
# Fetch the actual array items
(items,) = (v for v in a_vars if v["name"] == "[0:2] ")
a_items = session.request(
"variables",
{"variablesReference": items["variablesReference"]},
)["variables"]
print(a_items)
assert a_items == [
some.dict.containing(
{
"type": "int32",
"name": "0",
"value": "123",
"variablesReference": some.int,
}
),
some.dict.containing(
{
"type": "int32",
"name": "1",
"value": "456",
"variablesReference": some.int,
}
),
some.dict.containing(
{
"type": "int",
"name": "len()",
"value": "2",
"presentationHint": {"attributes": ["readOnly"]},
"variablesReference": 0,
}
),
]
session.request_continue()

View file

@ -13,6 +13,7 @@ psutil
## Used in Python code that is run/debugged by the tests:
django
requests
gevent
flask
gevent
numpy
requests