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 "LinePrinter.h"
13 #include "OutputStyle.h"
14 #include "StreamUtil.h"
16 #include "llvm/ADT/DenseMap.h"
17 #include "llvm/ADT/Optional.h"
18 #include "llvm/ADT/SmallVector.h"
19 #include "llvm/DebugInfo/PDB/Native/RawConstants.h"
27 class LazyRandomTypeCollection;
37 class TypeReferenceTracker;
39 struct StatCollection {
42 Stat(uint32_t Count, uint32_t Size) : Count(Count), Size(Size) {}
46 void update(uint32_t RecordSize) {
52 using KindAndStat = std::pair<uint32_t, Stat>;
54 void update(uint32_t Kind, uint32_t RecordSize) {
55 Totals.update(RecordSize);
56 auto Iter = Individual.try_emplace(Kind, 1, RecordSize);
58 Iter.first->second.update(RecordSize);
61 DenseMap<uint32_t, Stat> Individual;
63 std::vector<KindAndStat> getStatsSortedBySize() const;
66 class DumpOutputStyle : public OutputStyle {
69 DumpOutputStyle(InputFile &File);
70 ~DumpOutputStyle() override;
72 Error dump() override;
76 object::COFFObjectFile &getObj();
78 void printStreamNotValidForObj();
79 void printStreamNotPresent(StringRef StreamName);
81 Error dumpFileSummary();
82 Error dumpStreamSummary();
83 Error dumpSymbolStats();
85 Error dumpTypeStats();
86 Error dumpNamedStreams();
87 Error dumpStringTable();
88 Error dumpStringTableFromPdb();
89 Error dumpStringTableFromObj();
91 Error dumpInlineeLines();
95 Error dumpOldFpo(PDBFile &File);
96 Error dumpNewFpo(PDBFile &File);
97 Error dumpTpiStream(uint32_t StreamIdx);
98 Error dumpTypesFromObjectFile();
99 Error dumpTypeRefStats();
101 Error dumpModuleFiles();
102 Error dumpModuleSymsForPdb();
103 Error dumpModuleSymsForObj();
104 Error dumpGSIRecords();
107 Error dumpSymbolsFromGSI(const GSIHashTable &Table, bool HashExtras);
108 Error dumpSectionHeaders();
109 Error dumpSectionContribs();
110 Error dumpSectionMap();
112 void dumpSectionHeaders(StringRef Label, DbgHeaderType Type);
115 std::unique_ptr<TypeReferenceTracker> RefTracker;
117 SmallVector<StreamInfo, 32> StreamPurposes;