zig icon indicating copy to clipboard operation
zig copied to clipboard

Add the ability to link Natvis files into PDBs

Open The-King-of-Toasters opened this issue 1 year ago • 0 comments

Natvis[^1] is a framework to support programmer-defined type formatting when debugging. It's similar to the GDB/LLDB pretty printers in tools except that the files are embedded into PDBs as-is instead of relying on having the scripts available. Support is shared across all the Microsoft debugging tools (WinDbg, Visual Studio + Code).

[^1]: Create custom views of C++ objects in the debugger using the Natvis framework

For an example: Rust projects built in Debug mode contain these definitions in the resulting PDB.

Some things to consider:

  • The files are XML, but they aren't validated at link time (tested using msvc link and clang-cl).
  • The type names may shift around due to Zig using one compilation unit. It seems the stdlib types stick to std..

The-King-of-Toasters avatar Apr 14 '24 01:04 The-King-of-Toasters