codelldb
¶
Launch CodeLLDB in debugpy to debug rust code.
Usage¶
Tip
This package only depends on the Python standard library, so you can integrate it freely.
Configuring CodeLLDB rpc server¶
Please refer to the CodeLLDB documentation to set up the rpc server,
and add the following content to .vscode/settings.json
:
Configuring Python Debugger¶
Please refer to the Python Debugger documentation,
and add the following content to .vscode/launch.json
:
{
"version": "0.2.0",
"configurations": [
{
"name": "python.debug",
"type": "debugpy",
"purpose": [
"debug-in-terminal"
],
"console": "integratedTerminal",
"request": "launch",
// see: <https://code.visualstudio.com/docs/python/debugging#_set-configuration-options>
"module": "pytauri_demo", // your module name
"args": [], // whatever you want
// following env vars will be used by `codelldb` package
"env": {
"VSCODE_RUST_DEBUG": "${input:rustDebug}",
// keep the following env vars in sync with `.vscode/settings.json`
"VSCODE_LLDB_RPC_SERVER_HOST": "127.0.0.1",
"VSCODE_LLDB_RPC_SERVER_PORT": "9552",
"VSCODE_LLDB_RPC_SERVER_TOKEN": "secret",
},
}
],
// see: <https://code.visualstudio.com/docs/editor/variables-reference#_input-variables>
"inputs": [
{
"type": "pickString",
"id": "rustDebug",
"description": "Whether to enable Rust debugging",
"options": [
{
"label": "Enabled",
"value": "1"
},
{
"label": "Disabled",
"value": "0"
}
],
"default": "0"
},
]
}
Multi-target debugging¶
When starting Python Debugger via F5
, you will see a selection box, choose Enabled
to enable Rust debugging.
Functions:
Name | Description |
---|---|
debug |
Launch CodeLLDB to debug rust code. |
VSCODE_RUST_DEBUG_VARNAME
module-attribute
¶
Whether to enable Rust debugging, set to 1
to enable, 0
to disable.
VSCODE_LLDB_RPC_SERVER_HOST_VARNAME
module-attribute
¶
The host of the CodeLLDB rpc server.
VSCODE_LLDB_RPC_SERVER_PORT_VARNAME
module-attribute
¶
The port of the CodeLLDB rpc server.
VSCODE_LLDB_RPC_SERVER_TOKEN_VARNAME
module-attribute
¶
The secret token of the CodeLLDB rpc server.
debug
¶
Launch CodeLLDB to debug rust code.
If the value indicated by VSCODE_RUST_DEBUG_VARNAME is not 1
, this is a no-op.
Raises:
Type | Description |
---|---|
DebugError
|
If the provided environment variables cannot be correctly parsed. |
Note
If failed to connect to the lldb rpc server, a warning message will be logged instead of raising an exception.