llvm-pdbdump: Fix several smaller issues with injected source compression handling
authorNico Weber <nicolasweber@gmx.de>
Wed, 17 Jul 2019 22:59:52 +0000 (22:59 +0000)
committerNico Weber <nicolasweber@gmx.de>
Wed, 17 Jul 2019 22:59:52 +0000 (22:59 +0000)
commit7bb5fc058314dba81dd652d8dcc74e133db0b445
treedf24b539828a7de97fb3f20673955070d4a84d8d
parent7872d76a16d30a7ee33068c87aa5bb910f48ea64
llvm-pdbdump: Fix several smaller issues with injected source compression handling

- getCompression() used to return a PDB_SourceCompression even though
  the docs for IDiaInjectedSource are explicit about the return value
  being compiler-dependent. Return an uint32_t instead, and make the
  printing code handle unknown values better by printing "Unknown" and
  the int value instead of not printing any compression.

- Print compressed contents as hex dump, not as string.

- Add compression type "DotNet", which is used (at least) by csc.exe,
  the C# compiler. Also add a lengthy comment describing the stream
  contents (derived from looking at the raw hex contents long enough
  to see the GUIDs, which led me to the roslyn and mono implementations
  for handling this).

- The native injected source dumper was dumping the contents of the
  whole data stream -- but csc.exe writes a stream that's padded with
  zero bytes to the next 512 boundary, and the dia api doesn't display
  those padding bytes. So make NativeInjectedSource::getCode() do the
  same thing.

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

llvm-svn: 366386
14 files changed:
llvm/include/llvm/DebugInfo/PDB/DIA/DIAInjectedSource.h
llvm/include/llvm/DebugInfo/PDB/IPDBInjectedSource.h
llvm/include/llvm/DebugInfo/PDB/PDBExtras.h
llvm/include/llvm/DebugInfo/PDB/PDBTypes.h
llvm/lib/DebugInfo/PDB/DIA/DIAInjectedSource.cpp
llvm/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp
llvm/lib/DebugInfo/PDB/PDBExtras.cpp
llvm/test/tools/llvm-pdbutil/Inputs/dotnet_contents_compressed.pdb [new file with mode: 0644]
llvm/test/tools/llvm-pdbutil/Inputs/dotnet_contents_uncompressed.pdb [new file with mode: 0644]
llvm/test/tools/llvm-pdbutil/Inputs/dotnet_hashonly.pdb [new file with mode: 0644]
llvm/test/tools/llvm-pdbutil/injected-sources-native.test
llvm/test/tools/llvm-pdbutil/injected-sources.test
llvm/tools/llvm-pdbutil/LinePrinter.h
llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp