How to use LLDB Debugger
Build the project with cargo (
cargo build).
Start VS Code.
Open the project folder
created with cargo.
The LLDB Debugger added the menu bar entry "Debug" from where the debugger can be started.
After the start of the LLDB Debugger, VS Code will create the launch.json file in the .vscode directory for the configuration of the VS Code tools and plugins for the VS Code project.
The LLDB Debugger requires a configuration entry in the launch.json as described in the following lines or
here.
In my case the slightly inadequate entry is created by default:
{
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug",
"program": "${workspaceRoot}/<your program>",
"args": [],
"cwd": "${workspaceRoot}"
}
]
}
The line with the executable program path must be adapted by replacing
<your program> by
/target/debug/xxx like so:
"program": "${workspaceRoot}/target/debug/xxx",
where
xxx is the name of the executable in the
${workspaceRoot}/target/debug/ directory.
If the project was created as program project then the name of the executable is the name of the project e.g. "hello_world".
If the project was created as library project then the name of the executable is the name of the project followed by some id code. The executable executes the test procedures in the "tests" module in the lib.rs file.