Skip to content

Commit

Permalink
Merge branch 'main' into v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Minaev committed Dec 20, 2023
2 parents 479b8c4 + b9b09e6 commit 81ed1ca
Show file tree
Hide file tree
Showing 22 changed files with 105 additions and 17 deletions.
5 changes: 1 addition & 4 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion azure-pipelines/pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 8 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,14 @@ def tail_is(*suffixes):
"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": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions src/debugpy/_vendored/pydevd/pydevd_plugins/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
77 changes: 77 additions & 0 deletions tests/debugpy/test_numpy.py
Original file line number Diff line number Diff line change
@@ -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()
5 changes: 3 additions & 2 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ psutil
## Used in Python code that is run/debugged by the tests:

django
requests
gevent
flask
gevent
numpy
requests

0 comments on commit 81ed1ca

Please sign in to comment.