mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
parent
5832fbd142
commit
44d18a0c89
2 changed files with 52 additions and 0 deletions
39
README.md
39
README.md
|
|
@ -15,3 +15,42 @@ provided by the bot. You will only need to do this once across all repos using o
|
|||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
||||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
|
||||
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
||||
|
||||
## Custom Protocol arguments
|
||||
|
||||
### 1. Launch request arguments
|
||||
```js
|
||||
{
|
||||
"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
|
||||
```js
|
||||
{
|
||||
"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
|
||||
],
|
||||
"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
|
||||
]
|
||||
}
|
||||
```
|
||||
|
|
@ -9,6 +9,7 @@ import errno
|
|||
import io
|
||||
import os
|
||||
import platform
|
||||
import pydevd_file_utils
|
||||
import re
|
||||
import socket
|
||||
import sys
|
||||
|
|
@ -925,10 +926,22 @@ class VSCodeMessageProcessor(ipcjson.SocketIO, ipcjson.IpcChannel):
|
|||
options[key] = DEBUG_OPTIONS_PARSER[key](value)
|
||||
return options
|
||||
|
||||
def _initialize_path_maps(self, args):
|
||||
pathMaps = []
|
||||
for pathMapping in args.get('pathMappings', []):
|
||||
localRoot = pathMapping.get('localRoot', '')
|
||||
remoteRoot = pathMapping.get('remoteRoot', '')
|
||||
if (len(localRoot) > 0 and len(remoteRoot) > 0):
|
||||
pathMaps.append((localRoot, remoteRoot))
|
||||
|
||||
if len(pathMaps) > 0:
|
||||
pydevd_file_utils.setup_client_server_paths(pathMaps)
|
||||
|
||||
@async_handler
|
||||
def on_attach(self, request, args):
|
||||
# TODO: docstring
|
||||
self.start_reason = 'attach'
|
||||
self._initialize_path_maps(args)
|
||||
options = self.build_debug_options(args.get('debugOptions', []))
|
||||
self.debug_options = self._parse_debug_options(
|
||||
args.get('options', options))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue