An implementation of the Debug Adapter Protocol for Python https://pypi.org/project/debugpy/
Find a file
Don Jayamanne f726968304
Fix blocking enable_attach and breaking on the main thread in remote debugging (#706)
Fixes #545, #711, #712 
More tests to be written as part of #718 

Summary of solution:
* For remote attach, spin up pydevd (use `install`) 
* In a separate thread wait for connections (within a loop, to support multiples)
* Ensure only one connection is supported at a time
* Use a simple event to ensure we have a single session at a time (we won't accept more than one connection if even is set)
* Use a simple event to detect when a handshake has been successfully been done

![image](https://vignette.wikia.nocookie.net/steven-universe/images/3/35/86036-victory-dance-gif-Despicable-M-EPnS.gif/revision/latest?cb=20150727031515)

@karthiknadig 
I've basically reverted the way `enable_attach` works.
This allows breaking into the current thread without any issues.
Not sure what else it breaks, lets see how the tests go.

Lets talk about the changes, hacks/solutions tomorrow.
Easy fixes, just need some simple locks!!
2018-08-01 13:00:14 -07:00
.github github issue template (#517) 2018-06-25 11:14:23 -07:00
debugger_protocol Update debug protocol json to latest (#676) 2018-07-18 10:31:10 -07:00
ptvsd Fix blocking enable_attach and breaking on the main thread in remote debugging (#706) 2018-08-01 13:00:14 -07:00
tests Fix blocking enable_attach and breaking on the main thread in remote debugging (#706) 2018-08-01 13:00:14 -07:00
win Fix build paths in sign project (#458) 2018-06-01 12:00:07 -07:00
.flake8 Update for VSTS-based CI process (#431) 2018-06-21 17:09:53 -07:00
.flake8.ci Update for VSTS-based CI process (#431) 2018-06-21 17:09:53 -07:00
.gitattributes Set up versioneer to auto-generate version numbers from git. 2018-04-11 14:00:48 -07:00
.gitignore Fixed #481: JustMyCode debugging not working in VS Code when virtualenv is inside workspace. (#640) 2018-07-11 13:35:31 -07:00
.travis.yml Compatibility python 3.4 (#519) 2018-06-25 13:20:22 -07:00
DESCRIPTION.md Update pypi info (#480) 2018-06-15 12:59:01 -07:00
LICENSE Updates LICENSE file with correct text and includes it in distributions 2018-02-21 16:10:22 -08:00
Makefile Django and Flask system test (#689) 2018-07-26 15:13:59 -07:00
MANIFEST.in Fix for missing Description.md (#493) 2018-06-17 19:31:15 -07:00
README.md Fix path mappings with remote debugging (#624) 2018-07-10 15:09:16 -07:00
setup.cfg Set up versioneer to auto-generate version numbers from git. 2018-04-11 14:00:48 -07:00
setup.py Update setup.py (#522) 2018-06-25 16:31:45 -07:00
versioneer.py Disable 'dirty' flag for version numbers. 2018-04-19 16:45:20 -07:00

Python Tools for Visual Studio debug server

Build Status Build Status

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Custom Protocol arguments

1. Launch request arguments

{
    "debugOptions":  [
            "RedirectOutput",       // Whether to redirect stdout and stderr (see pydevd_comm.CMD_REDIRECT_OUTPUT)
            "WaitOnNormalExit",     // See WAIT_ON_NORMAL_EXIT in wrapper.py
            "WaitOnAbnormalExit",   // See WAIT_ON_ABNORMAL_EXIT in wrapper.py
            "Django",               // Enables Django Template debugging
            "Jinja",                // Enables Jinja (Flask) Template debugging
            "FixFilePathCase",      // See FIX_FILE_PATH_CASE in wrapper.py
            "DebugStdLib"           // Whether to enable debugging of standard library functions
    ]
}

2. Attach request arguments

{
    "debugOptions":  [
            "RedirectOutput",       // Whether to redirect stdout and stderr (see pydevd_comm.CMD_REDIRECT_OUTPUT)
            "WaitOnNormalExit",     // See WAIT_ON_NORMAL_EXIT in wrapper.py
            "WaitOnAbnormalExit",   // See WAIT_ON_ABNORMAL_EXIT in wrapper.py
            "Django",               // Enables Django Template debugging
            "Jinja",                // Enables Jinja (Flask) Template debugging
            "FixFilePathCase",      // See FIX_FILE_PATH_CASE in wrapper.py
            "DebugStdLib"           // Whether to enable debugging of standard library functions
            "WindowsClient"         // Whether client OS is Windows
            "UnixClient"            // Whether client OS is Unix
    ],
    "pathMappings": [
        {
            "localRoot": "C:\\Project\\src",   // Local root  (where source and debugger running)
            "remoteRoot": "/home/smith/proj"   // Remote root (where remote code is running)
        },
        // Add more path mappings
    ]
}