--- /dev/null
+; RUN: llvm-pdbutil dump -all %p/Inputs/Stripped.pdb > %t
+; RUN: FileCheck -input-file=%t %s
+
+; CHECK: Summary
+; CHECK-NEXT: ============================================================
+; CHECK-NEXT: Block Size: 4096
+; CHECK-NEXT: Number of blocks: 17
+; CHECK-NEXT: Number of streams: 12
+; CHECK-NEXT: Signature: 1541179274
+; CHECK-NEXT: Age: 2
+; CHECK-NEXT: GUID: {FF4F9B62-D99A-4647-97A7-22C702B1E053}
+; CHECK-NEXT: Features: 0x1
+; CHECK-NEXT: Has Debug Info: true
+; CHECK-NEXT: Has Types: true
+; CHECK-NEXT: Has IDs: true
+; CHECK-NEXT: Has Globals: true
+; CHECK-NEXT: Has Publics: true
+; CHECK-NEXT: Is incrementally linked: false
+; CHECK-NEXT: Has conflicting types: false
+; CHECK-NEXT: Is stripped: true
+
+; CHECK: Streams
+; CHECK-NEXT: ============================================================
+; CHECK-NEXT: Stream 0 ( 88 bytes): [Old MSF Directory]
+; CHECK-NEXT: Blocks: [4]
+; CHECK-NEXT: Stream 1 ( 78 bytes): [PDB Stream]
+; CHECK-NEXT: Blocks: [14]
+; CHECK-NEXT: Stream 2 ( 56 bytes): [TPI Stream]
+; CHECK-NEXT: Blocks: [13]
+; CHECK-NEXT: Stream 3 (1355 bytes): [DBI Stream]
+; CHECK-NEXT: Blocks: [7]
+; CHECK-NEXT: Stream 4 ( 56 bytes): [IPI Stream]
+; CHECK-NEXT: Blocks: [6]
+; CHECK-NEXT: Stream 5 ( 0 bytes): [Named Stream "/LinkInfo"]
+; CHECK-NEXT: Blocks: []
+; CHECK-NEXT: Stream 6 ( 200 bytes): [Section Header Data]
+; CHECK-NEXT: Blocks: [8]
+; CHECK-NEXT: Stream 7 ( 16 bytes): [Global Symbol Hash]
+; CHECK-NEXT: Blocks: [9]
+; CHECK-NEXT: Stream 8 ( 928 bytes): [Public Symbol Hash]
+; CHECK-NEXT: Blocks: [11]
+; CHECK-NEXT: Stream 9 ( 716 bytes): [Symbol Records]
+; CHECK-NEXT: Blocks: [10]
+; CHECK-NEXT: Stream 10 ( 0 bytes): [TPI Hash]
+; CHECK-NEXT: Blocks: []
+; CHECK-NEXT: Stream 11 ( 0 bytes): [IPI Hash]
+; CHECK-NEXT: Blocks: []
+
+; CHECK: Module Stats
+; CHECK-NEXT: ============================================================
+
+; CHECK: S_UDT Record Stats
+; CHECK-NEXT: ============================================================
+
+; CHECK: String Table
+; CHECK-NEXT: ============================================================
+
+; CHECK: Modules
+; CHECK-NEXT: ============================================================
+
+; CHECK: Files
+; CHECK-NEXT: ============================================================
+
+; CHECK: Lines
+; CHECK-NEXT: ============================================================
+
+; CHECK: Inlinee Lines
+; CHECK-NEXT: ============================================================
+
+; CHECK: Cross Module Imports
+; CHECK-NEXT: ============================================================
+
+; CHECK: Cross Module Exports
+; CHECK-NEXT: ============================================================
+
+; CHECK: Old FPO Data
+; CHECK-NEXT: ============================================================
+
+; CHECK: New FPO Data
+; CHECK-NEXT: ============================================================
+
+; CHECK: Types (TPI Stream)
+; CHECK-NEXT: ============================================================
+
+; CHECK: Types (IPI Stream)
+; CHECK-NEXT: ============================================================
+
+; CHECK: Global Symbols
+; CHECK-NEXT: ============================================================
+
+; CHECK: Public Symbols
+; CHECK-NEXT: ============================================================
+
+; CHECK: Symbols
+; CHECK-NEXT: ============================================================
+
+; CHECK: Section Headers
+; CHECK-NEXT: ============================================================
+
+; CHECK: Original Section Headers
+; CHECK-NEXT: ============================================================
+
+; CHECK: Section Contributions
+; CHECK-NEXT: ============================================================
+
+; CHECK: Section Map
+; CHECK-NEXT: ============================================================
+
+
static StatCollection getSymbolStats(const SymbolGroup &SG,
StatCollection &CumulativeStats) {
StatCollection Stats;
- if (SG.getFile().isPdb()) {
+ if (SG.getFile().isPdb() && SG.hasDebugStream()) {
// For PDB files, all symbols are packed into one stream.
for (const auto &S : SG.getPdbModuleStream().symbols(nullptr)) {
Stats.update(S.kind(), S.length());
P.formatLine("TI: {0}, Offset: {1}", IO.Type, fmtle(IO.Offset));
}
- P.NewLine();
- P.formatLine("Hash Adjusters:");
- auto &Adjusters = Stream.getHashAdjusters();
- auto &Strings = Err(getPdb().getStringTable());
- for (const auto &A : Adjusters) {
- AutoIndent Indent2(P);
- auto ExpectedStr = Strings.getStringForID(A.first);
- TypeIndex TI(A.second);
- if (ExpectedStr)
- P.formatLine("`{0}` -> {1}", *ExpectedStr, TI);
- else {
- P.formatLine("unknown str id ({0}) -> {1}", A.first, TI);
- consumeError(ExpectedStr.takeError());
+ if (getPdb().hasPDBStringTable()) {
+ P.NewLine();
+ P.formatLine("Hash Adjusters:");
+ auto &Adjusters = Stream.getHashAdjusters();
+ auto &Strings = Err(getPdb().getStringTable());
+ for (const auto &A : Adjusters) {
+ AutoIndent Indent2(P);
+ auto ExpectedStr = Strings.getStringForID(A.first);
+ TypeIndex TI(A.second);
+ if (ExpectedStr)
+ P.formatLine("`{0}` -> {1}", *ExpectedStr, TI);
+ else {
+ P.formatLine("unknown str id ({0}) -> {1}", A.first, TI);
+ consumeError(ExpectedStr.takeError());
+ }
}
}
}
return formatUnknownEnum(Kind);
}
-static const DebugStringTableSubsectionRef &extractStringTable(PDBFile &File) {
- return cantFail(File.getStringTable()).getStringTable();
-}
-
template <typename... Args>
static void formatInternal(LinePrinter &Printer, bool Append, Args &&... args) {
if (Append)
// PDB always uses the same string table, but each module has its own
// checksums. So we only set the strings if they're not already set.
- if (!SC.hasStrings())
- SC.setStrings(extractStringTable(File->pdb()));
+ if (!SC.hasStrings()) {
+ auto StringTable = File->pdb().getStringTable();
+ if (StringTable)
+ SC.setStrings(StringTable->getStringTable());
+ else
+ consumeError(StringTable.takeError());
+ }
SC.resetChecksums();
auto MDS = getModuleDebugStream(File->pdb(), Name, Modi);