-
Notifications
You must be signed in to change notification settings - Fork 326
How interactive debugging works (old way)
The Interactive Window is used for running cells in a python script. One of the capabilities of running these cells is to debug them.
This page will describe how this debugging is implemented under the covers.
This sequence diagram is explained below:
The first step is to inject debugpy into kernel. Without knowing what the process id of the kernel is, we need a way to have the kernel ready for attach. We do this by running this code in the kernel:
import debugpy
debugpy.listen(('localhost', 0))
That causes debugpy to start a server and returns the port to listen on. We use this port to generate a launch config. Something that looks like so:
{
"type": "python",
"request": "attach",
"connect": { "host": "localhost", "port": 5678 },
"justMyCode": true
},
This
The launch config generated in the previous step is used to attach the debugger to the running debugpy server (much like done here for launching debugging of a python file).
VS code then transitions to debug mode. It just sits there waiting for an event from the debuggee.
- Contribution
- Source Code Organization
- Coding Standards
- Profiling
- Coding Guidelines
- Component Governance
- Writing tests
- Kernels
- Intellisense
- Debugging
- IPyWidgets
- Extensibility
- Module Dependencies
- Errors thrown
- Jupyter API
- Variable fetching
- Import / Export
- React Webviews: Variable Viewer, Data Viewer, and Plot Viewer
- FAQ
- Kernel Crashes
- Jupyter issues in the Python Interactive Window or Notebook Editor
- Finding the code that is causing high CPU load in production
- How to install extensions from VSIX when using Remote VS Code
- How to connect to a jupyter server for running code in vscode.dev
- Jupyter Kernels and the Jupyter Extension