Description
Describe the problem you are trying to solve
Currently, debug symbols are uplifted for binaries and examples only, see
cargo/src/cargo/core/compiler/build_context/target_info.rs
Lines 260 to 269 in e618d47
Related Issue: #4490.
Yet it seems that the path in executable key in cargo json format output points to target/debug/xxx-hash instead of target/debug/deps/xxx-hash, so tools like Intellij Rust fail to debug these tests: intellij-rust/intellij-rust#3680.
Cargo json output:
{
"reason": "compiler-artifact",
"package_id": "project 0.1.0 (path+file:///path/to/project)",
"target": {
"kind": [
"lib"
],
"crate_types": [
"lib"
],
"name": "project",
"src_path": "/path/to/project/src/lib.rs",
"edition": "2018",
"doctest": true
},
"profile": {
"opt_level": "0",
"debuginfo": 2,
"debug_assertions": true,
"overflow_checks": true,
"test": true
},
"features": [
],
"filenames": [
"/path/to/project/target/debug/project-123462f2a057f680"
],
"executable": "/path/to/project/target/debug/project-123462f2a057f680",
"fresh": true
}
Only /path/to/project/target/debug/deps/project-123462f2a057f680.dSYM exists, but /path/to/project/target/debug/project-123462f2a057f680.dSYM doesn't. So lldb can't pick up debug symbols when debugging /path/to/project/target/debug/project-123462f2a057f680.
Describe the solution you'd like
I think there are three possible solutions:
- Change the executable path in JSON to /path/to/project/target/debug/deps/project-123462f2a057f680
- Add symlink
- Let those tools handle this specific case
Notes
Related issue: rust-lang/rust#59907