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"
28 class TypeReferenceTracker
;
30 struct StatCollection
{
33 Stat(uint32_t Count
, uint32_t Size
) : Count(Count
), Size(Size
) {}
37 void update(uint32_t RecordSize
) {
43 using KindAndStat
= std::pair
<uint32_t, Stat
>;
45 void update(uint32_t Kind
, uint32_t RecordSize
) {
46 Totals
.update(RecordSize
);
47 auto Iter
= Individual
.try_emplace(Kind
, 1, RecordSize
);
49 Iter
.first
->second
.update(RecordSize
);
52 DenseMap
<uint32_t, Stat
> Individual
;
54 std::vector
<KindAndStat
> getStatsSortedBySize() const;
57 class DumpOutputStyle
: public OutputStyle
{
60 DumpOutputStyle(InputFile
&File
);
61 ~DumpOutputStyle() override
;
63 Error
dump() override
;
67 object::COFFObjectFile
&getObj();
69 void printStreamNotValidForObj();
70 void printStreamNotPresent(StringRef StreamName
);
72 Error
dumpFileSummary();
73 Error
dumpStreamSummary();
74 Error
dumpSymbolStats();
76 Error
dumpTypeStats();
77 Error
dumpNamedStreams();
78 Error
dumpStringTable();
79 Error
dumpStringTableFromPdb();
80 Error
dumpStringTableFromObj();
82 Error
dumpInlineeLines();
86 Error
dumpOldFpo(PDBFile
&File
);
87 Error
dumpNewFpo(PDBFile
&File
);
88 Error
dumpTpiStream(uint32_t StreamIdx
);
89 Error
dumpTypesFromObjectFile();
90 Error
dumpTypeRefStats();
92 Error
dumpModuleFiles();
93 Error
dumpModuleSymsForPdb();
94 Error
dumpModuleSymsForObj();
95 Error
dumpGSIRecords();
98 Error
dumpSymbolsFromGSI(const GSIHashTable
&Table
, bool HashExtras
);
99 Error
dumpSectionHeaders();
100 Error
dumpSectionContribs();
101 Error
dumpSectionMap();
103 void dumpSectionHeaders(StringRef Label
, DbgHeaderType Type
);
106 std::unique_ptr
<TypeReferenceTracker
> RefTracker
;
108 SmallVector
<StreamInfo
, 32> StreamPurposes
;