1 //===- DumpOutputStyle.h -------------------------------------- *- C++ --*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_TOOLS_LLVMPDBDUMP_DUMPOUTPUTSTYLE_H
10 #define LLVM_TOOLS_LLVMPDBDUMP_DUMPOUTPUTSTYLE_H
12 #include "OutputStyle.h"
13 #include "StreamUtil.h"
15 #include "llvm/ADT/DenseMap.h"
16 #include "llvm/ADT/SmallVector.h"
17 #include "llvm/DebugInfo/PDB/Native/LinePrinter.h"
18 #include "llvm/DebugInfo/PDB/Native/RawConstants.h"
30 class TypeReferenceTracker
;
32 struct StatCollection
{
35 Stat(uint32_t Count
, uint32_t Size
) : Count(Count
), Size(Size
) {}
39 void update(uint32_t RecordSize
) {
45 using KindAndStat
= std::pair
<uint32_t, Stat
>;
47 void update(uint32_t Kind
, uint32_t RecordSize
) {
48 Totals
.update(RecordSize
);
49 auto Iter
= Individual
.try_emplace(Kind
, 1, RecordSize
);
51 Iter
.first
->second
.update(RecordSize
);
54 DenseMap
<uint32_t, Stat
> Individual
;
56 std::vector
<KindAndStat
> getStatsSortedBySize() const;
59 class DumpOutputStyle
: public OutputStyle
{
62 DumpOutputStyle(InputFile
&File
);
63 ~DumpOutputStyle() override
;
65 Error
dump() override
;
69 object::COFFObjectFile
&getObj();
71 void printStreamNotValidForObj();
72 void printStreamNotPresent(StringRef StreamName
);
74 Error
dumpFileSummary();
75 Error
dumpStreamSummary();
76 Error
dumpSymbolStats();
78 Error
dumpTypeStats();
79 Error
dumpNamedStreams();
80 Error
dumpStringTable();
81 Error
dumpStringTableFromPdb();
82 Error
dumpStringTableFromObj();
84 Error
dumpInlineeLines();
88 Error
dumpOldFpo(PDBFile
&File
);
89 Error
dumpNewFpo(PDBFile
&File
);
90 Error
dumpTpiStream(uint32_t StreamIdx
);
91 Error
dumpTypesFromObjectFile();
92 Error
dumpTypeRefStats();
94 Error
dumpModuleFiles();
95 Error
dumpModuleSymsForPdb();
96 Error
dumpModuleSymsForObj();
97 Error
dumpGSIRecords();
100 Error
dumpSymbolsFromGSI(const GSIHashTable
&Table
, bool HashExtras
);
101 Error
dumpSectionHeaders();
102 Error
dumpSectionContribs();
103 Error
dumpSectionMap();
105 void dumpSectionHeaders(StringRef Label
, DbgHeaderType Type
);
108 std::unique_ptr
<TypeReferenceTracker
> RefTracker
;
110 SmallVector
<StreamInfo
, 32> StreamPurposes
;