natvis-pdbs
A metabuild / build.rs compatible crate to embed .natvis debug visualizer files into your executable's .pdbs, for ease of debugging.
Limitations
- Natvis and PDBs being Microsoft technologies, this won't have any effect unless using MSVC-based build toolchains.
- While
crate-type=rlibcrates can contain .natvis files, they should not directly rely onnatvis-pdbs. (Due to the way crates are isolated for build,natvis-pdbswill only work when used for the final .exe, .lib, or .dll crate at this time.) - This abuses the
%LINK%environment variable since there's currently no stable build.rs-friendly arbitrary link-args.
Quick Start
To author crates containing .natvis files (example)
Place one or more natvis files inside any of:
- the root folder of your crate.
- inside the
{root}\srcfolder. - inside a
{root}\debug_metadatafolder.
Any other locations (including subdirectories of the above) will not (currently) be searched. See Recommended Reading bellow for more information about the .natvis format.
bits,bb
(bits & (1 << 0)) != 0
(bits & (1 << 1)) != 0
(bits & (1 << 2)) != 0
To consume .natvis files via build.rs (example)
Add the following to your executable's Cargo.toml:
[]
= "1"
And the following to your build.rs:
To consume .natvis files via metabuild (nightly only, example)
Add the following to your executable's Cargo.toml:
= ["metabuild"]
[]
= ["natvis-pdbs"]
[]
= "1"
Recommended Reading
- Create custom views of C++ objects
- Format specifiers for C++ in the Visual Studio debugger
- Context Operator in the Visual Studio Debugger (C++)
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.