[PATCH] D34191: completely rewrite the llvm-pdbutil "raw" output style

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 13 19:46:41 PDT 2017


zturner created this revision.
Herald added subscribers: hiraditya, mgorny.

After some internal discussions, we agreed that the raw output style had outlived its usefulness.  It was originally created before we had even thought of dumping to YAML, and it was intended to give us some insight into the internals of a PDB file.  Now we have YAML mode which does almost exactly this but is more powerful in that it can round-trip back to a PDB, which the raw mode could not do.  So the raw mode had become purely a maintenance burden.

One option was to just delete it.  However, its original goal was to be as readable as possible while staying close to the "metal" - i.e. presenting the output in a way that maps directly to the underlying file format.  We don't actually need that last requirement anymore since it's covered by the yaml mode, so we could repurpose "raw" mode to actually just be **as readable as possible**.

This patch implements about 80% of the functionality previously in raw mode, but in a completely different style that is more akin to what `cvdump` outputs.  Records are very compressed, often times appearing on just one line.  One nice thing about this is that it makes full record matching easier, because you can grep for indices, names, and leaf types on a single line often.

See the tests for some examples of what the new output looks like.

Note that this patch actually //regresses// the functionality of raw mode in a few areas, but only because the patch was already unreasonably large and going 100% would have been even worse.  Specifically, this patch is missing:

1. The ability to dump module debug subsections (checksums, lines, etc)
2. The ability to dump section headers

Aside from that everything is here.  While goign through the tests fixing them all up, I found many duplicate tests.  They've been deleted.  In subsequent patches I will go through and re-add the missing functionality.


https://reviews.llvm.org/D34191

Files:
  lld/test/COFF/pdb-lib.s
  lld/test/COFF/pdb.test
  llvm/include/llvm/DebugInfo/CodeView/CodeView.h
  llvm/include/llvm/DebugInfo/CodeView/Formatters.h
  llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h
  llvm/include/llvm/DebugInfo/CodeView/TypeIndex.h
  llvm/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h
  llvm/include/llvm/DebugInfo/PDB/Native/PublicsStream.h
  llvm/include/llvm/DebugInfo/PDB/Native/RawConstants.h
  llvm/include/llvm/DebugInfo/PDB/Native/SymbolStream.h
  llvm/include/llvm/Support/BinaryStreamArray.h
  llvm/include/llvm/Support/FormatProviders.h
  llvm/include/llvm/Support/MathExtras.h
  llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
  llvm/lib/DebugInfo/CodeView/SymbolRecordMapping.cpp
  llvm/lib/DebugInfo/CodeView/TypeDatabase.cpp
  llvm/lib/DebugInfo/CodeView/TypeIndex.cpp
  llvm/lib/DebugInfo/PDB/Native/PublicsStream.cpp
  llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
  llvm/test/DebugInfo/PDB/pdb-yaml-types.test
  llvm/test/DebugInfo/PDB/pdbdump-debug-subsections.test
  llvm/test/DebugInfo/PDB/pdbdump-headers.test
  llvm/test/DebugInfo/PDB/pdbdump-merge-ids-and-types.test
  llvm/test/DebugInfo/PDB/pdbdump-mergeids.test
  llvm/test/DebugInfo/PDB/pdbdump-mergetypes.test
  llvm/test/DebugInfo/PDB/pdbdump-raw-blocks.test
  llvm/test/DebugInfo/PDB/pdbdump-raw-stream.test
  llvm/test/DebugInfo/PDB/pdbdump-readwrite.test
  llvm/test/tools/llvm-pdbdump/raw-stream-data.test
  llvm/tools/llvm-pdbutil/CMakeLists.txt
  llvm/tools/llvm-pdbutil/FormatUtil.cpp
  llvm/tools/llvm-pdbutil/FormatUtil.h
  llvm/tools/llvm-pdbutil/LLVMOutputStyle.cpp
  llvm/tools/llvm-pdbutil/LLVMOutputStyle.h
  llvm/tools/llvm-pdbutil/LinePrinter.cpp
  llvm/tools/llvm-pdbutil/LinePrinter.h
  llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
  llvm/tools/llvm-pdbutil/MinimalSymbolDumper.h
  llvm/tools/llvm-pdbutil/MinimalTypeDumper.cpp
  llvm/tools/llvm-pdbutil/MinimalTypeDumper.h
  llvm/tools/llvm-pdbutil/RawOutputStyle.cpp
  llvm/tools/llvm-pdbutil/RawOutputStyle.h
  llvm/tools/llvm-pdbutil/YAMLOutputStyle.cpp
  llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
  llvm/tools/llvm-pdbutil/llvm-pdbutil.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34191.102471.patch
Type: text/x-patch
Size: 426261 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170614/5614274b/attachment-0001.bin>


More information about the llvm-commits mailing list