Support embedding natvis files in PDBs.
authorZachary Turner <zturner@google.com>
Mon, 19 Mar 2018 19:53:51 +0000 (19:53 +0000)
committerZachary Turner <zturner@google.com>
Mon, 19 Mar 2018 19:53:51 +0000 (19:53 +0000)
commitde53aaf13249dcbd6f3d4fd3b28898c77fa074c8
tree3b8061c1756ea52e9ff102b682e4e5615c6300c2
parenta2036e4945666aaf4579821121f4566dea7dd29d
Support embedding natvis files in PDBs.

Natvis is a debug language supported by Visual Studio for
specifying custom visualizers.  The /NATVIS option is an
undocumented link.exe flag which will take a .natvis file
and "inject" it into the PDB.  This way, you can ship the
debug visualizers for a program along with the PDB, which
is very useful for postmortem debugging.

This is implemented by adding a new "named stream" to the
PDB with a special name of /src/files/<natvis file name>
and simply copying the contents of the xml into this file.

Additionally, we need to emit a single stream named
/src/headerblock which contains a hash table of embedded
files to records describing them.

This patch adds this functionality, including the /NATVIS
option to lld-link.

Differential Revision: https://reviews.llvm.org/D44328

llvm-svn: 327895
27 files changed:
lld/COFF/Config.h
lld/COFF/Driver.cpp
lld/COFF/Options.td
lld/COFF/PDB.cpp
lld/test/COFF/Inputs/generic.yaml [new file with mode: 0644]
lld/test/COFF/Inputs/natvis-1.natvis [new file with mode: 0644]
lld/test/COFF/Inputs/natvis-2.natvis [new file with mode: 0644]
lld/test/COFF/Inputs/natvis-3.natvis [new file with mode: 0644]
lld/test/COFF/pdb-natvis.test [new file with mode: 0644]
lld/test/lit.cfg.py
lld/test/lit.site.cfg.py.in
llvm/include/llvm/DebugInfo/CodeView/DebugStringTableSubsection.h
llvm/include/llvm/DebugInfo/PDB/Native/HashTable.h
llvm/include/llvm/DebugInfo/PDB/Native/PDBFileBuilder.h
llvm/include/llvm/DebugInfo/PDB/Native/PDBStringTableBuilder.h
llvm/include/llvm/DebugInfo/PDB/Native/RawConstants.h
llvm/include/llvm/DebugInfo/PDB/Native/RawTypes.h
llvm/lib/DebugInfo/CodeView/DebugChecksumsSubsection.cpp
llvm/lib/DebugInfo/CodeView/DebugCrossImpSubsection.cpp
llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp
llvm/lib/DebugInfo/PDB/Native/InfoStreamBuilder.cpp
llvm/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp
llvm/lib/DebugInfo/PDB/Native/PDBStringTableBuilder.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