Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 56 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
"engines": {
"vscode": "^1.71.0"
},
"main": "./dist/desktop/extension.js",
"browser": "./dist/web/extension.js",
"main": "./out/desktop/extension.js",
"browser": "./out/web/extension.js",
"activationEvents": [
"onLanguage:python",
"onCommand:vscode-python-web-wasm.debug.runEditorContents",
"onCommand:vscode-python-web-wasm.repl.start"
],
Expand Down Expand Up @@ -95,6 +96,58 @@
"description": "A URL for a GitHub that hosts the python.wasm file together with the default Python libraries."
}
}
}
},
"debuggers": [
{
"label": "Python PDB",
"languages": [
"python"
],
"type": "python-pdb-node",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a debug config so I could just test with a launch.json instead of a command.

"when": "!virtualWorkspace",
"configurationAttributes": {
"launch": {
"properties": {
"args": {
"default": [],
"description": "Command line arguments passed to the file.",
"items": {
"type": "string"
},
"type": [
"array",
"string"
]
},
"cwd": {
"default": "${workspaceFolder}",
"description": "Absolute path to the working directory of the program being debugged. Default is the root directory of the file (leave empty).",
"type": "string"
},
"file": {
"default": "${file}",
"description": "Absolute path to the python file.",
"type": "string"
},
"module": {
"description": "Name of module to debug. If this entry exists, file is ignored",
"type": "string"
},
"stopOnEntry": {
"description": "Whether or not to stop the debugger on the first line of the first file",
"default": true,
"type": "boolean"
},
"python": {
"default": "${command:python.interpreterPath}",
"description": "Absolute path to the Python interpreter executable; overrides workspace configuration if set.",
"type": "string"
}
}
}
}
}
]

}
}
42 changes: 42 additions & 0 deletions src/common/DEBUGGER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# PDB based debugger

This debugger uses [pdb](https://docs.python.org/3/library/pdb.html) to start a python file. It then translates all [DAP](https://microsoft.github.io/debug-adapter-protocol/overview) messages into pdb commands in order to allow debugging in VS code.

For example, this message:

```json
{
command: "setBreakpoints",
arguments: {
source: {
name: "test_longoutput.py",
path: "d:\\Source\\Testing\\Testing_Pyright\\test_longoutput.py",
},
lines: [
3,
],
breakpoints: [
{
line: 3,
},
],
sourceModified: false,
},
type: "request",
seq: 3,
}
```

Gets translated into the pdb `b(reak)` command:

```
b d:\\Source\\Testing\\Testing_Pyright\\test_longoutput.py:3
```

# Left to do
- Test to write
- Multiple files involved
- recursion and stack changing
- taking input from user
- what happens with threads
- Exception handling (stop on caught)
Loading