-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Open
Labels
A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)Area: Debugging information in compiled programs (DWARF, PDB, etc.)O-windows-msvcToolchain: MSVC, Operating system: WindowsToolchain: MSVC, Operating system: WindowsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.WG-debuggingWorking group: Bad Rust debugging experiencesWorking group: Bad Rust debugging experiences
Description
Problem
When compiling staticlib crates using the MSVC toolchain, no PDBs are produced.
This makes it very hard to debug C++ programs that are statically linked to Rust libraries, especially in release mode.
Steps
cargo new --lib test
In Cargo.toml:
[lib]
path = "./src/lib.rs"
crate_type = ["staticlib"]
cargo build
Note that the output is test.lib
Now change Cargo.toml:
[lib]
path = "./src/lib.rs"
crate_type = ["cdylib"]
cargo build
Note that the output is test.lib + test.pdb
Possible Solution(s)
Is there a way to pass a flag to force creating the PDB. In Visual Studio it is /Zi.
Notes
It seems it is still possible to step into the code for debug builds, but not release builds.
Version
cargo 1.55.0 (32da73ab1 2021-08-23)
release: 1.55.0
commit-hash: 32da73ab19417aa89686e1d85c1440b72fdf877d
commit-date: 2021-08-23
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)Area: Debugging information in compiled programs (DWARF, PDB, etc.)O-windows-msvcToolchain: MSVC, Operating system: WindowsToolchain: MSVC, Operating system: WindowsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.WG-debuggingWorking group: Bad Rust debugging experiencesWorking group: Bad Rust debugging experiences