[llvm-objcopy] [COFF] Implmement --strip-unneeded and -x/--discard-all for symbols
[llvm-complete.git] / tools / llvm-pdbutil / DumpOutputStyle.h
blob9b3a85587bde3b00bce4673fa3c9ff2bbbd44bfc
1 //===- DumpOutputStyle.h -------------------------------------- *- C++ --*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_TOOLS_LLVMPDBDUMP_DUMPOUTPUTSTYLE_H
11 #define LLVM_TOOLS_LLVMPDBDUMP_DUMPOUTPUTSTYLE_H
13 #include "LinePrinter.h"
14 #include "OutputStyle.h"
15 #include "StreamUtil.h"
17 #include "llvm/ADT/DenseMap.h"
18 #include "llvm/ADT/Optional.h"
19 #include "llvm/ADT/SmallVector.h"
20 #include "llvm/DebugInfo/PDB/Native/RawConstants.h"
22 #include <string>
24 namespace llvm {
25 class BitVector;
27 namespace codeview {
28 class LazyRandomTypeCollection;
31 namespace object {
32 class COFFObjectFile;
35 namespace pdb {
36 class GSIHashTable;
37 class InputFile;
39 struct StatCollection {
40 struct Stat {
41 Stat() {}
42 Stat(uint32_t Count, uint32_t Size) : Count(Count), Size(Size) {}
43 uint32_t Count = 0;
44 uint32_t Size = 0;
46 void update(uint32_t RecordSize) {
47 ++Count;
48 Size += RecordSize;
52 void update(uint32_t Kind, uint32_t RecordSize) {
53 Totals.update(RecordSize);
54 auto Iter = Individual.try_emplace(Kind, 1, RecordSize);
55 if (!Iter.second)
56 Iter.first->second.update(RecordSize);
58 Stat Totals;
59 DenseMap<uint32_t, Stat> Individual;
62 class DumpOutputStyle : public OutputStyle {
64 public:
65 DumpOutputStyle(InputFile &File);
67 Error dump() override;
69 private:
70 PDBFile &getPdb();
71 object::COFFObjectFile &getObj();
73 void printStreamNotValidForObj();
74 void printStreamNotPresent(StringRef StreamName);
76 Error dumpFileSummary();
77 Error dumpStreamSummary();
78 Error dumpSymbolStats();
79 Error dumpUdtStats();
80 Error dumpNamedStreams();
81 Error dumpStringTable();
82 Error dumpStringTableFromPdb();
83 Error dumpStringTableFromObj();
84 Error dumpLines();
85 Error dumpInlineeLines();
86 Error dumpXmi();
87 Error dumpXme();
88 Error dumpFpo();
89 Error dumpOldFpo(PDBFile &File);
90 Error dumpNewFpo(PDBFile &File);
91 Error dumpTpiStream(uint32_t StreamIdx);
92 Error dumpTypesFromObjectFile();
93 Error dumpModules();
94 Error dumpModuleFiles();
95 Error dumpModuleSymsForPdb();
96 Error dumpModuleSymsForObj();
97 Error dumpGSIRecords();
98 Error dumpGlobals();
99 Error dumpPublics();
100 Error dumpSymbolsFromGSI(const GSIHashTable &Table, bool HashExtras);
101 Error dumpSectionHeaders();
102 Error dumpSectionContribs();
103 Error dumpSectionMap();
105 void dumpSectionHeaders(StringRef Label, DbgHeaderType Type);
107 InputFile &File;
108 LinePrinter P;
109 SmallVector<StreamInfo, 32> StreamPurposes;
111 } // namespace pdb
112 } // namespace llvm
114 #endif