[PATCH] D44328: Support embedding natvis files in PDBs.

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 9 14:08:12 PST 2018


zturner created this revision.
zturner added reviewers: rnk, ruiu, smeenai.
Herald added a subscriber: hiraditya.

A natvis file is a debug visualizer DSL that can be embedded inside of a PDB so that the debugger can do custom formatting of types at debug time.

The way this is implemented is that the linker piggybacks off of the existing "named stream" map in the PDB file.  It seems like in theory you can store any kind of source file in here, so you could even archive your entire source tree inside of the PDB file. so you could debug without source.  In any case, the linker needs to create a named stream named `/src/files/<some unique name>`, and then for the contents of that stream, just embed the contents of the xml.  `<some unique name>` doesn't seem to matter as long as it's unique and appears to end in `.natvis`, so we just use the path to the file that was typed in on the command line.

There's no way currently to write a test that verifies that this actually works and causes the debugger to use our embedded natvis files, but I did confirm that part manually.


https://reviews.llvm.org/D44328

Files:
  lld/COFF/Config.h
  lld/COFF/Driver.cpp
  lld/COFF/Options.td
  lld/COFF/PDB.cpp
  lld/test/COFF/Inputs/generic.yaml
  lld/test/COFF/Inputs/test.natvis
  lld/test/COFF/pdb-natvis.test
  llvm/include/llvm/DebugInfo/PDB/Native/PDBFileBuilder.h
  llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp
  llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
  llvm/tools/llvm-pdbutil/DumpOutputStyle.h
  llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
  llvm/tools/llvm-pdbutil/llvm-pdbutil.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44328.137836.patch
Type: text/x-patch
Size: 21506 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180309/ec82c296/attachment.bin>


More information about the llvm-commits mailing list