Unable to debug unit tests in Rust
Closed this issue · 3 comments
I am trying to debug unit tests in Rust in Sublime using SublimeDebugger.
When I run Add Configuration for CodeLLDB: Debug Cargo Tests, it generates the following configuration:
"debugger_configurations":
[
{
"type": "lldb",
"request": "launch",
"name": "Cargo test",
"cargo": {
"args": [
"test",
"--no-run",
"--lib",
]
},
"args": []
},
],
However, this will not run due to missing the program
attribute. Adding "program": "${workspaceRoot}/target/debug/projectName"
enables me to start the debugger...but when I start debugging, the debugger drops into the main function in the file rather than the unit tests. This link says to use cargo
instead of program
in VSCode. However, the cargo
field seems to be entirely ignored by SublimeDebugger.
I was able to make things work by adding "program": "${workspaceRoot}/target/debug/deps/projectName-SHA"
where the SHA is found from the output of cargo test --no-run
. It's not ideal but it works!
For future reference or in case you or anyone else wants to work on this.
SublimeDebugger/modules/adapters/lldb.py
Line 86 in cb99710
program
field with the results.
This would also need to use the existing async process functions or require adding some additional ones
SublimeDebugger/modules/dap/transports.py
Line 43 in cb99710