Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit f45b56d

Browse files
committed
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366386 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 08b0610 commit f45b56d

14 files changed

+181
-27
lines changed

include/llvm/DebugInfo/PDB/DIA/DIAInjectedSource.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class DIAInjectedSource : public IPDBInjectedSource {
2525
std::string getFileName() const override;
2626
std::string getObjectFileName() const override;
2727
std::string getVirtualFileName() const override;
28-
PDB_SourceCompression getCompression() const override;
28+
uint32_t getCompression() const override;
2929
std::string getCode() const override;
3030

3131
private:

include/llvm/DebugInfo/PDB/IPDBInjectedSource.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#ifndef LLVM_DEBUGINFO_PDB_IPDBINJECTEDSOURCE_H
1010
#define LLVM_DEBUGINFO_PDB_IPDBINJECTEDSOURCE_H
1111

12-
#include "PDBTypes.h"
1312
#include "llvm/Support/raw_ostream.h"
1413
#include <memory>
1514
#include <string>
@@ -32,7 +31,10 @@ class IPDBInjectedSource {
3231
virtual std::string getFileName() const = 0;
3332
virtual std::string getObjectFileName() const = 0;
3433
virtual std::string getVirtualFileName() const = 0;
35-
virtual PDB_SourceCompression getCompression() const = 0;
34+
// The returned value depends on the PDB producer,
35+
// but 0 is guaranteed to mean "no compression".
36+
// The enum PDB_SourceCompression lists known return values.
37+
virtual uint32_t getCompression() const = 0;
3638
virtual std::string getCode() const = 0;
3739
};
3840
} // namespace pdb

include/llvm/DebugInfo/PDB/PDBExtras.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,12 @@ raw_ostream &operator<<(raw_ostream &OS, const PDB_SymType &Tag);
3737
raw_ostream &operator<<(raw_ostream &OS, const PDB_MemberAccess &Access);
3838
raw_ostream &operator<<(raw_ostream &OS, const PDB_UdtType &Type);
3939
raw_ostream &operator<<(raw_ostream &OS, const PDB_Machine &Machine);
40-
raw_ostream &operator<<(raw_ostream &OS,
41-
const PDB_SourceCompression &Compression);
4240

4341
raw_ostream &operator<<(raw_ostream &OS, const Variant &Value);
4442
raw_ostream &operator<<(raw_ostream &OS, const VersionInfo &Version);
4543
raw_ostream &operator<<(raw_ostream &OS, const TagStats &Stats);
4644

45+
raw_ostream& dumpPDBSourceCompression(raw_ostream& OS, uint32_t Compression);
4746

4847
template <typename T>
4948
void dumpSymbolField(raw_ostream &OS, StringRef Name, T Value, int Indent) {

include/llvm/DebugInfo/PDB/PDBTypes.h

+63-5
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,69 @@ enum class PDB_Machine {
146146
WceMipsV2 = 0x169
147147
};
148148

149-
enum class PDB_SourceCompression {
150-
None,
151-
RunLengthEncoded,
152-
Huffman,
153-
LZ,
149+
// A struct with an inner unnamed enum with explicit underlying type resuls
150+
// in an enum class that can implicitly convert to the underlying type, which
151+
// is convenient for this enum.
152+
struct PDB_SourceCompression {
153+
enum : uint32_t {
154+
// No compression. Produced e.g. by `link.exe /natvis:foo.natvis`.
155+
None,
156+
// Not known what produces this.
157+
RunLengthEncoded,
158+
// Not known what produces this.
159+
Huffman,
160+
// Not known what produces this.
161+
LZ,
162+
// Produced e.g. by `csc /debug`. The encoded data is its own mini-stream
163+
// with the following layout (in little endian):
164+
// GUID LanguageTypeGuid;
165+
// GUID LanguageVendorGuid;
166+
// GUID DocumentTypeGuid;
167+
// GUID HashFunctionGuid;
168+
// uint32_t HashDataSize;
169+
// uint32_t CompressedDataSize;
170+
// Followed by HashDataSize bytes containing a hash checksum,
171+
// followed by CompressedDataSize bytes containing source contents.
172+
//
173+
// CompressedDataSize can be 0, in this case only the hash data is present.
174+
// (CompressedDataSize is != 0 e.g. if `/embed` is passed to csc.exe.)
175+
// The compressed data format is:
176+
// uint32_t UncompressedDataSize;
177+
// If UncompressedDataSize is 0, the data is stored uncompressed and
178+
// CompressedDataSize stores the uncompressed size.
179+
// If UncompressedDataSize is != 0, then the data is in raw deflate
180+
// encoding as described in rfc1951.
181+
//
182+
// A GUID is 16 bytes, stored in the usual
183+
// uint32_t
184+
// uint16_t
185+
// uint16_t
186+
// uint8_t[24]
187+
// layout.
188+
//
189+
// Well-known GUIDs for LanguageTypeGuid are:
190+
// 63a08714-fc37-11d2-904c-00c04fa302a1 C
191+
// 3a12d0b7-c26c-11d0-b442-00a0244a1dd2 C++
192+
// 3f5162f8-07c6-11d3-9053-00c04fa302a1 C#
193+
// af046cd1-d0e1-11d2-977c-00a0c9b4d50c Cobol
194+
// ab4f38c9-b6e6-43ba-be3b-58080b2ccce3 F#
195+
// 3a12d0b4-c26c-11d0-b442-00a0244a1dd2 Java
196+
// 3a12d0b6-c26c-11d0-b442-00a0244a1dd2 JScript
197+
// af046cd2-d0e1-11d2-977c-00a0c9b4d50c Pascal
198+
// 3a12d0b8-c26c-11d0-b442-00a0244a1dd2 Visual Basic
199+
//
200+
// Well-known GUIDs for LanguageVendorGuid are:
201+
// 994b45c4-e6e9-11d2-903f-00c04fa302a1 Microsoft
202+
//
203+
// Well-known GUIDs for DocumentTypeGuid are:
204+
// 5a869d0b-6611-11d3-bd2a-0000f80849bd Text
205+
//
206+
// Well-known GUIDs for HashFunctionGuid are:
207+
// 406ea660-64cf-4c82-b6f0-42d48172a799 MD5 (HashDataSize is 16)
208+
// ff1816ec-aa5e-4d10-87f7-6f4963833460 SHA1 (HashDataSize is 20)
209+
// 8829d00f-11b8-4213-878b-770e8597ac16 SHA256 (HashDataSize is 32)
210+
DotNet = 101,
211+
};
154212
};
155213

156214
/// These values correspond to the CV_call_e enumeration, and are documented

lib/DebugInfo/PDB/DIA/DIAInjectedSource.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ std::string DIAInjectedSource::getVirtualFileName() const {
4141
&IDiaInjectedSource::get_virtualFilename);
4242
}
4343

44-
PDB_SourceCompression DIAInjectedSource::getCompression() const {
44+
uint32_t DIAInjectedSource::getCompression() const {
4545
DWORD Compression = 0;
4646
if (S_OK != SourceFile->get_sourceCompression(&Compression))
4747
return PDB_SourceCompression::None;
48-
return static_cast<PDB_SourceCompression>(Compression);
48+
return static_cast<uint32_t>(Compression);
4949
}
5050

5151
std::string DIAInjectedSource::getCode() const {

lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp

+5-6
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@ namespace pdb {
1717

1818
namespace {
1919

20-
Expected<std::string> readStreamData(BinaryStream &Stream) {
21-
uint32_t Offset = 0, DataLength = Stream.getLength();
20+
Expected<std::string> readStreamData(BinaryStream &Stream, uint32_t Limit) {
21+
uint32_t Offset = 0, DataLength = std::min(Limit, Stream.getLength());
2222
std::string Result;
2323
Result.reserve(DataLength);
2424
while (Offset < DataLength) {
2525
ArrayRef<uint8_t> Data;
2626
if (auto E = Stream.readLongestContiguousChunk(Offset, Data))
2727
return std::move(E);
28+
Data = Data.take_front(DataLength - Offset);
2829
Offset += Data.size();
2930
Result += toStringRef(Data);
3031
}
@@ -62,9 +63,7 @@ class NativeInjectedSource final : public IPDBInjectedSource {
6263
return *VName;
6364
}
6465

65-
PDB_SourceCompression getCompression() const override {
66-
return static_cast<PDB_SourceCompression>(Entry.Compression);
67-
}
66+
uint32_t getCompression() const override { return Entry.Compression; }
6867

6968
std::string getCode() const override {
7069
// Get name of stream storing the data.
@@ -81,7 +80,7 @@ class NativeInjectedSource final : public IPDBInjectedSource {
8180
return "(failed to open data stream)";
8281
}
8382

84-
auto Data = readStreamData(**ExpectedFileStream);
83+
auto Data = readStreamData(**ExpectedFileStream, Entry.FileSize);
8584
if (!Data) {
8685
consumeError(Data.takeError());
8786
return "(failed to read data)";

lib/DebugInfo/PDB/PDBExtras.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -320,14 +320,17 @@ raw_ostream &llvm::pdb::operator<<(raw_ostream &OS,
320320
return OS;
321321
}
322322

323-
raw_ostream &llvm::pdb::operator<<(raw_ostream &OS,
324-
const PDB_SourceCompression &Compression) {
323+
raw_ostream &llvm::pdb::dumpPDBSourceCompression(raw_ostream &OS,
324+
uint32_t Compression) {
325325
switch (Compression) {
326326
CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SourceCompression, None, OS)
327327
CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SourceCompression, Huffman, OS)
328328
CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SourceCompression, LZ, OS)
329329
CASE_OUTPUT_ENUM_CLASS_STR(PDB_SourceCompression, RunLengthEncoded, "RLE",
330330
OS)
331+
CASE_OUTPUT_ENUM_CLASS_NAME(PDB_SourceCompression, DotNet, OS)
332+
default:
333+
OS << "Unknown (" << Compression << ")";
331334
}
332335
return OS;
333336
}
Binary file not shown.
Binary file not shown.
Binary file not shown.

test/tools/llvm-pdbutil/injected-sources-native.test

+45
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,48 @@
2828

2929
; NEGATIVE: ---INJECTED SOURCES---
3030
; NEGATIVE-NEXT: There are no injected sources.
31+
32+
; PDB created by running `csc /debug Hello.cs`
33+
; RUN: llvm-pdbutil pretty -native -injected-sources -injected-source-content \
34+
; RUN: %p/Inputs/dotnet_hashonly.pdb | FileCheck --check-prefix=HASH %s
35+
36+
; HASH: ---INJECTED SOURCES---
37+
; HASH: C:\src\llvm-mono\Hello.cs (92 bytes): obj=<null>, vname=c:\src\llvm-mono\hello.cs, crc=269413292, compression=DotNet
38+
; HASH-NEXT: Compressed data (
39+
; HASH-NEXT: 0000: F862513F C607D311 905300C0 4FA302A1 C4454B99 E9E6D211 903F00C0 4FA302A1 |.bQ?.....S..O....EK......?..O...|
40+
; HASH-NEXT: 0020: 0B9D865A 1166D311 BD2A0000 F80849BD EC1618FF 5EAA104D 87F76F49 63833460 |...Z.f...*....I.....^..M..oIc.4`|
41+
; HASH-NEXT: 0040: 14000000 00000000 17299CBE 74FDDF66 FFCD5E08 CE34A775 D464C611 |.........)..t..f..^..4.u.d..|
42+
; HASH-NEXT: )
43+
44+
; PDB created by running `csc /debug Hello.cs` with Hello.cs smaller than 200 bytes.
45+
; RUN: llvm-pdbutil pretty -native -injected-sources -injected-source-content \
46+
; RUN: %p/Inputs/dotnet_contents_uncompressed.pdb | FileCheck --check-prefix=UNCOMP %s
47+
48+
; UNCOMP: ---INJECTED SOURCES---
49+
; UNCOMP: C:\src\llvm-mono\Hello.cs (232 bytes): obj=<null>, vname=c:\src\llvm-mono\hello.cs, crc=323787205, compression=DotNet
50+
; UNCOMP-NEXT: Compressed data (
51+
; UNCOMP-NEXT: 0000: F862513F C607D311 905300C0 4FA302A1 C4454B99 E9E6D211 903F00C0 4FA302A1 |.bQ?.....S..O....EK......?..O...|
52+
; UNCOMP-NEXT: 0020: 0B9D865A 1166D311 BD2A0000 F80849BD EC1618FF 5EAA104D 87F76F49 63833460 |...Z.f...*....I.....^..M..oIc.4`|
53+
; UNCOMP-NEXT: 0040: 14000000 8C000000 17299CBE 74FDDF66 FFCD5E08 CE34A775 D464C611 00000000 |.........)..t..f..^..4.u.d......|
54+
; UNCOMP-NEXT: 0060: 6E616D65 73706163 65204865 6C6C6F57 6F726C64 207B0D0A 636C6173 73204865 |namespace HelloWorld {..class He|
55+
; UNCOMP-NEXT: 0080: 6C6C6F20 7B0D0A20 20737461 74696320 766F6964 204D6169 6E282920 7B205379 |llo {.. static void Main() { Sy|
56+
; UNCOMP-NEXT: 00A0: 7374656D 2E436F6E 736F6C65 2E577269 74654C69 6E652822 48656C6C 6F206173 |stem.Console.WriteLine("Hello as|
57+
; UNCOMP-NEXT: 00C0: 64666A6B 6C777763 6F697762 72796669 75667566 20576F72 6C642122 293B207D |dfjklwwcoiwbryfiufuf World!"); }|
58+
; UNCOMP-NEXT: 00E0: 0D0A7D0D 0A7D0D0A |..}..}..|
59+
; UNCOMP-NEXT: )
60+
61+
; PDB created by running `csc /debug Hello.cs` with Hello.cs larger than 200 bytes.
62+
; RUN: llvm-pdbutil pretty -native -injected-sources -injected-source-content \
63+
; RUN: %p/Inputs/dotnet_contents_compressed.pdb | FileCheck --check-prefix=COMP %s
64+
65+
; COMP: ---INJECTED SOURCES---
66+
; COMP: C:\src\llvm-mono\Hello.cs (218 bytes): obj=<null>, vname=c:\src\llvm-mono\hello.cs, crc=616104201, compression=DotNet
67+
; COMP-NEXT: Compressed data (
68+
; COMP-NEXT: 0000: F862513F C607D311 905300C0 4FA302A1 C4454B99 E9E6D211 903F00C0 4FA302A1 |.bQ?.....S..O....EK......?..O...|
69+
; COMP-NEXT: 0020: 0B9D865A 1166D311 BD2A0000 F80849BD EC1618FF 5EAA104D 87F76F49 63833460 |...Z.f...*....I.....^..M..oIc.4`|
70+
; COMP-NEXT: 0040: 14000000 7E000000 52CD36A0 6A9824CD A3034543 7FA9765E D572DA21 FB000000 |....~...R.6.j.$...EC..v^.r.!....|
71+
; COMP-NEXT: 0060: CB4BCC4D 2D2E484C 4E55F048 CDC9C90F CF2FCA49 51A8E6E5 4ACE492C 2E868881 |.K.M-.HLNU.H...../.IQ...J.I,....|
72+
; COMP-NEXT: 0080: B80A0AC5 25892599 C90A65F9 99290ABE 8999791A 9A0AD50A C195C525 A9B97ACE |....%.%...e..)....y........%..z.|
73+
; COMP-NEXT: 00A0: F979C5F9 39A97AE1 459925A9 3E9979A9 1A4A109D 89C52969 59D939E5 E5C9F999 |.y..9.z.E.%.>.y..J....)iY.9.....|
74+
; COMP-NEXT: 00C0: E5494595 6999A569 A5690321 0CF698A2 92A6B542 2D2F1704 0100 |.IE.i..i.i.!.......B-/....|
75+
; COMP-NEXT: )

test/tools/llvm-pdbutil/injected-sources.test

+45
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,48 @@
2727

2828
; NEGATIVE: ---INJECTED SOURCES---
2929
; NEGATIVE-NEXT: There are no injected sources.
30+
31+
; PDB created by running `csc /debug Hello.cs`
32+
; RUN: llvm-pdbutil pretty -native -injected-sources -injected-source-content \
33+
; RUN: %p/Inputs/dotnet_hashonly.pdb | FileCheck --check-prefix=HASH %s
34+
35+
; HASH: ---INJECTED SOURCES---
36+
; HASH: C:\src\llvm-mono\Hello.cs (92 bytes): obj=<null>, vname=c:\src\llvm-mono\hello.cs, crc=269413292, compression=DotNet
37+
; HASH-NEXT: Compressed data (
38+
; HASH-NEXT: 0000: F862513F C607D311 905300C0 4FA302A1 C4454B99 E9E6D211 903F00C0 4FA302A1 |.bQ?.....S..O....EK......?..O...|
39+
; HASH-NEXT: 0020: 0B9D865A 1166D311 BD2A0000 F80849BD EC1618FF 5EAA104D 87F76F49 63833460 |...Z.f...*....I.....^..M..oIc.4`|
40+
; HASH-NEXT: 0040: 14000000 00000000 17299CBE 74FDDF66 FFCD5E08 CE34A775 D464C611 |.........)..t..f..^..4.u.d..|
41+
; HASH-NEXT: )
42+
43+
; PDB created by running `csc /debug Hello.cs` with Hello.cs smaller than 200 bytes.
44+
; RUN: llvm-pdbutil pretty -native -injected-sources -injected-source-content \
45+
; RUN: %p/Inputs/dotnet_contents_uncompressed.pdb | FileCheck --check-prefix=UNCOMP %s
46+
47+
; UNCOMP: ---INJECTED SOURCES---
48+
; UNCOMP: C:\src\llvm-mono\Hello.cs (232 bytes): obj=<null>, vname=c:\src\llvm-mono\hello.cs, crc=323787205, compression=DotNet
49+
; UNCOMP-NEXT: Compressed data (
50+
; UNCOMP-NEXT: 0000: F862513F C607D311 905300C0 4FA302A1 C4454B99 E9E6D211 903F00C0 4FA302A1 |.bQ?.....S..O....EK......?..O...|
51+
; UNCOMP-NEXT: 0020: 0B9D865A 1166D311 BD2A0000 F80849BD EC1618FF 5EAA104D 87F76F49 63833460 |...Z.f...*....I.....^..M..oIc.4`|
52+
; UNCOMP-NEXT: 0040: 14000000 8C000000 17299CBE 74FDDF66 FFCD5E08 CE34A775 D464C611 00000000 |.........)..t..f..^..4.u.d......|
53+
; UNCOMP-NEXT: 0060: 6E616D65 73706163 65204865 6C6C6F57 6F726C64 207B0D0A 636C6173 73204865 |namespace HelloWorld {..class He|
54+
; UNCOMP-NEXT: 0080: 6C6C6F20 7B0D0A20 20737461 74696320 766F6964 204D6169 6E282920 7B205379 |llo {.. static void Main() { Sy|
55+
; UNCOMP-NEXT: 00A0: 7374656D 2E436F6E 736F6C65 2E577269 74654C69 6E652822 48656C6C 6F206173 |stem.Console.WriteLine("Hello as|
56+
; UNCOMP-NEXT: 00C0: 64666A6B 6C777763 6F697762 72796669 75667566 20576F72 6C642122 293B207D |dfjklwwcoiwbryfiufuf World!"); }|
57+
; UNCOMP-NEXT: 00E0: 0D0A7D0D 0A7D0D0A |..}..}..|
58+
; UNCOMP-NEXT: )
59+
60+
; PDB created by running `csc /debug Hello.cs` with Hello.cs larger than 200 bytes.
61+
; RUN: llvm-pdbutil pretty -native -injected-sources -injected-source-content \
62+
; RUN: %p/Inputs/dotnet_contents_compressed.pdb | FileCheck --check-prefix=COMP %s
63+
64+
; COMP: ---INJECTED SOURCES---
65+
; COMP: C:\src\llvm-mono\Hello.cs (218 bytes): obj=<null>, vname=c:\src\llvm-mono\hello.cs, crc=616104201, compression=DotNet
66+
; COMP-NEXT: Compressed data (
67+
; COMP-NEXT: 0000: F862513F C607D311 905300C0 4FA302A1 C4454B99 E9E6D211 903F00C0 4FA302A1 |.bQ?.....S..O....EK......?..O...|
68+
; COMP-NEXT: 0020: 0B9D865A 1166D311 BD2A0000 F80849BD EC1618FF 5EAA104D 87F76F49 63833460 |...Z.f...*....I.....^..M..oIc.4`|
69+
; COMP-NEXT: 0040: 14000000 7E000000 52CD36A0 6A9824CD A3034543 7FA9765E D572DA21 FB000000 |....~...R.6.j.$...EC..v^.r.!....|
70+
; COMP-NEXT: 0060: CB4BCC4D 2D2E484C 4E55F048 CDC9C90F CF2FCA49 51A8E6E5 4ACE492C 2E868881 |.K.M-.HLNU.H...../.IQ...J.I,....|
71+
; COMP-NEXT: 0080: B80A0AC5 25892599 C90A65F9 99290ABE 8999791A 9A0AD50A C195C525 A9B97ACE |....%.%...e..)....y........%..z.|
72+
; COMP-NEXT: 00A0: F979C5F9 39A97AE1 459925A9 3E9979A9 1A4A109D 89C52969 59D939E5 E5C9F999 |.y..9.z.E.%.>.y..J....)iY.9.....|
73+
; COMP-NEXT: 00C0: E5494595 6999A569 A5690321 0CF698A2 92A6B542 2D2F1704 0100 |.IE.i..i.i.!.......B-/....|
74+
; COMP-NEXT: )

tools/llvm-pdbutil/LinePrinter.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,7 @@ struct AutoIndent {
132132

133133
template <class T>
134134
inline raw_ostream &operator<<(LinePrinter &Printer, const T &Item) {
135-
Printer.getStream() << Item;
136-
return Printer.getStream();
135+
return Printer.getStream() << Item;
137136
}
138137

139138
enum class PDB_ColorItem {

tools/llvm-pdbutil/llvm-pdbutil.cpp

+9-5
Original file line numberDiff line numberDiff line change
@@ -947,9 +947,6 @@ static void dumpInjectedSources(LinePrinter &Printer, IPDBSession &Session) {
947947
std::string VFName = stringOr(IS->getVirtualFileName(), "<null>");
948948
uint32_t CRC = IS->getCrc32();
949949

950-
std::string CompressionStr;
951-
llvm::raw_string_ostream Stream(CompressionStr);
952-
Stream << IS->getCompression();
953950
WithColor(Printer, PDB_ColorItem::Path).get() << File;
954951
Printer << " (";
955952
WithColor(Printer, PDB_ColorItem::LiteralValue).get() << Size;
@@ -968,7 +965,9 @@ static void dumpInjectedSources(LinePrinter &Printer, IPDBSession &Session) {
968965
Printer << ", ";
969966
WithColor(Printer, PDB_ColorItem::Keyword).get() << "compression";
970967
Printer << "=";
971-
WithColor(Printer, PDB_ColorItem::LiteralValue).get() << Stream.str();
968+
dumpPDBSourceCompression(
969+
WithColor(Printer, PDB_ColorItem::LiteralValue).get(),
970+
IS->getCompression());
972971

973972
if (!opts::pretty::ShowInjectedSourceContent)
974973
continue;
@@ -977,7 +976,12 @@ static void dumpInjectedSources(LinePrinter &Printer, IPDBSession &Session) {
977976
int Indent = Printer.getIndentLevel();
978977
Printer.Unindent(Indent);
979978

980-
Printer.printLine(IS->getCode());
979+
if (IS->getCompression() == PDB_SourceCompression::None)
980+
Printer.printLine(IS->getCode());
981+
else
982+
Printer.formatBinary("Compressed data",
983+
arrayRefFromStringRef(IS->getCode()),
984+
/*StartOffset=*/0);
981985

982986
// Re-indent back to the original level.
983987
Printer.Indent(Indent);

0 commit comments

Comments
 (0)