diff options
author | Nico Weber <nicolasweber@gmx.de> | 2019-07-17 22:59:52 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2019-07-17 22:59:52 +0000 |
commit | 7bb5fc058314dba81dd652d8dcc74e133db0b445 (patch) | |
tree | df24b539828a7de97fb3f20673955070d4a84d8d /llvm/tools | |
parent | 7872d76a16d30a7ee33068c87aa5bb910f48ea64 (diff) | |
download | bcm5719-llvm-7bb5fc058314dba81dd652d8dcc74e133db0b445.tar.gz bcm5719-llvm-7bb5fc058314dba81dd652d8dcc74e133db0b445.zip |
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
Diffstat (limited to 'llvm/tools')
-rw-r--r-- | llvm/tools/llvm-pdbutil/LinePrinter.h | 3 | ||||
-rw-r--r-- | llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp | 14 |
2 files changed, 10 insertions, 7 deletions
diff --git a/llvm/tools/llvm-pdbutil/LinePrinter.h b/llvm/tools/llvm-pdbutil/LinePrinter.h index 74e341267ac..7ecfae17354 100644 --- a/llvm/tools/llvm-pdbutil/LinePrinter.h +++ b/llvm/tools/llvm-pdbutil/LinePrinter.h @@ -132,8 +132,7 @@ struct AutoIndent { template <class T> inline raw_ostream &operator<<(LinePrinter &Printer, const T &Item) { - Printer.getStream() << Item; - return Printer.getStream(); + return Printer.getStream() << Item; } enum class PDB_ColorItem { diff --git a/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp b/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp index e6e89d4bf22..785a9808679 100644 --- a/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp +++ b/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp @@ -947,9 +947,6 @@ static void dumpInjectedSources(LinePrinter &Printer, IPDBSession &Session) { std::string VFName = stringOr(IS->getVirtualFileName(), "<null>"); uint32_t CRC = IS->getCrc32(); - std::string CompressionStr; - llvm::raw_string_ostream Stream(CompressionStr); - Stream << IS->getCompression(); WithColor(Printer, PDB_ColorItem::Path).get() << File; Printer << " ("; WithColor(Printer, PDB_ColorItem::LiteralValue).get() << Size; @@ -968,7 +965,9 @@ static void dumpInjectedSources(LinePrinter &Printer, IPDBSession &Session) { Printer << ", "; WithColor(Printer, PDB_ColorItem::Keyword).get() << "compression"; Printer << "="; - WithColor(Printer, PDB_ColorItem::LiteralValue).get() << Stream.str(); + dumpPDBSourceCompression( + WithColor(Printer, PDB_ColorItem::LiteralValue).get(), + IS->getCompression()); if (!opts::pretty::ShowInjectedSourceContent) continue; @@ -977,7 +976,12 @@ static void dumpInjectedSources(LinePrinter &Printer, IPDBSession &Session) { int Indent = Printer.getIndentLevel(); Printer.Unindent(Indent); - Printer.printLine(IS->getCode()); + if (IS->getCompression() == PDB_SourceCompression::None) + Printer.printLine(IS->getCode()); + else + Printer.formatBinary("Compressed data", + arrayRefFromStringRef(IS->getCode()), + /*StartOffset=*/0); // Re-indent back to the original level. Printer.Indent(Indent); |