annotate tools/llvm-pdbutil/DumpOutputStyle.h @ 121:803732b1fca8

LLVM 5.0
author kono
date Fri, 27 Oct 2017 17:07:41 +0900
parents
children 3a76565eade5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
121
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
1 //===- DumpOutputStyle.h -------------------------------------- *- C++ --*-===//
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
2 //
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
3 // The LLVM Compiler Infrastructure
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
4 //
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
5 // This file is distributed under the University of Illinois Open Source
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
6 // License. See LICENSE.TXT for details.
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
7 //
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
8 //===----------------------------------------------------------------------===//
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
9
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
10 #ifndef LLVM_TOOLS_LLVMPDBDUMP_DUMPOUTPUTSTYLE_H
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
11 #define LLVM_TOOLS_LLVMPDBDUMP_DUMPOUTPUTSTYLE_H
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
12
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
13 #include "LinePrinter.h"
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
14 #include "OutputStyle.h"
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
15 #include "StreamUtil.h"
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
16
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
17 #include "llvm/ADT/DenseMap.h"
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
18 #include "llvm/ADT/Optional.h"
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
19 #include "llvm/ADT/SmallVector.h"
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
20 #include "llvm/DebugInfo/PDB/Native/RawConstants.h"
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
21
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
22 #include <string>
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
23
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
24 namespace llvm {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
25 class BitVector;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
26
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
27 namespace codeview {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
28 class LazyRandomTypeCollection;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
29 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
30
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
31 namespace object {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
32 class COFFObjectFile;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
33 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
34
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
35 namespace pdb {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
36 class GSIHashTable;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
37 class InputFile;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
38
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
39 struct StatCollection {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
40 struct Stat {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
41 Stat() {}
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
42 Stat(uint32_t Count, uint32_t Size) : Count(Count), Size(Size) {}
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
43 uint32_t Count = 0;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
44 uint32_t Size = 0;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
45
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
46 void update(uint32_t RecordSize) {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
47 ++Count;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
48 Size += RecordSize;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
49 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
50 };
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
51
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
52 void update(uint32_t Kind, uint32_t RecordSize) {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
53 Totals.update(RecordSize);
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
54 auto Iter = Individual.try_emplace(Kind, 1, RecordSize);
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
55 if (!Iter.second)
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
56 Iter.first->second.update(RecordSize);
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
57 }
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
58 Stat Totals;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
59 DenseMap<uint32_t, Stat> Individual;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
60 };
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
61
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
62 class DumpOutputStyle : public OutputStyle {
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
63
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
64 public:
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
65 DumpOutputStyle(InputFile &File);
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
66
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
67 Error dump() override;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
68
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
69 private:
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
70 PDBFile &getPdb();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
71 object::COFFObjectFile &getObj();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
72
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
73 Error dumpFileSummary();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
74 Error dumpStreamSummary();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
75 Error dumpSymbolStats();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
76 Error dumpUdtStats();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
77 Error dumpStringTable();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
78 Error dumpLines();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
79 Error dumpInlineeLines();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
80 Error dumpXmi();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
81 Error dumpXme();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
82 Error dumpTpiStream(uint32_t StreamIdx);
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
83 Error dumpModules();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
84 Error dumpModuleFiles();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
85 Error dumpModuleSymsForPdb();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
86 Error dumpModuleSymsForObj();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
87 Error dumpGlobals();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
88 Error dumpPublics();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
89 Error dumpSymbolsFromGSI(const GSIHashTable &Table, bool HashExtras);
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
90 Error dumpSectionHeaders();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
91 Error dumpSectionContribs();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
92 Error dumpSectionMap();
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
93
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
94 void dumpSectionHeaders(StringRef Label, DbgHeaderType Type);
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
95
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
96 InputFile &File;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
97 LinePrinter P;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
98 SmallVector<StreamInfo, 32> StreamPurposes;
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
99 };
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
100 } // namespace pdb
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
101 } // namespace llvm
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
102
803732b1fca8 LLVM 5.0
kono
parents:
diff changeset
103 #endif