llvm.org GIT mirror llvm / 8839a0f
[pdb] Parse and dump section map and section contribs Differential Revision: http://reviews.llvm.org/D20876 Reviewed By: rnk, ruiu git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271488 91177308-0d34-0410-b5e6-96231b3b80d8 Zachary Turner 4 years ago
17 changed file(s) with 1196 addition(s) and 322 deletion(s). Raw diff Collapse all Expand all
0 //===- EnumTables.h Enum to string conversion tables ------------*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #ifndef LLVM_DEBUGINFO_CODEVIEW_ENUMTABLES_H
10 #define LLVM_DEBUGINFO_CODEVIEW_ENUMTABLES_H
11
12 #include "llvm/ADT/ArrayRef.h"
13 #include "llvm/DebugInfo/CodeView/CodeView.h"
14 #include "llvm/Support/COFF.h"
15 #include "llvm/Support/ScopedPrinter.h"
16
17 #include
18
19 namespace llvm {
20 namespace codeview {
21 ArrayRef> getSymbolTypeNames();
22 ArrayRef> getRegisterNames();
23 ArrayRef> getProcSymFlagNames();
24 ArrayRef> getLocalFlagNames();
25 ArrayRef> getFrameCookieKindNames();
26 ArrayRef> getSourceLanguageNames();
27 ArrayRef> getCompileSym2FlagNames();
28 ArrayRef> getCompileSym3FlagNames();
29 ArrayRef> getCPUTypeNames();
30 ArrayRef> getFrameProcSymFlagNames();
31 ArrayRef> getExportSymFlagNames();
32 ArrayRef> getThunkOrdinalNames();
33 ArrayRef> getTrampolineNames();
34 ArrayRef>
35 getImageSectionCharacteristicNames();
36 } // namespace codeview
37 } // namespace llvm
38
39 #endif // LLVM_DEBUGINFO_CODEVIEW_ENUMTABLES_H
3434 Error readFixedString(StringRef &Dest, uint32_t Length);
3535 Error readStreamRef(StreamRef &Ref);
3636 Error readStreamRef(StreamRef &Ref, uint32_t Length);
37
38 template Error readEnum(T &Dest) {
39 typename std::underlying_type::type N;
40 if (auto EC = readInteger(N))
41 return EC;
42 Dest = static_cast(N);
43 return Error::success();
44 }
3745
3846 template Error readObject(const T *&Dest) {
3947 ArrayRef Buffer;
1616 #include "llvm/DebugInfo/PDB/Raw/ModInfo.h"
1717 #include "llvm/DebugInfo/PDB/Raw/NameHashTable.h"
1818 #include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
19 #include "llvm/DebugInfo/PDB/Raw/RawTypes.h"
1920 #include "llvm/Support/Endian.h"
2021 #include "llvm/Support/Error.h"
2122
2223 namespace llvm {
2324 namespace pdb {
2425 class PDBFile;
26 class ISectionContribVisitor;
2527
2628 class DbiStream {
2729 struct HeaderInfo;
4951
5052 PDB_Machine getMachineType() const;
5153
54 uint32_t getDebugStreamIndex(DbgHeaderType Type) const;
55
5256 ArrayRef modules() const;
5357
54 uint32_t getDebugStreamIndex(DbgHeaderType Type) const;
58 codeview::FixedStreamArray getSectionMap() const;
59 void visitSectionContributions(ISectionContribVisitor &Visitor) const;
5560
5661 private:
62 Error initializeSectionContributionData();
63 Error initializeSectionMapData();
5764 Error initializeFileInfo();
5865
5966 PDBFile &Pdb;
7178
7279 codeview::FixedStreamArray DbgStreams;
7380
81 PdbRaw_DbiSecContribVer SectionContribVersion;
82 codeview::FixedStreamArray SectionContribs;
83 codeview::FixedStreamArray SectionContribs2;
84 codeview::FixedStreamArray SectionMap;
85
7486 const HeaderInfo *Header;
7587 };
7688 }
0 //===- EnumTables.h - Enum to string conversion tables ----------*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #ifndef LLVM_DEBUGINFO_PDB_RAW_ENUMTABLES_H
10 #define LLVM_DEBUGINFO_PDB_RAW_ENUMTABLES_H
11
12 #include "llvm/ADT/ArrayRef.h"
13 #include "llvm/Support/ScopedPrinter.h"
14
15 namespace llvm {
16 namespace pdb {
17 ArrayRef> getOMFSegMapDescFlagNames();
18 }
19 }
20
21 #endif // LLVM_DEBUGINFO_PDB_RAW_ENUMTABLES_H
0 //===- ISectionContribVisitor.h ---------------------------------*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #ifndef LLVM_DEBUGINFO_PDB_RAW_ISECTIONCONTRIBVISITOR_H
10 #define LLVM_DEBUGINFO_PDB_RAW_ISECTIONCONTRIBVISITOR_H
11
12 namespace llvm {
13 namespace pdb {
14 struct SectionContrib;
15 struct SectionContrib2;
16
17 class ISectionContribVisitor {
18 public:
19 virtual ~ISectionContribVisitor() {}
20
21 virtual void visit(const SectionContrib &C) = 0;
22 virtual void visit(const SectionContrib2 &C) = 0;
23 };
24 } // namespace pdb
25 } // namespace llvm
26
27 #endif // LLVM_DEBUGINFO_PDB_RAW_ISECTIONCONTRIBVISITOR_H
1414 #include "llvm/DebugInfo/PDB/PDBTypes.h"
1515 #include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h"
1616 #include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
17 #include "llvm/DebugInfo/PDB/Raw/RawTypes.h"
1718
1819 #include "llvm/Support/Error.h"
1920
None //===- PDBRawConstants.h ----------------------------------------*- C++ -*-===//
0 //===- RawConstants.h -------------------------------------------*- C++ -*-===//
11 //
22 // The LLVM Compiler Infrastructure
33 //
99 #ifndef LLVM_DEBUGINFO_PDB_RAW_PDBRAWCONSTANTS_H
1010 #define LLVM_DEBUGINFO_PDB_RAW_PDBRAWCONSTANTS_H
1111
12 #include "llvm/Support/Endian.h"
12 #include "llvm/DebugInfo/CodeView/CodeView.h"
1313
1414 #include
1515
4545 PdbTpiV80 = 20040203,
4646 };
4747
48 enum PdbRaw_DbiSecContribVer : uint32_t {
49 DbiSecContribVer60 = 0xeffe0000 + 19970605,
50 DbiSecContribV2 = 0xeffe0000 + 20140516
51 };
52
4853 enum SpecialStream : uint32_t {
4954 // Stream 0 contains the copy of previous version of the MSF directory.
5055 // We are not currently using it, but technically if we find the main
7277 Max
7378 };
7479
75 // This struct is defined as "SO" in langapi/include/pdb.h.
76 struct SectionOffset {
77 support::ulittle32_t Off;
78 support::ulittle16_t Isect;
79 char Padding[2];
80 };
81
82 // This is HRFile.
83 struct PSHashRecord {
84 support::ulittle32_t Off; // Offset in the symbol record stream
85 support::ulittle32_t CRef;
80 enum class OMFSegDescFlags : uint16_t {
81 Read = 1 << 0, // Segment is readable.
82 Write = 1 << 1, // Segment is writable.
83 Execute = 1 << 2, // Segment is executable.
84 AddressIs32Bit = 1 << 3, // Descriptor describes a 32-bit linear address.
85 IsSelector = 1 << 8, // Frame represents a selector.
86 IsAbsoluteAddress = 1 << 9, // Frame represents an absolute address.
87 IsGroup = 1 << 10 // If set, descriptor represents a group.
8688 };
8789
8890 } // end namespace pdb
0 //===- RawTypes.h -----------------------------------------------*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #ifndef LLVM_DEBUGINFO_PDB_RAW_RAWTYPES_H
10 #define LLVM_DEBUGINFO_PDB_RAW_RAWTYPES_H
11
12 #include "llvm/Support/Endian.h"
13
14 namespace llvm {
15 namespace pdb {
16 // This struct is defined as "SO" in langapi/include/pdb.h.
17 struct SectionOffset {
18 support::ulittle32_t Off;
19 support::ulittle16_t Isect;
20 char Padding[2];
21 };
22
23 // This is HRFile.
24 struct PSHashRecord {
25 support::ulittle32_t Off; // Offset in the symbol record stream
26 support::ulittle32_t CRef;
27 };
28
29 // This struct is defined as `SC` in include/dbicommon.h
30 struct SectionContrib {
31 support::ulittle16_t ISect;
32 char Padding[2];
33 support::little32_t Off;
34 support::little32_t Size;
35 support::ulittle32_t Characteristics;
36 support::ulittle16_t Imod;
37 char Padding2[2];
38 support::ulittle32_t DataCrc;
39 support::ulittle32_t RelocCrc;
40 };
41
42 // This struct is defined as `SC2` in include/dbicommon.h
43 struct SectionContrib2 {
44 // To guarantee SectionContrib2 is standard layout, we cannot use inheritance.
45 SectionContrib Base;
46 support::ulittle32_t ISectCoff;
47 };
48
49 // This corresponds to the `OMFSegMap` structure.
50 struct SecMapHeader {
51 support::ulittle16_t SecCount; // Number of segment descriptors in table
52 support::ulittle16_t SecCountLog; // Number of logical segment descriptors
53 };
54
55 // This corresponds to the `OMFSegMapDesc` structure. The definition is not
56 // present in the reference implementation, but the layout is derived from
57 // code that accesses the fields.
58 struct SecMapEntry {
59 support::ulittle16_t Flags; // Descriptor flags. See OMFSegDescFlags
60 support::ulittle16_t Ovl; // Logical overlay number.
61 support::ulittle16_t Group; // Group index into descriptor array.
62 support::ulittle16_t Frame;
63 support::ulittle16_t SecName; // Byte index of the segment or group name
64 // in the sstSegName table, or 0xFFFF.
65 support::ulittle16_t ClassName; // Byte index of the class name in the
66 // sstSegName table, or 0xFFFF.
67 support::ulittle32_t Offset; // Byte offset of the logical segment
68 // within the specified physical segment.
69 // If group is set in flags, offset is the
70 // offset of the group.
71 support::ulittle32_t SecByteLength; // Byte count of the segment or group.
72 };
73
74 } // namespace pdb
75 } // namespace llvm
76
77 #endif
0 add_llvm_library(LLVMDebugInfoCodeView
11 ByteStream.cpp
22 CodeViewError.cpp
3 EnumTables.cpp
34 FieldListRecordBuilder.cpp
45 Line.cpp
56 ListRecordBuilder.cpp
0 //===- EnumTables.cpp - Enum to string conversion tables --------*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/DebugInfo/CodeView/EnumTables.h"
10
11 using namespace llvm;
12 using namespace codeview;
13
14 #define CV_ENUM_CLASS_ENT(enum_class, enum) \
15 { #enum, std::underlying_type < enum_class > ::type(enum_class::enum) }
16
17 #define CV_ENUM_ENT(ns, enum) \
18 { #enum, ns::enum }
19
20 static const EnumEntry SymbolTypeNames[] = {
21 #define CV_SYMBOL(enum, val) {#enum, enum},
22 #include "llvm/DebugInfo/CodeView/CVSymbolTypes.def"
23 #undef CV_SYMBOL
24 };
25
26 static const EnumEntry RegisterNames[] = {
27 CV_ENUM_CLASS_ENT(RegisterId, Unknown),
28 CV_ENUM_CLASS_ENT(RegisterId, VFrame),
29 CV_ENUM_CLASS_ENT(RegisterId, AL),
30 CV_ENUM_CLASS_ENT(RegisterId, CL),
31 CV_ENUM_CLASS_ENT(RegisterId, DL),
32 CV_ENUM_CLASS_ENT(RegisterId, BL),
33 CV_ENUM_CLASS_ENT(RegisterId, AH),
34 CV_ENUM_CLASS_ENT(RegisterId, CH),
35 CV_ENUM_CLASS_ENT(RegisterId, DH),
36 CV_ENUM_CLASS_ENT(RegisterId, BH),
37 CV_ENUM_CLASS_ENT(RegisterId, AX),
38 CV_ENUM_CLASS_ENT(RegisterId, CX),
39 CV_ENUM_CLASS_ENT(RegisterId, DX),
40 CV_ENUM_CLASS_ENT(RegisterId, BX),
41 CV_ENUM_CLASS_ENT(RegisterId, SP),
42 CV_ENUM_CLASS_ENT(RegisterId, BP),
43 CV_ENUM_CLASS_ENT(RegisterId, SI),
44 CV_ENUM_CLASS_ENT(RegisterId, DI),
45 CV_ENUM_CLASS_ENT(RegisterId, EAX),
46 CV_ENUM_CLASS_ENT(RegisterId, ECX),
47 CV_ENUM_CLASS_ENT(RegisterId, EDX),
48 CV_ENUM_CLASS_ENT(RegisterId, EBX),
49 CV_ENUM_CLASS_ENT(RegisterId, ESP),
50 CV_ENUM_CLASS_ENT(RegisterId, EBP),
51 CV_ENUM_CLASS_ENT(RegisterId, ESI),
52 CV_ENUM_CLASS_ENT(RegisterId, EDI),
53 CV_ENUM_CLASS_ENT(RegisterId, ES),
54 CV_ENUM_CLASS_ENT(RegisterId, CS),
55 CV_ENUM_CLASS_ENT(RegisterId, SS),
56 CV_ENUM_CLASS_ENT(RegisterId, DS),
57 CV_ENUM_CLASS_ENT(RegisterId, FS),
58 CV_ENUM_CLASS_ENT(RegisterId, GS),
59 CV_ENUM_CLASS_ENT(RegisterId, IP),
60 CV_ENUM_CLASS_ENT(RegisterId, RAX),
61 CV_ENUM_CLASS_ENT(RegisterId, RBX),
62 CV_ENUM_CLASS_ENT(RegisterId, RCX),
63 CV_ENUM_CLASS_ENT(RegisterId, RDX),
64 CV_ENUM_CLASS_ENT(RegisterId, RSI),
65 CV_ENUM_CLASS_ENT(RegisterId, RDI),
66 CV_ENUM_CLASS_ENT(RegisterId, RBP),
67 CV_ENUM_CLASS_ENT(RegisterId, RSP),
68 CV_ENUM_CLASS_ENT(RegisterId, R8),
69 CV_ENUM_CLASS_ENT(RegisterId, R9),
70 CV_ENUM_CLASS_ENT(RegisterId, R10),
71 CV_ENUM_CLASS_ENT(RegisterId, R11),
72 CV_ENUM_CLASS_ENT(RegisterId, R12),
73 CV_ENUM_CLASS_ENT(RegisterId, R13),
74 CV_ENUM_CLASS_ENT(RegisterId, R14),
75 CV_ENUM_CLASS_ENT(RegisterId, R15),
76 };
77
78 static const EnumEntry ProcSymFlagNames[] = {
79 CV_ENUM_CLASS_ENT(ProcSymFlags, HasFP),
80 CV_ENUM_CLASS_ENT(ProcSymFlags, HasIRET),
81 CV_ENUM_CLASS_ENT(ProcSymFlags, HasFRET),
82 CV_ENUM_CLASS_ENT(ProcSymFlags, IsNoReturn),
83 CV_ENUM_CLASS_ENT(ProcSymFlags, IsUnreachable),
84 CV_ENUM_CLASS_ENT(ProcSymFlags, HasCustomCallingConv),
85 CV_ENUM_CLASS_ENT(ProcSymFlags, IsNoInline),
86 CV_ENUM_CLASS_ENT(ProcSymFlags, HasOptimizedDebugInfo),
87 };
88
89 static const EnumEntry LocalFlags[] = {
90 CV_ENUM_CLASS_ENT(LocalSymFlags, IsParameter),
91 CV_ENUM_CLASS_ENT(LocalSymFlags, IsAddressTaken),
92 CV_ENUM_CLASS_ENT(LocalSymFlags, IsCompilerGenerated),
93 CV_ENUM_CLASS_ENT(LocalSymFlags, IsAggregate),
94 CV_ENUM_CLASS_ENT(LocalSymFlags, IsAggregated),
95 CV_ENUM_CLASS_ENT(LocalSymFlags, IsAliased),
96 CV_ENUM_CLASS_ENT(LocalSymFlags, IsAlias),
97 CV_ENUM_CLASS_ENT(LocalSymFlags, IsReturnValue),
98 CV_ENUM_CLASS_ENT(LocalSymFlags, IsOptimizedOut),
99 CV_ENUM_CLASS_ENT(LocalSymFlags, IsEnregisteredGlobal),
100 CV_ENUM_CLASS_ENT(LocalSymFlags, IsEnregisteredStatic),
101 };
102
103 static const EnumEntry FrameCookieKinds[] = {
104 CV_ENUM_CLASS_ENT(FrameCookieKind, Copy),
105 CV_ENUM_CLASS_ENT(FrameCookieKind, XorStackPointer),
106 CV_ENUM_CLASS_ENT(FrameCookieKind, XorFramePointer),
107 CV_ENUM_CLASS_ENT(FrameCookieKind, XorR13),
108 };
109
110 static const EnumEntry SourceLanguages[] = {
111 CV_ENUM_ENT(SourceLanguage, C), CV_ENUM_ENT(SourceLanguage, Cpp),
112 CV_ENUM_ENT(SourceLanguage, Fortran), CV_ENUM_ENT(SourceLanguage, Masm),
113 CV_ENUM_ENT(SourceLanguage, Pascal), CV_ENUM_ENT(SourceLanguage, Basic),
114 CV_ENUM_ENT(SourceLanguage, Cobol), CV_ENUM_ENT(SourceLanguage, Link),
115 CV_ENUM_ENT(SourceLanguage, Cvtres), CV_ENUM_ENT(SourceLanguage, Cvtpgd),
116 CV_ENUM_ENT(SourceLanguage, CSharp), CV_ENUM_ENT(SourceLanguage, VB),
117 CV_ENUM_ENT(SourceLanguage, ILAsm), CV_ENUM_ENT(SourceLanguage, Java),
118 CV_ENUM_ENT(SourceLanguage, JScript), CV_ENUM_ENT(SourceLanguage, MSIL),
119 CV_ENUM_ENT(SourceLanguage, HLSL),
120 };
121
122 static const EnumEntry CompileSym2FlagNames[] = {
123 CV_ENUM_CLASS_ENT(CompileSym2Flags, EC),
124 CV_ENUM_CLASS_ENT(CompileSym2Flags, NoDbgInfo),
125 CV_ENUM_CLASS_ENT(CompileSym2Flags, LTCG),
126 CV_ENUM_CLASS_ENT(CompileSym2Flags, NoDataAlign),
127 CV_ENUM_CLASS_ENT(CompileSym2Flags, ManagedPresent),
128 CV_ENUM_CLASS_ENT(CompileSym2Flags, SecurityChecks),
129 CV_ENUM_CLASS_ENT(CompileSym2Flags, HotPatch),
130 CV_ENUM_CLASS_ENT(CompileSym2Flags, CVTCIL),
131 CV_ENUM_CLASS_ENT(CompileSym2Flags, MSILModule),
132 };
133
134 static const EnumEntry CompileSym3FlagNames[] = {
135 CV_ENUM_CLASS_ENT(CompileSym3Flags, EC),
136 CV_ENUM_CLASS_ENT(CompileSym3Flags, NoDbgInfo),
137 CV_ENUM_CLASS_ENT(CompileSym3Flags, LTCG),
138 CV_ENUM_CLASS_ENT(CompileSym3Flags, NoDataAlign),
139 CV_ENUM_CLASS_ENT(CompileSym3Flags, ManagedPresent),
140 CV_ENUM_CLASS_ENT(CompileSym3Flags, SecurityChecks),
141 CV_ENUM_CLASS_ENT(CompileSym3Flags, HotPatch),
142 CV_ENUM_CLASS_ENT(CompileSym3Flags, CVTCIL),
143 CV_ENUM_CLASS_ENT(CompileSym3Flags, MSILModule),
144 CV_ENUM_CLASS_ENT(CompileSym3Flags, Sdl),
145 CV_ENUM_CLASS_ENT(CompileSym3Flags, PGO),
146 CV_ENUM_CLASS_ENT(CompileSym3Flags, Exp),
147 };
148
149 static const EnumEntry CPUTypeNames[] = {
150 CV_ENUM_CLASS_ENT(CPUType, Intel8080),
151 CV_ENUM_CLASS_ENT(CPUType, Intel8086),
152 CV_ENUM_CLASS_ENT(CPUType, Intel80286),
153 CV_ENUM_CLASS_ENT(CPUType, Intel80386),
154 CV_ENUM_CLASS_ENT(CPUType, Intel80486),
155 CV_ENUM_CLASS_ENT(CPUType, Pentium),
156 CV_ENUM_CLASS_ENT(CPUType, PentiumPro),
157 CV_ENUM_CLASS_ENT(CPUType, Pentium3),
158 CV_ENUM_CLASS_ENT(CPUType, MIPS),
159 CV_ENUM_CLASS_ENT(CPUType, MIPS16),
160 CV_ENUM_CLASS_ENT(CPUType, MIPS32),
161 CV_ENUM_CLASS_ENT(CPUType, MIPS64),
162 CV_ENUM_CLASS_ENT(CPUType, MIPSI),
163 CV_ENUM_CLASS_ENT(CPUType, MIPSII),
164 CV_ENUM_CLASS_ENT(CPUType, MIPSIII),
165 CV_ENUM_CLASS_ENT(CPUType, MIPSIV),
166 CV_ENUM_CLASS_ENT(CPUType, MIPSV),
167 CV_ENUM_CLASS_ENT(CPUType, M68000),
168 CV_ENUM_CLASS_ENT(CPUType, M68010),
169 CV_ENUM_CLASS_ENT(CPUType, M68020),
170 CV_ENUM_CLASS_ENT(CPUType, M68030),
171 CV_ENUM_CLASS_ENT(CPUType, M68040),
172 CV_ENUM_CLASS_ENT(CPUType, Alpha),
173 CV_ENUM_CLASS_ENT(CPUType, Alpha21164),
174 CV_ENUM_CLASS_ENT(CPUType, Alpha21164A),
175 CV_ENUM_CLASS_ENT(CPUType, Alpha21264),
176 CV_ENUM_CLASS_ENT(CPUType, Alpha21364),
177 CV_ENUM_CLASS_ENT(CPUType, PPC601),
178 CV_ENUM_CLASS_ENT(CPUType, PPC603),
179 CV_ENUM_CLASS_ENT(CPUType, PPC604),
180 CV_ENUM_CLASS_ENT(CPUType, PPC620),
181 CV_ENUM_CLASS_ENT(CPUType, PPCFP),
182 CV_ENUM_CLASS_ENT(CPUType, PPCBE),
183 CV_ENUM_CLASS_ENT(CPUType, SH3),
184 CV_ENUM_CLASS_ENT(CPUType, SH3E),
185 CV_ENUM_CLASS_ENT(CPUType, SH3DSP),
186 CV_ENUM_CLASS_ENT(CPUType, SH4),
187 CV_ENUM_CLASS_ENT(CPUType, SHMedia),
188 CV_ENUM_CLASS_ENT(CPUType, ARM3),
189 CV_ENUM_CLASS_ENT(CPUType, ARM4),
190 CV_ENUM_CLASS_ENT(CPUType, ARM4T),
191 CV_ENUM_CLASS_ENT(CPUType, ARM5),
192 CV_ENUM_CLASS_ENT(CPUType, ARM5T),
193 CV_ENUM_CLASS_ENT(CPUType, ARM6),
194 CV_ENUM_CLASS_ENT(CPUType, ARM_XMAC),
195 CV_ENUM_CLASS_ENT(CPUType, ARM_WMMX),
196 CV_ENUM_CLASS_ENT(CPUType, ARM7),
197 CV_ENUM_CLASS_ENT(CPUType, Omni),
198 CV_ENUM_CLASS_ENT(CPUType, Ia64),
199 CV_ENUM_CLASS_ENT(CPUType, Ia64_2),
200 CV_ENUM_CLASS_ENT(CPUType, CEE),
201 CV_ENUM_CLASS_ENT(CPUType, AM33),
202 CV_ENUM_CLASS_ENT(CPUType, M32R),
203 CV_ENUM_CLASS_ENT(CPUType, TriCore),
204 CV_ENUM_CLASS_ENT(CPUType, X64),
205 CV_ENUM_CLASS_ENT(CPUType, EBC),
206 CV_ENUM_CLASS_ENT(CPUType, Thumb),
207 CV_ENUM_CLASS_ENT(CPUType, ARMNT),
208 CV_ENUM_CLASS_ENT(CPUType, D3D11_Shader),
209 };
210
211 static const EnumEntry FrameProcSymFlagNames[] = {
212 CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasAlloca),
213 CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasSetJmp),
214 CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasLongJmp),
215 CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasInlineAssembly),
216 CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasExceptionHandling),
217 CV_ENUM_CLASS_ENT(FrameProcedureOptions, MarkedInline),
218 CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasStructuredExceptionHandling),
219 CV_ENUM_CLASS_ENT(FrameProcedureOptions, Naked),
220 CV_ENUM_CLASS_ENT(FrameProcedureOptions, SecurityChecks),
221 CV_ENUM_CLASS_ENT(FrameProcedureOptions, AsynchronousExceptionHandling),
222 CV_ENUM_CLASS_ENT(FrameProcedureOptions, NoStackOrderingForSecurityChecks),
223 CV_ENUM_CLASS_ENT(FrameProcedureOptions, Inlined),
224 CV_ENUM_CLASS_ENT(FrameProcedureOptions, StrictSecurityChecks),
225 CV_ENUM_CLASS_ENT(FrameProcedureOptions, SafeBuffers),
226 CV_ENUM_CLASS_ENT(FrameProcedureOptions, ProfileGuidedOptimization),
227 CV_ENUM_CLASS_ENT(FrameProcedureOptions, ValidProfileCounts),
228 CV_ENUM_CLASS_ENT(FrameProcedureOptions, OptimizedForSpeed),
229 CV_ENUM_CLASS_ENT(FrameProcedureOptions, GuardCfg),
230 CV_ENUM_CLASS_ENT(FrameProcedureOptions, GuardCfw),
231 };
232
233 static const EnumEntry ExportSymFlagNames[] = {
234 CV_ENUM_CLASS_ENT(ExportFlags, IsConstant),
235 CV_ENUM_CLASS_ENT(ExportFlags, IsData),
236 CV_ENUM_CLASS_ENT(ExportFlags, IsPrivate),
237 CV_ENUM_CLASS_ENT(ExportFlags, HasNoName),
238 CV_ENUM_CLASS_ENT(ExportFlags, HasExplicitOrdinal),
239 CV_ENUM_CLASS_ENT(ExportFlags, IsForwarder),
240 };
241
242 static const EnumEntry ThunkOrdinalNames[] = {
243 CV_ENUM_CLASS_ENT(ThunkOrdinal, Standard),
244 CV_ENUM_CLASS_ENT(ThunkOrdinal, ThisAdjustor),
245 CV_ENUM_CLASS_ENT(ThunkOrdinal, Vcall),
246 CV_ENUM_CLASS_ENT(ThunkOrdinal, Pcode),
247 CV_ENUM_CLASS_ENT(ThunkOrdinal, UnknownLoad),
248 CV_ENUM_CLASS_ENT(ThunkOrdinal, TrampIncremental),
249 CV_ENUM_CLASS_ENT(ThunkOrdinal, BranchIsland),
250 };
251
252 static const EnumEntry TrampolineNames[] = {
253 CV_ENUM_CLASS_ENT(TrampolineType, TrampIncremental),
254 CV_ENUM_CLASS_ENT(TrampolineType, BranchIsland),
255 };
256
257 static const EnumEntry
258 ImageSectionCharacteristicNames[] = {
259 CV_ENUM_ENT(COFF, IMAGE_SCN_TYPE_NOLOAD),
260 CV_ENUM_ENT(COFF, IMAGE_SCN_TYPE_NO_PAD),
261 CV_ENUM_ENT(COFF, IMAGE_SCN_CNT_CODE),
262 CV_ENUM_ENT(COFF, IMAGE_SCN_CNT_INITIALIZED_DATA),
263 CV_ENUM_ENT(COFF, IMAGE_SCN_CNT_UNINITIALIZED_DATA),
264 CV_ENUM_ENT(COFF, IMAGE_SCN_LNK_OTHER),
265 CV_ENUM_ENT(COFF, IMAGE_SCN_LNK_INFO),
266 CV_ENUM_ENT(COFF, IMAGE_SCN_LNK_REMOVE),
267 CV_ENUM_ENT(COFF, IMAGE_SCN_LNK_COMDAT),
268 CV_ENUM_ENT(COFF, IMAGE_SCN_GPREL),
269 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_PURGEABLE),
270 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_16BIT),
271 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_LOCKED),
272 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_PRELOAD),
273 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_1BYTES),
274 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_2BYTES),
275 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_4BYTES),
276 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_8BYTES),
277 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_16BYTES),
278 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_32BYTES),
279 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_64BYTES),
280 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_128BYTES),
281 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_256BYTES),
282 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_512BYTES),
283 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_1024BYTES),
284 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_2048BYTES),
285 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_4096BYTES),
286 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_8192BYTES),
287 CV_ENUM_ENT(COFF, IMAGE_SCN_LNK_NRELOC_OVFL),
288 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_DISCARDABLE),
289 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_NOT_CACHED),
290 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_NOT_PAGED),
291 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_SHARED),
292 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_EXECUTE),
293 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_READ),
294 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_WRITE)};
295
296 namespace llvm {
297 namespace codeview {
298 ArrayRef> getSymbolTypeNames() {
299 return makeArrayRef(SymbolTypeNames);
300 }
301
302 ArrayRef> getRegisterNames() {
303 return makeArrayRef(RegisterNames);
304 }
305
306 ArrayRef> getProcSymFlagNames() {
307 return makeArrayRef(ProcSymFlagNames);
308 }
309 ArrayRef> getLocalFlagNames() {
310 return makeArrayRef(LocalFlags);
311 }
312 ArrayRef> getFrameCookieKindNames() {
313 return makeArrayRef(FrameCookieKinds);
314 }
315 ArrayRef> getSourceLanguageNames() {
316 return makeArrayRef(SourceLanguages);
317 }
318 ArrayRef> getCompileSym2FlagNames() {
319 return makeArrayRef(CompileSym2FlagNames);
320 }
321 ArrayRef> getCompileSym3FlagNames() {
322 return makeArrayRef(CompileSym3FlagNames);
323 }
324 ArrayRef> getCPUTypeNames() {
325 return makeArrayRef(CPUTypeNames);
326 }
327 ArrayRef> getFrameProcSymFlagNames() {
328 return makeArrayRef(FrameProcSymFlagNames);
329 }
330 ArrayRef> getExportSymFlagNames() {
331 return makeArrayRef(ExportSymFlagNames);
332 }
333 ArrayRef> getThunkOrdinalNames() {
334 return makeArrayRef(ThunkOrdinalNames);
335 }
336 ArrayRef> getTrampolineNames() {
337 return makeArrayRef(TrampolineNames);
338 }
339 ArrayRef>
340 getImageSectionCharacteristicNames() {
341 return makeArrayRef(ImageSectionCharacteristicNames);
342 }
343 }
344 }
1010 #include "llvm/ADT/DenseMap.h"
1111 #include "llvm/ADT/SmallString.h"
1212 #include "llvm/DebugInfo/CodeView/CVSymbolVisitor.h"
13 #include "llvm/DebugInfo/CodeView/EnumTables.h"
1314 #include "llvm/DebugInfo/CodeView/SymbolDumpDelegate.h"
1415 #include "llvm/DebugInfo/CodeView/SymbolRecord.h"
1516 #include "llvm/DebugInfo/CodeView/TypeDumper.h"
2122 using namespace llvm;
2223 using namespace llvm::codeview;
2324
24 static const EnumEntry SymbolTypeNames[] = {
25 #define CV_SYMBOL(enum, val) {#enum, enum},
26 #include "llvm/DebugInfo/CodeView/CVSymbolTypes.def"
27 };
28
2925 namespace {
30 #define CV_ENUM_CLASS_ENT(enum_class, enum) \
31 { #enum, std::underlying_type < enum_class > ::type(enum_class::enum) }
32
33 #define CV_ENUM_ENT(ns, enum) \
34 { #enum, ns::enum }
35
36 static const EnumEntry RegisterNames[] = {
37 CV_ENUM_CLASS_ENT(RegisterId, Unknown),
38 CV_ENUM_CLASS_ENT(RegisterId, VFrame),
39 CV_ENUM_CLASS_ENT(RegisterId, AL),
40 CV_ENUM_CLASS_ENT(RegisterId, CL),
41 CV_ENUM_CLASS_ENT(RegisterId, DL),
42 CV_ENUM_CLASS_ENT(RegisterId, BL),
43 CV_ENUM_CLASS_ENT(RegisterId, AH),
44 CV_ENUM_CLASS_ENT(RegisterId, CH),
45 CV_ENUM_CLASS_ENT(RegisterId, DH),
46 CV_ENUM_CLASS_ENT(RegisterId, BH),
47 CV_ENUM_CLASS_ENT(RegisterId, AX),
48 CV_ENUM_CLASS_ENT(RegisterId, CX),
49 CV_ENUM_CLASS_ENT(RegisterId, DX),
50 CV_ENUM_CLASS_ENT(RegisterId, BX),
51 CV_ENUM_CLASS_ENT(RegisterId, SP),
52 CV_ENUM_CLASS_ENT(RegisterId, BP),
53 CV_ENUM_CLASS_ENT(RegisterId, SI),
54 CV_ENUM_CLASS_ENT(RegisterId, DI),
55 CV_ENUM_CLASS_ENT(RegisterId, EAX),
56 CV_ENUM_CLASS_ENT(RegisterId, ECX),
57 CV_ENUM_CLASS_ENT(RegisterId, EDX),
58 CV_ENUM_CLASS_ENT(RegisterId, EBX),
59 CV_ENUM_CLASS_ENT(RegisterId, ESP),
60 CV_ENUM_CLASS_ENT(RegisterId, EBP),
61 CV_ENUM_CLASS_ENT(RegisterId, ESI),
62 CV_ENUM_CLASS_ENT(RegisterId, EDI),
63 CV_ENUM_CLASS_ENT(RegisterId, ES),
64 CV_ENUM_CLASS_ENT(RegisterId, CS),
65 CV_ENUM_CLASS_ENT(RegisterId, SS),
66 CV_ENUM_CLASS_ENT(RegisterId, DS),
67 CV_ENUM_CLASS_ENT(RegisterId, FS),
68 CV_ENUM_CLASS_ENT(RegisterId, GS),
69 CV_ENUM_CLASS_ENT(RegisterId, IP),
70 CV_ENUM_CLASS_ENT(RegisterId, RAX),
71 CV_ENUM_CLASS_ENT(RegisterId, RBX),
72 CV_ENUM_CLASS_ENT(RegisterId, RCX),
73 CV_ENUM_CLASS_ENT(RegisterId, RDX),
74 CV_ENUM_CLASS_ENT(RegisterId, RSI),
75 CV_ENUM_CLASS_ENT(RegisterId, RDI),
76 CV_ENUM_CLASS_ENT(RegisterId, RBP),
77 CV_ENUM_CLASS_ENT(RegisterId, RSP),
78 CV_ENUM_CLASS_ENT(RegisterId, R8),
79 CV_ENUM_CLASS_ENT(RegisterId, R9),
80 CV_ENUM_CLASS_ENT(RegisterId, R10),
81 CV_ENUM_CLASS_ENT(RegisterId, R11),
82 CV_ENUM_CLASS_ENT(RegisterId, R12),
83 CV_ENUM_CLASS_ENT(RegisterId, R13),
84 CV_ENUM_CLASS_ENT(RegisterId, R14),
85 CV_ENUM_CLASS_ENT(RegisterId, R15),
86 };
87
88 static const EnumEntry ProcSymFlagNames[] = {
89 CV_ENUM_CLASS_ENT(ProcSymFlags, HasFP),
90 CV_ENUM_CLASS_ENT(ProcSymFlags, HasIRET),
91 CV_ENUM_CLASS_ENT(ProcSymFlags, HasFRET),
92 CV_ENUM_CLASS_ENT(ProcSymFlags, IsNoReturn),
93 CV_ENUM_CLASS_ENT(ProcSymFlags, IsUnreachable),
94 CV_ENUM_CLASS_ENT(ProcSymFlags, HasCustomCallingConv),
95 CV_ENUM_CLASS_ENT(ProcSymFlags, IsNoInline),
96 CV_ENUM_CLASS_ENT(ProcSymFlags, HasOptimizedDebugInfo),
97 };
98
99 static const EnumEntry LocalFlags[] = {
100 CV_ENUM_CLASS_ENT(LocalSymFlags, IsParameter),
101 CV_ENUM_CLASS_ENT(LocalSymFlags, IsAddressTaken),
102 CV_ENUM_CLASS_ENT(LocalSymFlags, IsCompilerGenerated),
103 CV_ENUM_CLASS_ENT(LocalSymFlags, IsAggregate),
104 CV_ENUM_CLASS_ENT(LocalSymFlags, IsAggregated),
105 CV_ENUM_CLASS_ENT(LocalSymFlags, IsAliased),
106 CV_ENUM_CLASS_ENT(LocalSymFlags, IsAlias),
107 CV_ENUM_CLASS_ENT(LocalSymFlags, IsReturnValue),
108 CV_ENUM_CLASS_ENT(LocalSymFlags, IsOptimizedOut),
109 CV_ENUM_CLASS_ENT(LocalSymFlags, IsEnregisteredGlobal),
110 CV_ENUM_CLASS_ENT(LocalSymFlags, IsEnregisteredStatic),
111 };
112
113 static const EnumEntry FrameCookieKinds[] = {
114 CV_ENUM_CLASS_ENT(FrameCookieKind, Copy),
115 CV_ENUM_CLASS_ENT(FrameCookieKind, XorStackPointer),
116 CV_ENUM_CLASS_ENT(FrameCookieKind, XorFramePointer),
117 CV_ENUM_CLASS_ENT(FrameCookieKind, XorR13),
118 };
119
120 static const EnumEntry SourceLanguages[] = {
121 CV_ENUM_ENT(SourceLanguage, C), CV_ENUM_ENT(SourceLanguage, Cpp),
122 CV_ENUM_ENT(SourceLanguage, Fortran), CV_ENUM_ENT(SourceLanguage, Masm),
123 CV_ENUM_ENT(SourceLanguage, Pascal), CV_ENUM_ENT(SourceLanguage, Basic),
124 CV_ENUM_ENT(SourceLanguage, Cobol), CV_ENUM_ENT(SourceLanguage, Link),
125 CV_ENUM_ENT(SourceLanguage, Cvtres), CV_ENUM_ENT(SourceLanguage, Cvtpgd),
126 CV_ENUM_ENT(SourceLanguage, CSharp), CV_ENUM_ENT(SourceLanguage, VB),
127 CV_ENUM_ENT(SourceLanguage, ILAsm), CV_ENUM_ENT(SourceLanguage, Java),
128 CV_ENUM_ENT(SourceLanguage, JScript), CV_ENUM_ENT(SourceLanguage, MSIL),
129 CV_ENUM_ENT(SourceLanguage, HLSL),
130 };
131
132 static const EnumEntry CompileSym2FlagNames[] = {
133 CV_ENUM_CLASS_ENT(CompileSym2Flags, EC),
134 CV_ENUM_CLASS_ENT(CompileSym2Flags, NoDbgInfo),
135 CV_ENUM_CLASS_ENT(CompileSym2Flags, LTCG),
136 CV_ENUM_CLASS_ENT(CompileSym2Flags, NoDataAlign),
137 CV_ENUM_CLASS_ENT(CompileSym2Flags, ManagedPresent),
138 CV_ENUM_CLASS_ENT(CompileSym2Flags, SecurityChecks),
139 CV_ENUM_CLASS_ENT(CompileSym2Flags, HotPatch),
140 CV_ENUM_CLASS_ENT(CompileSym2Flags, CVTCIL),
141 CV_ENUM_CLASS_ENT(CompileSym2Flags, MSILModule),
142 };
143
144 static const EnumEntry CompileSym3FlagNames[] = {
145 CV_ENUM_CLASS_ENT(CompileSym3Flags, EC),
146 CV_ENUM_CLASS_ENT(CompileSym3Flags, NoDbgInfo),
147 CV_ENUM_CLASS_ENT(CompileSym3Flags, LTCG),
148 CV_ENUM_CLASS_ENT(CompileSym3Flags, NoDataAlign),
149 CV_ENUM_CLASS_ENT(CompileSym3Flags, ManagedPresent),
150 CV_ENUM_CLASS_ENT(CompileSym3Flags, SecurityChecks),
151 CV_ENUM_CLASS_ENT(CompileSym3Flags, HotPatch),
152 CV_ENUM_CLASS_ENT(CompileSym3Flags, CVTCIL),
153 CV_ENUM_CLASS_ENT(CompileSym3Flags, MSILModule),
154 CV_ENUM_CLASS_ENT(CompileSym3Flags, Sdl),
155 CV_ENUM_CLASS_ENT(CompileSym3Flags, PGO),
156 CV_ENUM_CLASS_ENT(CompileSym3Flags, Exp),
157 };
158
159 static const EnumEntry CPUTypeNames[] = {
160 CV_ENUM_CLASS_ENT(CPUType, Intel8080),
161 CV_ENUM_CLASS_ENT(CPUType, Intel8086),
162 CV_ENUM_CLASS_ENT(CPUType, Intel80286),
163 CV_ENUM_CLASS_ENT(CPUType, Intel80386),
164 CV_ENUM_CLASS_ENT(CPUType, Intel80486),
165 CV_ENUM_CLASS_ENT(CPUType, Pentium),
166 CV_ENUM_CLASS_ENT(CPUType, PentiumPro),
167 CV_ENUM_CLASS_ENT(CPUType, Pentium3),
168 CV_ENUM_CLASS_ENT(CPUType, MIPS),
169 CV_ENUM_CLASS_ENT(CPUType, MIPS16),
170 CV_ENUM_CLASS_ENT(CPUType, MIPS32),
171 CV_ENUM_CLASS_ENT(CPUType, MIPS64),
172 CV_ENUM_CLASS_ENT(CPUType, MIPSI),
173 CV_ENUM_CLASS_ENT(CPUType, MIPSII),
174 CV_ENUM_CLASS_ENT(CPUType, MIPSIII),
175 CV_ENUM_CLASS_ENT(CPUType, MIPSIV),
176 CV_ENUM_CLASS_ENT(CPUType, MIPSV),
177 CV_ENUM_CLASS_ENT(CPUType, M68000),
178 CV_ENUM_CLASS_ENT(CPUType, M68010),
179 CV_ENUM_CLASS_ENT(CPUType, M68020),
180 CV_ENUM_CLASS_ENT(CPUType, M68030),
181 CV_ENUM_CLASS_ENT(CPUType, M68040),
182 CV_ENUM_CLASS_ENT(CPUType, Alpha),
183 CV_ENUM_CLASS_ENT(CPUType, Alpha21164),
184 CV_ENUM_CLASS_ENT(CPUType, Alpha21164A),
185 CV_ENUM_CLASS_ENT(CPUType, Alpha21264),
186 CV_ENUM_CLASS_ENT(CPUType, Alpha21364),
187 CV_ENUM_CLASS_ENT(CPUType, PPC601),
188 CV_ENUM_CLASS_ENT(CPUType, PPC603),
189 CV_ENUM_CLASS_ENT(CPUType, PPC604),
190 CV_ENUM_CLASS_ENT(CPUType, PPC620),
191 CV_ENUM_CLASS_ENT(CPUType, PPCFP),
192 CV_ENUM_CLASS_ENT(CPUType, PPCBE),
193 CV_ENUM_CLASS_ENT(CPUType, SH3),
194 CV_ENUM_CLASS_ENT(CPUType, SH3E),
195 CV_ENUM_CLASS_ENT(CPUType, SH3DSP),
196 CV_ENUM_CLASS_ENT(CPUType, SH4),
197 CV_ENUM_CLASS_ENT(CPUType, SHMedia),
198 CV_ENUM_CLASS_ENT(CPUType, ARM3),
199 CV_ENUM_CLASS_ENT(CPUType, ARM4),
200 CV_ENUM_CLASS_ENT(CPUType, ARM4T),
201 CV_ENUM_CLASS_ENT(CPUType, ARM5),
202 CV_ENUM_CLASS_ENT(CPUType, ARM5T),
203 CV_ENUM_CLASS_ENT(CPUType, ARM6),
204 CV_ENUM_CLASS_ENT(CPUType, ARM_XMAC),
205 CV_ENUM_CLASS_ENT(CPUType, ARM_WMMX),
206 CV_ENUM_CLASS_ENT(CPUType, ARM7),
207 CV_ENUM_CLASS_ENT(CPUType, Omni),
208 CV_ENUM_CLASS_ENT(CPUType, Ia64),
209 CV_ENUM_CLASS_ENT(CPUType, Ia64_2),
210 CV_ENUM_CLASS_ENT(CPUType, CEE),
211 CV_ENUM_CLASS_ENT(CPUType, AM33),
212 CV_ENUM_CLASS_ENT(CPUType, M32R),
213 CV_ENUM_CLASS_ENT(CPUType, TriCore),
214 CV_ENUM_CLASS_ENT(CPUType, X64),
215 CV_ENUM_CLASS_ENT(CPUType, EBC),
216 CV_ENUM_CLASS_ENT(CPUType, Thumb),
217 CV_ENUM_CLASS_ENT(CPUType, ARMNT),
218 CV_ENUM_CLASS_ENT(CPUType, D3D11_Shader),
219 };
220
221 static const EnumEntry FrameProcSymFlags[] = {
222 CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasAlloca),
223 CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasSetJmp),
224 CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasLongJmp),
225 CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasInlineAssembly),
226 CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasExceptionHandling),
227 CV_ENUM_CLASS_ENT(FrameProcedureOptions, MarkedInline),
228 CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasStructuredExceptionHandling),
229 CV_ENUM_CLASS_ENT(FrameProcedureOptions, Naked),
230 CV_ENUM_CLASS_ENT(FrameProcedureOptions, SecurityChecks),
231 CV_ENUM_CLASS_ENT(FrameProcedureOptions, AsynchronousExceptionHandling),
232 CV_ENUM_CLASS_ENT(FrameProcedureOptions, NoStackOrderingForSecurityChecks),
233 CV_ENUM_CLASS_ENT(FrameProcedureOptions, Inlined),
234 CV_ENUM_CLASS_ENT(FrameProcedureOptions, StrictSecurityChecks),
235 CV_ENUM_CLASS_ENT(FrameProcedureOptions, SafeBuffers),
236 CV_ENUM_CLASS_ENT(FrameProcedureOptions, ProfileGuidedOptimization),
237 CV_ENUM_CLASS_ENT(FrameProcedureOptions, ValidProfileCounts),
238 CV_ENUM_CLASS_ENT(FrameProcedureOptions, OptimizedForSpeed),
239 CV_ENUM_CLASS_ENT(FrameProcedureOptions, GuardCfg),
240 CV_ENUM_CLASS_ENT(FrameProcedureOptions, GuardCfw),
241 };
242
243 static const EnumEntry ExportSymFlags[] = {
244 CV_ENUM_CLASS_ENT(ExportFlags, IsConstant),
245 CV_ENUM_CLASS_ENT(ExportFlags, IsData),
246 CV_ENUM_CLASS_ENT(ExportFlags, IsPrivate),
247 CV_ENUM_CLASS_ENT(ExportFlags, HasNoName),
248 CV_ENUM_CLASS_ENT(ExportFlags, HasExplicitOrdinal),
249 CV_ENUM_CLASS_ENT(ExportFlags, IsForwarder),
250 };
251
252 static const EnumEntry ThunkOrdinalNames[] = {
253 CV_ENUM_CLASS_ENT(ThunkOrdinal, Standard),
254 CV_ENUM_CLASS_ENT(ThunkOrdinal, ThisAdjustor),
255 CV_ENUM_CLASS_ENT(ThunkOrdinal, Vcall),
256 CV_ENUM_CLASS_ENT(ThunkOrdinal, Pcode),
257 CV_ENUM_CLASS_ENT(ThunkOrdinal, UnknownLoad),
258 CV_ENUM_CLASS_ENT(ThunkOrdinal, TrampIncremental),
259 CV_ENUM_CLASS_ENT(ThunkOrdinal, BranchIsland),
260 };
261
262 static const EnumEntry TrampolineNames[] = {
263 CV_ENUM_CLASS_ENT(TrampolineType, TrampIncremental),
264 CV_ENUM_CLASS_ENT(TrampolineType, BranchIsland),
265 };
266
26726 /// Use this private dumper implementation to keep implementation details about
26827 /// the visitor out of SymbolDumper.h.
26928 class CVSymbolDumperImpl : public CVSymbolVisitor {
349108 W.printNumber("Off", Thunk.Header.Off);
350109 W.printNumber("Seg", Thunk.Header.Seg);
351110 W.printNumber("Len", Thunk.Header.Len);
352 W.printEnum("Ordinal", Thunk.Header.Ord, makeArrayRef(ThunkOrdinalNames));
111 W.printEnum("Ordinal", Thunk.Header.Ord, getThunkOrdinalNames());
353112 }
354113
355114 void CVSymbolDumperImpl::visitTrampolineSym(SymbolKind Kind,
356115 TrampolineSym &Tramp) {
357116 DictScope S(W, "Trampoline");
358 W.printEnum("Type", Tramp.Header.Type, makeArrayRef(TrampolineNames));
117 W.printEnum("Type", Tramp.Header.Type, getTrampolineNames());
359118 W.printNumber("Size", Tramp.Header.Size);
360119 W.printNumber("ThunkOff", Tramp.Header.ThunkOff);
361120 W.printNumber("TargetOff", Tramp.Header.TargetOff);
370129 W.printNumber("Reserved", Section.Header.Reserved);
371130 W.printNumber("Rva", Section.Header.Rva);
372131 W.printNumber("Length", Section.Header.Length);
373 W.printHex("Characteristics", Section.Header.Characteristics);
132 W.printFlags("Characteristics", Section.Header.Characteristics,
133 getImageSectionCharacteristicNames(),
134 COFF::SectionCharacteristics(0x00F00000));
135
374136 W.printString("Name", Section.Name);
375137 }
376138
378140 CoffGroupSym &CoffGroup) {
379141 DictScope S(W, "COFF Group");
380142 W.printNumber("Size", CoffGroup.Header.Size);
381 W.printHex("Characteristics", CoffGroup.Header.Characteristics);
143 W.printFlags("Characteristics", CoffGroup.Header.Characteristics,
144 getImageSectionCharacteristicNames(),
145 COFF::SectionCharacteristics(0x00F00000));
382146 W.printNumber("Offset", CoffGroup.Header.Offset);
383147 W.printNumber("Segment", CoffGroup.Header.Segment);
384148 W.printString("Name", CoffGroup.Name);
433197 DictScope S(W, "FileStatic");
434198 W.printNumber("Index", FileStatic.Header.Index);
435199 W.printNumber("ModFilenameOffset", FileStatic.Header.ModFilenameOffset);
436 W.printFlags("Flags", uint16_t(FileStatic.Header.Flags),
437 makeArrayRef(LocalFlags));
200 W.printFlags("Flags", uint16_t(FileStatic.Header.Flags), getLocalFlagNames());
438201 W.printString("Name", FileStatic.Name);
439202 }
440203
441204 void CVSymbolDumperImpl::visitExportSym(SymbolKind Kind, ExportSym &Export) {
442205 DictScope S(W, "Export");
443206 W.printNumber("Ordinal", Export.Header.Ordinal);
444 W.printFlags("Flags", Export.Header.Flags, makeArrayRef(ExportSymFlags));
207 W.printFlags("Flags", Export.Header.Flags, getExportSymFlagNames());
445208 W.printString("Name", Export.Name);
446209 }
447210
450213 DictScope S(W, "CompilerFlags2");
451214
452215 W.printEnum("Language", Compile2.Header.getLanguage(),
453 makeArrayRef(SourceLanguages));
216 getSourceLanguageNames());
454217 W.printFlags("Flags", Compile2.Header.flags & ~0xff,
455 makeArrayRef(CompileSym2FlagNames));
456 W.printEnum("Machine", unsigned(Compile2.Header.Machine),
457 makeArrayRef(CPUTypeNames));
218 getCompileSym2FlagNames());
219 W.printEnum("Machine", unsigned(Compile2.Header.Machine), getCPUTypeNames());
458220 std::string FrontendVersion;
459221 {
460222 raw_string_ostream Out(FrontendVersion);
479241 DictScope S(W, "CompilerFlags3");
480242
481243 W.printEnum("Language", Compile3.Header.getLanguage(),
482 makeArrayRef(SourceLanguages));
244 getSourceLanguageNames());
483245 W.printFlags("Flags", Compile3.Header.flags & ~0xff,
484 makeArrayRef(CompileSym3FlagNames));
485 W.printEnum("Machine", unsigned(Compile3.Header.Machine),
486 makeArrayRef(CPUTypeNames));
246 getCompileSym3FlagNames());
247 W.printEnum("Machine", unsigned(Compile3.Header.Machine), getCPUTypeNames());
487248 std::string FrontendVersion;
488249 {
489250 raw_string_ostream Out(FrontendVersion);
633394 }
634395 W.printHex("Register", FrameCookie.Header.Register);
635396 W.printEnum("CookieKind", uint16_t(FrameCookie.Header.CookieKind),
636 makeArrayRef(FrameCookieKinds));
397 getFrameCookieKindNames());
637398 }
638399
639400 void CVSymbolDumperImpl::visitFrameProcSym(SymbolKind Kind,
649410 FrameProc.Header.OffsetOfExceptionHandler);
650411 W.printHex("SectionIdOfExceptionHandler",
651412 FrameProc.Header.SectionIdOfExceptionHandler);
652 W.printFlags("Flags", FrameProc.Header.Flags,
653 makeArrayRef(FrameProcSymFlags));
413 W.printFlags("Flags", FrameProc.Header.Flags, getFrameProcSymFlagNames());
654414 }
655415
656416 void CVSymbolDumperImpl::visitHeapAllocationSiteSym(
729489 RegisterSym &Register) {
730490 DictScope S(W, "RegisterSym");
731491 W.printNumber("Type", Register.Header.Index);
732 W.printEnum("Seg", uint16_t(Register.Header.Register),
733 makeArrayRef(RegisterNames));
492 W.printEnum("Seg", uint16_t(Register.Header.Register), getRegisterNames());
734493 W.printString("Name", Register.Name);
735494 }
736495
761520 }
762521 W.printHex("Segment", Label.Header.Segment);
763522 W.printHex("Flags", Label.Header.Flags);
764 W.printFlags("Flags", Label.Header.Flags, makeArrayRef(ProcSymFlagNames));
523 W.printFlags("Flags", Label.Header.Flags, getProcSymFlagNames());
765524 W.printString("DisplayName", Label.Name);
766525 if (!LinkageName.empty())
767526 W.printString("LinkageName", LinkageName);
771530 DictScope S(W, "Local");
772531
773532 CVTD.printTypeIndex("Type", Local.Header.Type);
774 W.printFlags("Flags", uint16_t(Local.Header.Flags), makeArrayRef(LocalFlags));
533 W.printFlags("Flags", uint16_t(Local.Header.Flags), getLocalFlagNames());
775534 W.printString("VarName", Local.Name);
776535 }
777536
804563 }
805564 W.printHex("Segment", Proc.Header.Segment);
806565 W.printFlags("Flags", static_cast(Proc.Header.Flags),
807 makeArrayRef(ProcSymFlagNames));
566 getProcSymFlagNames());
808567 W.printString("DisplayName", Proc.Name);
809568 if (!LinkageName.empty())
810569 W.printString("LinkageName", LinkageName);
862621 void CVSymbolDumperImpl::visitUnknownSymbol(SymbolKind Kind,
863622 ArrayRef Data) {
864623 DictScope S(W, "UnknownSym");
865 W.printEnum("Kind", uint16_t(Kind), makeArrayRef(SymbolTypeNames));
624 W.printEnum("Kind", uint16_t(Kind), getSymbolTypeNames());
866625 W.printNumber("Length", uint32_t(Data.size()));
867626 }
868627
2828
2929 add_pdb_impl_folder(Raw
3030 Raw/DbiStream.cpp
31 Raw/EnumTables.cpp
3132 Raw/InfoStream.cpp
3233 Raw/MappedBlockStream.cpp
3334 Raw/ModInfo.cpp
99
1010 #include "llvm/DebugInfo/CodeView/StreamArray.h"
1111 #include "llvm/DebugInfo/CodeView/StreamReader.h"
12 #include "llvm/DebugInfo/PDB/Raw/ISectionContribVisitor.h"
1213 #include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
1314 #include "llvm/DebugInfo/PDB/Raw/ModInfo.h"
1415 #include "llvm/DebugInfo/PDB/Raw/NameHashTable.h"
1516 #include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
1617 #include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
1718 #include "llvm/DebugInfo/PDB/Raw/RawError.h"
19 #include "llvm/DebugInfo/PDB/Raw/RawTypes.h"
1820
1921 using namespace llvm;
22 using namespace llvm::codeview;
2023 using namespace llvm::pdb;
2124 using namespace llvm::support;
2225
7275 ulittle32_t Reserved; // Pad to 64 bytes
7376 };
7477
78 template
79 Error loadSectionContribs(FixedStreamArray &Output,
80 StreamReader &Reader) {
81 if (Reader.bytesRemaining() % sizeof(ContribType) != 0)
82 return make_error(
83 raw_error_code::corrupt_file,
84 "Invalid number of bytes of section contributions");
85
86 uint32_t Count = Reader.bytesRemaining() / sizeof(ContribType);
87 if (auto EC = Reader.readArray(Output, Count))
88 return EC;
89 return Error::success();
90 }
91
7592 DbiStream::DbiStream(PDBFile &File)
7693 : Pdb(File), Stream(StreamDBI, File), Header(nullptr) {
7794 static_assert(sizeof(HeaderInfo) == 64, "Invalid HeaderInfo size!");
8097 DbiStream::~DbiStream() {}
8198
8299 Error DbiStream::reload() {
83 codeview::StreamReader Reader(Stream);
100 StreamReader Reader(Stream);
84101
85102 if (Stream.getLength() < sizeof(HeaderInfo))
86103 return make_error(raw_error_code::corrupt_file,
97114 // produced in the last decade and allows us to avoid having to
98115 // special case all kinds of complicated arcane formats.
99116 if (Header->VersionHeader < PdbDbiV70)
100 return make_error(raw_error_code::corrupt_file,
117 return make_error(raw_error_code::feature_unsupported,
101118 "Unsupported DBI version.");
102119
103120 auto InfoStream = Pdb.getPDBInfoStream();
137154
138155 // Since each ModInfo in the stream is a variable length, we have to iterate
139156 // them to know how many there actually are.
140 codeview::VarStreamArray ModInfoArray;
157 VarStreamArray ModInfoArray;
141158 if (auto EC = Reader.readArray(ModInfoArray, Header->ModiSubstreamSize))
142159 return EC;
143160 for (auto &Info : ModInfoArray) {
160177 sizeof(ulittle16_t)))
161178 return EC;
162179
180 if (auto EC = initializeSectionContributionData())
181 return EC;
182
183 if (auto EC = initializeSectionMapData())
184 return EC;
185
163186 if (auto EC = initializeFileInfo())
164187 return EC;
165188
167190 return make_error(raw_error_code::corrupt_file,
168191 "Found unexpected bytes in DBI Stream.");
169192
170 codeview::StreamReader ECReader(ECSubstream);
193 StreamReader ECReader(ECSubstream);
171194 if (auto EC = ECNames.load(ECReader))
172195 return EC;
173196
221244 }
222245
223246 ArrayRef DbiStream::modules() const { return ModuleInfos; }
247 codeview::FixedStreamArray DbiStream::getSectionMap() const {
248 return SectionMap;
249 }
250
251 void llvm::pdb::DbiStream::visitSectionContributions(
252 ISectionContribVisitor &Visitor) const {
253 if (SectionContribVersion == DbiSecContribVer60) {
254 for (auto &SC : SectionContribs)
255 Visitor.visit(SC);
256 } else if (SectionContribVersion == DbiSecContribV2) {
257 for (auto &SC : SectionContribs2)
258 Visitor.visit(SC);
259 }
260 }
261
262 Error DbiStream::initializeSectionContributionData() {
263 StreamReader SCReader(SecContrSubstream);
264 if (auto EC = SCReader.readEnum(SectionContribVersion))
265 return EC;
266
267 if (SectionContribVersion == DbiSecContribVer60)
268 return loadSectionContribs(SectionContribs, SCReader);
269 if (SectionContribVersion == DbiSecContribV2)
270 return loadSectionContribs(SectionContribs2, SCReader);
271
272 return make_error(raw_error_code::feature_unsupported,
273 "Unsupported DBI Section Contribution version");
274 }
275
276 Error DbiStream::initializeSectionMapData() {
277 StreamReader SMReader(SecMapSubstream);
278 const SecMapHeader *Header;
279 if (auto EC = SMReader.readObject(Header))
280 return EC;
281 if (auto EC = SMReader.readArray(SectionMap, Header->SecCount))
282 return EC;
283 return Error::success();
284 }
224285
225286 Error DbiStream::initializeFileInfo() {
226287 struct FileInfoSubstreamHeader {
245306 // it is computed by summing `ModFileCounts`.
246307 //
247308 const FileInfoSubstreamHeader *FH;
248 codeview::StreamReader FISR(FileInfoSubstream);
309 StreamReader FISR(FileInfoSubstream);
249310 if (auto EC = FISR.readObject(FH))
250311 return EC;
251312
255316 return make_error(raw_error_code::corrupt_file,
256317 "FileInfo substream count doesn't match DBI.");
257318
258 codeview::FixedStreamArray ModIndexArray;
259 codeview::FixedStreamArray ModFileCountArray;
260 codeview::FixedStreamArray FileNameOffsets;
319 FixedStreamArray ModIndexArray;
320 FixedStreamArray ModFileCountArray;
321 FixedStreamArray FileNameOffsets;
261322
262323 // First is an array of `NumModules` module indices. This is not used for the
263324 // same reason that `NumSourceFiles` is not used. It's an array of uint16's,
285346 if (auto EC = FISR.readArray(FileNameOffsets, NumSourceFiles))
286347 return EC;
287348
288 codeview::StreamRef NamesBufferRef;
349 StreamRef NamesBufferRef;
289350 if (auto EC = FISR.readStreamRef(NamesBufferRef))
290351 return EC;
291 codeview::StreamReader Names(NamesBufferRef);
352 StreamReader Names(NamesBufferRef);
292353
293354 // We go through each ModuleInfo, determine the number N of source files for
294355 // that module, and then get the next N offsets from the Offsets array, using
0 //===- EnumTables.cpp - Enum to string conversion tables --------*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/DebugInfo/PDB/Raw/EnumTables.h"
10 #include "llvm/DebugInfo/PDB/Raw/RawConstants.h"
11
12 using namespace llvm;
13 using namespace llvm::pdb;
14
15 #define PDB_ENUM_CLASS_ENT(enum_class, enum) \
16 { #enum, std::underlying_type < enum_class > ::type(enum_class::enum) }
17
18 #define PDB_ENUM_ENT(ns, enum) \
19 { #enum, ns::enum }
20
21 static const EnumEntry OMFSegMapDescFlagNames[] = {
22 PDB_ENUM_CLASS_ENT(OMFSegDescFlags, Read),
23 PDB_ENUM_CLASS_ENT(OMFSegDescFlags, Write),
24 PDB_ENUM_CLASS_ENT(OMFSegDescFlags, Execute),
25 PDB_ENUM_CLASS_ENT(OMFSegDescFlags, AddressIs32Bit),
26 PDB_ENUM_CLASS_ENT(OMFSegDescFlags, IsSelector),
27 PDB_ENUM_CLASS_ENT(OMFSegDescFlags, IsAbsoluteAddress),
28 PDB_ENUM_CLASS_ENT(OMFSegDescFlags, IsGroup),
29 };
30
31 namespace llvm {
32 namespace pdb {
33 ArrayRef> getOMFSegMapDescFlagNames() {
34 return makeArrayRef(OMFSegMapDescFlagNames);
35 }
36 }
37 }
4444 return EC;
4545 if (auto EC = Reader.readStreamRef(C13LinesSubstream, C13Size))
4646 return EC;
47 ArrayRef LineBytes;
48 codeview::StreamReader LinesReader(C13LinesSubstream);
49 if (auto EC = LinesReader.readBytes(LineBytes, C13LinesSubstream.getLength()))
50 return EC;
4751
4852 uint32_t GlobalRefsSize;
4953 if (auto EC = Reader.readInteger(GlobalRefsSize))
0 ; RUN: llvm-pdbdump -raw-headers -raw-tpi-records -raw-tpi-record-bytes -raw-module-syms \
11 ; RUN: -raw-sym-record-bytes -raw-publics -raw-module-files -raw-stream-name=/names \
22 ; RUN: -raw-stream-summary -raw-stream-blocks -raw-ipi-records -raw-ipi-record-bytes \
3 ; RUN: %p/Inputs/empty.pdb \
3 ; RUN: -raw-section-contribs -raw-section-map %p/Inputs/empty.pdb \
44 ; RUN: | FileCheck -check-prefix=EMPTY %s
55 ; RUN: llvm-pdbdump -raw-all %p/Inputs/empty.pdb | FileCheck -check-prefix=ALL %s
66 ; RUN: llvm-pdbdump -raw-headers -raw-stream-name=/names -raw-modules -raw-module-files \
416416 ; EMPTY-NEXT: Reserved: 0
417417 ; EMPTY-NEXT: Rva: 4096
418418 ; EMPTY-NEXT: Length: 4122
419 ; EMPTY-NEXT: Characteristics: 0x60000020
419 ; EMPTY-NEXT: Characteristics [ (0x60000020)
420 ; EMPTY-NEXT: IMAGE_SCN_CNT_CODE (0x20)
421 ; EMPTY-NEXT: IMAGE_SCN_MEM_EXECUTE (0x20000000)
422 ; EMPTY-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
423 ; EMPTY-NEXT: ]
420424 ; EMPTY-NEXT: Name: .text
421425 ; EMPTY-NEXT: }
422426 ; EMPTY-NEXT: Bytes (
427431 ; EMPTY-NEXT: {
428432 ; EMPTY-NEXT: COFF Group {
429433 ; EMPTY-NEXT: Size: 4122
430 ; EMPTY-NEXT: Characteristics: 0x60000020
434 ; EMPTY-NEXT: Characteristics [ (0x60000020)
435 ; EMPTY-NEXT: IMAGE_SCN_CNT_CODE (0x20)
436 ; EMPTY-NEXT: IMAGE_SCN_MEM_EXECUTE (0x20000000)
437 ; EMPTY-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
438 ; EMPTY-NEXT: ]
431439 ; EMPTY-NEXT: Offset: 0
432440 ; EMPTY-NEXT: Segment: 1
433441 ; EMPTY-NEXT: Name: .text$mn
444452 ; EMPTY-NEXT: Reserved: 0
445453 ; EMPTY-NEXT: Rva: 12288
446454 ; EMPTY-NEXT: Length: 690
447 ; EMPTY-NEXT: Characteristics: 0x40000040
455 ; EMPTY-NEXT: Characteristics [ (0x40000040)
456 ; EMPTY-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
457 ; EMPTY-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
458 ; EMPTY-NEXT: ]
448459 ; EMPTY-NEXT: Name: .rdata
449460 ; EMPTY-NEXT: }
450461 ; EMPTY-NEXT: Bytes (
455466 ; EMPTY-NEXT: {
456467 ; EMPTY-NEXT: COFF Group {
457468 ; EMPTY-NEXT: Size: 323
458 ; EMPTY-NEXT: Characteristics: 0x40000040
469 ; EMPTY-NEXT: Characteristics [ (0x40000040)
470 ; EMPTY-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
471 ; EMPTY-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
472 ; EMPTY-NEXT: ]
459473 ; EMPTY-NEXT: Offset: 0
460474 ; EMPTY-NEXT: Segment: 2
461475 ; EMPTY-NEXT: Name: .rdata
468482 ; EMPTY-NEXT: {
469483 ; EMPTY-NEXT: COFF Group {
470484 ; EMPTY-NEXT: Size: 0
471 ; EMPTY-NEXT: Characteristics: 0x40000040
485 ; EMPTY-NEXT: Characteristics [ (0x40000040)
486 ; EMPTY-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
487 ; EMPTY-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
488 ; EMPTY-NEXT: ]
472489 ; EMPTY-NEXT: Offset: 323
473490 ; EMPTY-NEXT: Segment: 2
474491 ; EMPTY-NEXT: Name: .edata
481498 ; EMPTY-NEXT: {
482499 ; EMPTY-NEXT: COFF Group {
483500 ; EMPTY-NEXT: Size: 366
484 ; EMPTY-NEXT: Characteristics: 0x40000040
501 ; EMPTY-NEXT: Characteristics [ (0x40000040)
502 ; EMPTY-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
503 ; EMPTY-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
504 ; EMPTY-NEXT: ]
485505 ; EMPTY-NEXT: Offset: 324
486506 ; EMPTY-NEXT: Segment: 2
487507 ; EMPTY-NEXT: Name: .rdata$debug
498518 ; EMPTY-NEXT: Reserved: 0
499519 ; EMPTY-NEXT: Rva: 16384
500520 ; EMPTY-NEXT: Length: 4
501 ; EMPTY-NEXT: Characteristics: 0xC0000040
521 ; EMPTY-NEXT: Characteristics [ (0xC0000040)
522 ; EMPTY-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
523 ; EMPTY-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
524 ; EMPTY-NEXT: IMAGE_SCN_MEM_WRITE (0x80000000)
525 ; EMPTY-NEXT: ]
502526 ; EMPTY-NEXT: Name: .data
503527 ; EMPTY-NEXT: }
504528 ; EMPTY-NEXT: Bytes (
509533 ; EMPTY-NEXT: {
510534 ; EMPTY-NEXT: COFF Group {
511535 ; EMPTY-NEXT: Size: 4
512 ; EMPTY-NEXT: Characteristics: 0xC0000080
536 ; EMPTY-NEXT: Characteristics [ (0xC0000080)
537 ; EMPTY-NEXT: IMAGE_SCN_CNT_UNINITIALIZED_DATA (0x80)
538 ; EMPTY-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
539 ; EMPTY-NEXT: IMAGE_SCN_MEM_WRITE (0x80000000)
540 ; EMPTY-NEXT: ]
513541 ; EMPTY-NEXT: Offset: 0
514542 ; EMPTY-NEXT: Segment: 3
515543 ; EMPTY-NEXT: Name: .bss
526554 ; EMPTY-NEXT: Reserved: 0
527555 ; EMPTY-NEXT: Rva: 20480
528556 ; EMPTY-NEXT: Length: 8
529 ; EMPTY-NEXT: Characteristics: 0x42000040
557 ; EMPTY-NEXT: Characteristics [ (0x42000040)
558 ; EMPTY-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
559 ; EMPTY-NEXT: IMAGE_SCN_MEM_DISCARDABLE (0x2000000)
560 ; EMPTY-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
561 ; EMPTY-NEXT: ]
530562 ; EMPTY-NEXT: Name: .reloc
531563 ; EMPTY-NEXT: }
532564 ; EMPTY-NEXT: Bytes (
538570 ; EMPTY-NEXT: }
539571 ; EMPTY-NEXT: ]
540572 ; EMPTY-NEXT: }
573 ; EMPTY-NEXT: Section Contributions [
574 ; EMPTY-NEXT: Contribution {
575 ; EMPTY-NEXT: ISect: 1
576 ; EMPTY-NEXT: Off: 0
577 ; EMPTY-NEXT: Size: 10
578 ; EMPTY-NEXT: Characteristics [ (0x60000020)
579 ; EMPTY-NEXT: IMAGE_SCN_CNT_CODE (0x20)
580 ; EMPTY-NEXT: IMAGE_SCN_MEM_EXECUTE (0x20000000)
581 ; EMPTY-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
582 ; EMPTY-NEXT: ]
583 ; EMPTY-NEXT: Module {
584 ; EMPTY-NEXT: Index: 1
585 ; EMPTY-NEXT: Name: * Linker *
586 ; EMPTY-NEXT: }
587 ; EMPTY-NEXT: Data CRC: 0
588 ; EMPTY-NEXT: Reloc CRC: 0
589 ; EMPTY-NEXT: }
590 ; EMPTY-NEXT: Contribution {
591 ; EMPTY-NEXT: ISect: 1
592 ; EMPTY-NEXT: Off: 16
593 ; EMPTY-NEXT: Size: 10
594 ; EMPTY-NEXT: Characteristics [ (0x60500020)
595 ; EMPTY-NEXT: IMAGE_SCN_ALIGN_16BYTES (0x500000)
596 ; EMPTY-NEXT: IMAGE_SCN_CNT_CODE (0x20)
597 ; EMPTY-NEXT: IMAGE_SCN_MEM_EXECUTE (0x20000000)
598 ; EMPTY-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
599 ; EMPTY-NEXT: ]
600 ; EMPTY-NEXT: Module {
601 ; EMPTY-NEXT: Index: 0
602 ; EMPTY-NEXT: Name: d:\src\llvm\test\DebugInfo\PDB\Inputs\empty.obj
603 ; EMPTY-NEXT: }
604 ; EMPTY-NEXT: Data CRC: 3617027124
605 ; EMPTY-NEXT: Reloc CRC: 0
606 ; EMPTY-NEXT: }
607 ; EMPTY-NEXT: Contribution {
608 ; EMPTY-NEXT: ISect: 2
609 ; EMPTY-NEXT: Off: 0
610 ; EMPTY-NEXT: Size: 56
611 ; EMPTY-NEXT: Characteristics [ (0x40000040)
612 ; EMPTY-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
613 ; EMPTY-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
614 ; EMPTY-NEXT: ]
615 ; EMPTY-NEXT: Module {
616 ; EMPTY-NEXT: Index: 1
617 ; EMPTY-NEXT: Name: * Linker *
618 ; EMPTY-NEXT: }
619 ; EMPTY-NEXT: Data CRC: 0
620 ; EMPTY-NEXT: Reloc CRC: 0
621 ; EMPTY-NEXT: }
622 ; EMPTY-NEXT: Contribution {
623 ; EMPTY-NEXT: ISect: 2
624 ; EMPTY-NEXT: Off: 324
625 ; EMPTY-NEXT: Size: 72
626 ; EMPTY-NEXT: Characteristics [ (0x40300040)
627 ; EMPTY-NEXT: IMAGE_SCN_ALIGN_4BYTES (0x300000)
628 ; EMPTY-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
629 ; EMPTY-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
630 ; EMPTY-NEXT: ]
631 ; EMPTY-NEXT: Module {
632 ; EMPTY-NEXT: Index: 1
633 ; EMPTY-NEXT: Name: * Linker *
634 ; EMPTY-NEXT: }
635 ; EMPTY-NEXT: Data CRC: 0
636 ; EMPTY-NEXT: Reloc CRC: 0
637 ; EMPTY-NEXT: }
638 ; EMPTY-NEXT: Contribution {
639 ; EMPTY-NEXT: ISect: 2
640 ; EMPTY-NEXT: Off: 396
641 ; EMPTY-NEXT: Size: 20
642 ; EMPTY-NEXT: Characteristics [ (0x40300040)
643 ; EMPTY-NEXT: IMAGE_SCN_ALIGN_4BYTES (0x300000)
644 ; EMPTY-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
645 ; EMPTY-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
646 ; EMPTY-NEXT: ]
647 ; EMPTY-NEXT: Module {
648 ; EMPTY-NEXT: Index: 1
649 ; EMPTY-NEXT: Name: * Linker *
650 ; EMPTY-NEXT: }
651 ; EMPTY-NEXT: Data CRC: 0
652 ; EMPTY-NEXT: Reloc CRC: 0
653 ; EMPTY-NEXT: }
654 ; EMPTY-NEXT: Contribution {
655 ; EMPTY-NEXT: ISect: 3
656 ; EMPTY-NEXT: Off: 0
657 ; EMPTY-NEXT: Size: 4
658 ; EMPTY-NEXT: Characteristics [ (0xC0300080)
659 ; EMPTY-NEXT: IMAGE_SCN_ALIGN_4BYTES (0x300000)
660 ; EMPTY-NEXT: IMAGE_SCN_CNT_UNINITIALIZED_DATA (0x80)
661 ; EMPTY-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
662 ; EMPTY-NEXT: IMAGE_SCN_MEM_WRITE (0x80000000)
663 ; EMPTY-NEXT: ]
664 ; EMPTY-NEXT: Module {
665 ; EMPTY-NEXT: Index: 0
666 ; EMPTY-NEXT: Name: d:\src\llvm\test\DebugInfo\PDB\Inputs\empty.obj
667 ; EMPTY-NEXT: }
668 ; EMPTY-NEXT: Data CRC: 0
669 ; EMPTY-NEXT: Reloc CRC: 0
670 ; EMPTY-NEXT: }
671 ; EMPTY-NEXT: ]
672 ; EMPTY-NEXT: Section Map [
673 ; EMPTY-NEXT: Entry {
674 ; EMPTY-NEXT: Flags [ (0x10D)
675 ; EMPTY-NEXT: AddressIs32Bit (0x8)
676 ; EMPTY-NEXT: Execute (0x4)
677 ; EMPTY-NEXT: IsSelector (0x100)
678 ; EMPTY-NEXT: Read (0x1)
679 ; EMPTY-NEXT: ]
680 ; EMPTY-NEXT: Flags: 269
681 ; EMPTY-NEXT: Ovl: 0
682 ; EMPTY-NEXT: Group: 0
683 ; EMPTY-NEXT: Frame: 1
684 ; EMPTY-NEXT: SecName: 65535
685 ; EMPTY-NEXT: ClassName: 65535
686 ; EMPTY-NEXT: Offset: 0
687 ; EMPTY-NEXT: SecByteLength: 4122
688 ; EMPTY-NEXT: }
689 ; EMPTY-NEXT: Entry {
690 ; EMPTY-NEXT: Flags [ (0x109)
691 ; EMPTY-NEXT: AddressIs32Bit (0x8)
692 ; EMPTY-NEXT: IsSelector (0x100)
693 ; EMPTY-NEXT: Read (0x1)
694 ; EMPTY-NEXT: ]
695 ; EMPTY-NEXT: Flags: 265
696 ; EMPTY-NEXT: Ovl: 0
697 ; EMPTY-NEXT: Group: 0
698 ; EMPTY-NEXT: Frame: 2
699 ; EMPTY-NEXT: SecName: 65535
700 ; EMPTY-NEXT: ClassName: 65535
701 ; EMPTY-NEXT: Offset: 0
702 ; EMPTY-NEXT: SecByteLength: 690
703 ; EMPTY-NEXT: }
704 ; EMPTY-NEXT: Entry {
705 ; EMPTY-NEXT: Flags [ (0x10B)
706 ; EMPTY-NEXT: AddressIs32Bit (0x8)
707 ; EMPTY-NEXT: IsSelector (0x100)
708 ; EMPTY-NEXT: Read (0x1)
709 ; EMPTY-NEXT: Write (0x2)
710 ; EMPTY-NEXT: ]
711 ; EMPTY-NEXT: Flags: 267
712 ; EMPTY-NEXT: Ovl: 0
713 ; EMPTY-NEXT: Group: 0
714 ; EMPTY-NEXT: Frame: 3
715 ; EMPTY-NEXT: SecName: 65535
716 ; EMPTY-NEXT: ClassName: 65535
717 ; EMPTY-NEXT: Offset: 0
718 ; EMPTY-NEXT: SecByteLength: 4
719 ; EMPTY-NEXT: }
720 ; EMPTY-NEXT: Entry {
721 ; EMPTY-NEXT: Flags [ (0x109)
722 ; EMPTY-NEXT: AddressIs32Bit (0x8)
723 ; EMPTY-NEXT: IsSelector (0x100)
724 ; EMPTY-NEXT: Read (0x1)
725 ; EMPTY-NEXT: ]
726 ; EMPTY-NEXT: Flags: 265
727 ; EMPTY-NEXT: Ovl: 0
728 ; EMPTY-NEXT: Group: 0
729 ; EMPTY-NEXT: Frame: 4
730 ; EMPTY-NEXT: SecName: 65535
731 ; EMPTY-NEXT: ClassName: 65535
732 ; EMPTY-NEXT: Offset: 0
733 ; EMPTY-NEXT: SecByteLength: 8
734 ; EMPTY-NEXT: }
735 ; EMPTY-NEXT: Entry {
736 ; EMPTY-NEXT: Flags [ (0x208)
737 ; EMPTY-NEXT: AddressIs32Bit (0x8)
738 ; EMPTY-NEXT: IsAbsoluteAddress (0x200)
739 ; EMPTY-NEXT: ]
740 ; EMPTY-NEXT: Flags: 520
741 ; EMPTY-NEXT: Ovl: 0
742 ; EMPTY-NEXT: Group: 0
743 ; EMPTY-NEXT: Frame: 0
744 ; EMPTY-NEXT: SecName: 65535
745 ; EMPTY-NEXT: ClassName: 65535
746 ; EMPTY-NEXT: Offset: 0
747 ; EMPTY-NEXT: SecByteLength: 4294967295
748 ; EMPTY-NEXT: }
749 ; EMPTY-NEXT: ]
541750 ; EMPTY: Publics Stream {
542751 ; EMPTY-NEXT: Stream number: 7
543752 ; EMPTY-NEXT: SymHash: 556
9341143 ; ALL: Reserved: 0
9351144 ; ALL: Rva: 4096
9361145 ; ALL: Length: 4122
937 ; ALL: Characteristics: 0x60000020
1146 ; ALL: Characteristics [ (0x60000020)
1147 ; ALL: IMAGE_SCN_CNT_CODE (0x20)
1148 ; ALL: IMAGE_SCN_MEM_EXECUTE (0x20000000)
1149 ; ALL: IMAGE_SCN_MEM_READ (0x40000000)
1150 ; ALL: ]
9381151 ; ALL: Name: .text
9391152 ; ALL: }
9401153 ; ALL: }
9411154 ; ALL: {
9421155 ; ALL: COFF Group {
9431156 ; ALL: Size: 4122
944 ; ALL: Characteristics: 0x60000020
1157 ; ALL: Characteristics [ (0x60000020)
1158 ; ALL: IMAGE_SCN_CNT_CODE (0x20)
1159 ; ALL: IMAGE_SCN_MEM_EXECUTE (0x20000000)
1160 ; ALL: IMAGE_SCN_MEM_READ (0x40000000)
1161 ; ALL: ]
9451162 ; ALL: Offset: 0
9461163 ; ALL: Segment: 1
9471164 ; ALL: Name: .text$mn
9541171 ; ALL: Reserved: 0
9551172 ; ALL: Rva: 12288
9561173 ; ALL: Length: 690
957 ; ALL: Characteristics: 0x40000040
1174 ; ALL: Characteristics [ (0x40000040)
1175 ; ALL: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
1176 ; ALL: IMAGE_SCN_MEM_READ (0x40000000)
1177 ; ALL: ]
9581178 ; ALL: Name: .rdata
9591179 ; ALL: }
9601180 ; ALL: }
9611181 ; ALL: {
9621182 ; ALL: COFF Group {
9631183 ; ALL: Size: 323
964 ; ALL: Characteristics: 0x40000040
1184 ; ALL: Characteristics [ (0x40000040)
1185 ; ALL: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
1186 ; ALL: IMAGE_SCN_MEM_READ (0x40000000)
1187 ; ALL: ]
9651188 ; ALL: Offset: 0
9661189 ; ALL: Segment: 2
9671190 ; ALL: Name: .rdata
9701193 ; ALL: {
9711194 ; ALL: COFF Group {
9721195 ; ALL: Size: 0
973 ; ALL: Characteristics: 0x40000040
1196 ; ALL: Characteristics [ (0x40000040)
1197 ; ALL: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
1198 ; ALL: IMAGE_SCN_MEM_READ (0x40000000)
1199 ; ALL: ]
9741200 ; ALL: Offset: 323
9751201 ; ALL: Segment: 2
9761202 ; ALL: Name: .edata
9791205 ; ALL: {
9801206 ; ALL: COFF Group {
9811207 ; ALL: Size: 366
982 ; ALL: Characteristics: 0x40000040
1208 ; ALL: Characteristics [ (0x40000040)
1209 ; ALL: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
1210 ; ALL: IMAGE_SCN_MEM_READ (0x40000000)
1211 ; ALL: ]
9831212 ; ALL: Offset: 324
9841213 ; ALL: Segment: 2
9851214 ; ALL: Name: .rdata$debug
9921221 ; ALL: Reserved: 0
9931222 ; ALL: Rva: 16384
9941223 ; ALL: Length: 4
995 ; ALL: Characteristics: 0xC0000040
1224 ; ALL: Characteristics [ (0xC0000040)
1225 ; ALL: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
1226 ; ALL: IMAGE_SCN_MEM_READ (0x40000000)
1227 ; ALL: IMAGE_SCN_MEM_WRITE (0x80000000)
1228 ; ALL: ]
9961229 ; ALL: Name: .data
9971230 ; ALL: }
9981231 ; ALL: }
9991232 ; ALL: {
10001233 ; ALL: COFF Group {
10011234 ; ALL: Size: 4
1002 ; ALL: Characteristics: 0xC0000080
1235 ; ALL: Characteristics [ (0xC0000080)
1236 ; ALL: IMAGE_SCN_CNT_UNINITIALIZED_DATA (0x80)
1237 ; ALL: IMAGE_SCN_MEM_READ (0x40000000)
1238 ; ALL: IMAGE_SCN_MEM_WRITE (0x80000000)
1239 ; ALL: ]
10031240 ; ALL: Offset: 0
10041241 ; ALL: Segment: 3
10051242 ; ALL: Name: .bss
10121249 ; ALL: Reserved: 0
10131250 ; ALL: Rva: 20480
10141251 ; ALL: Length: 8
1015 ; ALL: Characteristics: 0x42000040
1252 ; ALL: Characteristics [ (0x42000040)
1253 ; ALL: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
1254 ; ALL: IMAGE_SCN_MEM_DISCARDABLE (0x2000000)
1255 ; ALL: IMAGE_SCN_MEM_READ (0x40000000)
1256 ; ALL: ]
10161257 ; ALL: Name: .reloc
10171258 ; ALL: }
10181259 ; ALL: }
10201261 ; ALL: }
10211262 ; ALL: ]
10221263 ; ALL: }
1264 ; ALL: Section Contributions [
1265 ; ALL: Contribution {
1266 ; ALL: ISect: 1
1267 ; ALL: Off: 0
1268 ; ALL: Size: 10
1269 ; ALL: Characteristics [ (0x60000020)
1270 ; ALL: IMAGE_SCN_CNT_CODE (0x20)
1271 ; ALL: IMAGE_SCN_MEM_EXECUTE (0x20000000)
1272 ; ALL: IMAGE_SCN_MEM_READ (0x40000000)
1273 ; ALL: ]
1274 ; ALL: Module {
1275 ; ALL: Index: 1
1276 ; ALL: Name: * Linker *
1277 ; ALL: }
1278 ; ALL: Data CRC: 0
1279 ; ALL: Reloc CRC: 0
1280 ; ALL: }
1281 ; ALL: Contribution {
1282 ; ALL: ISect: 1
1283 ; ALL: Off: 16
1284 ; ALL: Size: 10
1285 ; ALL: Characteristics [ (0x60500020)
1286 ; ALL: IMAGE_SCN_ALIGN_16BYTES (0x500000)
1287 ; ALL: IMAGE_SCN_CNT_CODE (0x20)
1288 ; ALL: IMAGE_SCN_MEM_EXECUTE (0x20000000)
1289 ; ALL: IMAGE_SCN_MEM_READ (0x40000000)
1290 ; ALL: ]
1291 ; ALL: Module {
1292 ; ALL: Index: 0
1293 ; ALL: Name: d:\src\llvm\test\DebugInfo\PDB\Inputs\empty.obj
1294 ; ALL: }
1295 ; ALL: Data CRC: 3617027124
1296 ; ALL: Reloc CRC: 0
1297 ; ALL: }
1298 ; ALL: Contribution {
1299 ; ALL: ISect: 2
1300 ; ALL: Off: 0
1301 ; ALL: Size: 56
1302 ; ALL: Characteristics [ (0x40000040)
1303 ; ALL: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
1304 ; ALL: IMAGE_SCN_MEM_READ (0x40000000)
1305 ; ALL: ]
1306 ; ALL: Module {
1307 ; ALL: Index: 1
1308 ; ALL: Name: * Linker *
1309 ; ALL: }
1310 ; ALL: Data CRC: 0
1311 ; ALL: Reloc CRC: 0
1312 ; ALL: }
1313 ; ALL: Contribution {
1314 ; ALL: ISect: 2
1315 ; ALL: Off: 324
1316 ; ALL: Size: 72
1317 ; ALL: Characteristics [ (0x40300040)
1318 ; ALL: IMAGE_SCN_ALIGN_4BYTES (0x300000)
1319 ; ALL: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
1320 ; ALL: IMAGE_SCN_MEM_READ (0x40000000)
1321 ; ALL: ]
1322 ; ALL: Module {
1323 ; ALL: Index: 1
1324 ; ALL: Name: * Linker *
1325 ; ALL: }
1326 ; ALL: Data CRC: 0
1327 ; ALL: Reloc CRC: 0
1328 ; ALL: }
1329 ; ALL: Contribution {
1330 ; ALL: ISect: 2
1331 ; ALL: Off: 396
1332 ; ALL: Size: 20
1333 ; ALL: Characteristics [ (0x40300040)
1334 ; ALL: IMAGE_SCN_ALIGN_4BYTES (0x300000)
1335 ; ALL: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
1336 ; ALL: IMAGE_SCN_MEM_READ (0x40000000)
1337 ; ALL: ]
1338 ; ALL: Module {
1339 ; ALL: Index: 1
1340 ; ALL: Name: * Linker *
1341 ; ALL: }
1342 ; ALL: Data CRC: 0
1343 ; ALL: Reloc CRC: 0
1344 ; ALL: }
1345 ; ALL: Contribution {
1346 ; ALL: ISect: 3
1347 ; ALL: Off: 0
1348 ; ALL: Size: 4
1349 ; ALL: Characteristics [ (0xC0300080)
1350 ; ALL: IMAGE_SCN_ALIGN_4BYTES (0x300000)
1351 ; ALL: IMAGE_SCN_CNT_UNINITIALIZED_DATA (0x80)
1352 ; ALL: IMAGE_SCN_MEM_READ (0x40000000)
1353 ; ALL: IMAGE_SCN_MEM_WRITE (0x80000000)
1354 ; ALL: ]
1355 ; ALL: Module {
1356 ; ALL: Index: 0
1357 ; ALL: Name: d:\src\llvm\test\DebugInfo\PDB\Inputs\empty.obj
1358 ; ALL: }
1359 ; ALL: Data CRC: 0
1360 ; ALL: Reloc CRC: 0
1361 ; ALL: }
1362 ; ALL: ]
1363 ; ALL: Section Map [
1364 ; ALL: Entry {
1365 ; ALL: Flags: 269
1366 ; ALL: Ovl: 0
1367 ; ALL: Group: 0
1368 ; ALL: Frame: 1
1369 ; ALL: SecName: 65535
1370 ; ALL: ClassName: 65535
1371 ; ALL: Offset: 0
1372 ; ALL: SecByteLength: 4122
1373 ; ALL: }
1374 ; ALL: Entry {
1375 ; ALL: Flags: 265
1376 ; ALL: Ovl: 0
1377 ; ALL: Group: 0
1378 ; ALL: Frame: 2
1379 ; ALL: SecName: 65535
1380 ; ALL: ClassName: 65535
1381 ; ALL: Offset: 0
1382 ; ALL: SecByteLength: 690
1383 ; ALL: }
1384 ; ALL: Entry {
1385 ; ALL: Flags: 267
1386 ; ALL: Ovl: 0
1387 ; ALL: Group: 0
1388 ; ALL: Frame: 3
1389 ; ALL: SecName: 65535
1390 ; ALL: ClassName: 65535
1391 ; ALL: Offset: 0
1392 ; ALL: SecByteLength: 4
1393 ; ALL: }
1394 ; ALL: Entry {
1395 ; ALL: Flags: 265
1396 ; ALL: Ovl: 0
1397 ; ALL: Group: 0
1398 ; ALL: Frame: 4
1399 ; ALL: SecName: 65535
1400 ; ALL: ClassName: 65535
1401 ; ALL: Offset: 0
1402 ; ALL: SecByteLength: 8
1403 ; ALL: }
1404 ; ALL: Entry {
1405 ; ALL: Flags: 520
1406 ; ALL: Ovl: 0
1407 ; ALL: Group: 0
1408 ; ALL: Frame: 0
1409 ; ALL: SecName: 65535
1410 ; ALL: ClassName: 65535
1411 ; ALL: Offset: 0
1412 ; ALL: SecByteLength: 4294967295
1413 ; ALL: }
1414 ; ALL: ]
10231415 ; ALL: Publics Stream {
10241416 ; ALL: Stream number: 7
10251417 ; ALL: SymHash: 556
2525 #include "llvm/ADT/DenseMap.h"
2626 #include "llvm/ADT/StringExtras.h"
2727 #include "llvm/Config/config.h"
28 #include "llvm/DebugInfo/CodeView/EnumTables.h"
2829 #include "llvm/DebugInfo/CodeView/StreamReader.h"
2930 #include "llvm/DebugInfo/CodeView/SymbolDumper.h"
3031 #include "llvm/DebugInfo/CodeView/TypeDumper.h"
3940 #include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
4041 #include "llvm/DebugInfo/PDB/PDBSymbolThunk.h"
4142 #include "llvm/DebugInfo/PDB/Raw/DbiStream.h"
43 #include "llvm/DebugInfo/PDB/Raw/EnumTables.h"
44 #include "llvm/DebugInfo/PDB/Raw/ISectionContribVisitor.h"
4245 #include "llvm/DebugInfo/PDB/Raw/InfoStream.h"
4346 #include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h"
4447 #include "llvm/DebugInfo/PDB/Raw/ModInfo.h"
4952 #include "llvm/DebugInfo/PDB/Raw/RawError.h"
5053 #include "llvm/DebugInfo/PDB/Raw/RawSession.h"
5154 #include "llvm/DebugInfo/PDB/Raw/TpiStream.h"
55 #include "llvm/Support/COM.h"
5256 #include "llvm/Support/CommandLine.h"
5357 #include "llvm/Support/ConvertUTF.h"
5458 #include "llvm/Support/FileSystem.h"
6064 #include "llvm/Support/ScopedPrinter.h"
6165 #include "llvm/Support/Signals.h"
6266 #include "llvm/Support/raw_ostream.h"
63
64 #if defined(HAVE_DIA_SDK)
65 #ifndef NOMINMAX
66 #define NOMINMAX
67 #endif
68 #include
69 #endif
7067
7168 using namespace llvm;
7269 using namespace llvm::pdb;
142139 cl::cat(NativeOptions));
143140 cl::opt DumpPublics("raw-publics", cl::desc("dump Publics stream data"),
144141 cl::cat(NativeOptions));
142 cl::opt DumpSectionContribs("raw-section-contribs",
143 cl::desc("dump section contributions"),
144 cl::cat(NativeOptions));
145 cl::opt DumpSectionMap("raw-section-map", cl::desc("dump section map"),
146 cl::cat(NativeOptions));
145147 cl::opt
146148 DumpSymRecordBytes("raw-sym-record-bytes",
147149 cl::desc("dump CodeView symbol record raw bytes"),
504506 return Error::success();
505507 }
506508
509 static Error dumpSectionContribs(ScopedPrinter &P, PDBFile &File) {
510 if (!opts::DumpSectionContribs)
511 return Error::success();
512
513 auto DbiS = File.getPDBDbiStream();
514 if (auto EC = DbiS.takeError())
515 return EC;
516 DbiStream &DS = DbiS.get();
517 ListScope L(P, "Section Contributions");
518 class Visitor : public ISectionContribVisitor {
519 public:
520 Visitor(ScopedPrinter &P, DbiStream &DS) : P(P), DS(DS) {}
521 void visit(const SectionContrib &SC) override {
522 DictScope D(P, "Contribution");
523 P.printNumber("ISect", SC.ISect);
524 P.printNumber("Off", SC.Off);
525 P.printNumber("Size", SC.Size);
526 P.printFlags("Characteristics", SC.Characteristics,
527 codeview::getImageSectionCharacteristicNames(),
528 COFF::SectionCharacteristics(0x00F00000));
529 {
530 DictScope DD(P, "Module");
531 P.printNumber("Index", SC.Imod);
532 auto M = DS.modules();
533 if (M.size() > SC.Imod) {
534 P.printString("Name", M[SC.Imod].Info.getModuleName());
535 }
536 }
537 P.printNumber("Data CRC", SC.DataCrc);
538 P.printNumber("Reloc CRC", SC.RelocCrc);
539 P.flush();
540 }
541 void visit(const SectionContrib2 &SC) override {
542 visit(SC.Base);
543 P.printNumber("ISect Coff", SC.ISectCoff);
544 P.flush();
545 }
546
547 private:
548 ScopedPrinter &P;
549 DbiStream &DS;
550 };
551 Visitor V(P, DS);
552 DS.visitSectionContributions(V);
553 return Error::success();
554 }
555
556 static Error dumpSectionMap(ScopedPrinter &P, PDBFile &File) {
557 if (!opts::DumpSectionMap)
558 return Error::success();
559
560 auto DbiS = File.getPDBDbiStream();
561 if (auto EC = DbiS.takeError())
562 return EC;
563 DbiStream &DS = DbiS.get();
564 ListScope L(P, "Section Map");
565 for (auto &M : DS.getSectionMap()) {
566 DictScope D(P, "Entry");
567 P.printFlags("Flags", M.Flags, getOMFSegMapDescFlagNames());
568 P.printNumber("Flags", M.Flags);
569 P.printNumber("Ovl", M.Ovl);
570 P.printNumber("Group", M.Group);
571 P.printNumber("Frame", M.Frame);
572 P.printNumber("SecName", M.SecName);
573 P.printNumber("ClassName", M.ClassName);
574 P.printNumber("Offset", M.Offset);
575 P.printNumber("SecByteLength", M.SecByteLength);
576 P.flush();
577 }
578 return Error::success();
579 }
580
507581 static Error dumpTpiStream(ScopedPrinter &P, PDBFile &File,
508582 codeview::CVTypeDumper &TD, uint32_t StreamIdx) {
509583 assert(StreamIdx == StreamTPI || StreamIdx == StreamIPI);
647721 if (auto EC = dumpDbiStream(P, File, TD))
648722 return EC;
649723
724 if (auto EC = dumpSectionContribs(P, File))
725 return EC;
726
727 if (auto EC = dumpSectionMap(P, File))
728 return EC;
729
650730 if (auto EC = dumpPublicsStream(P, File, TD))
651731 return EC;
732
652733 return Error::success();
653734 }
654735
680761 if (opts::DumpIpiRecords)
681762 return true;
682763 if (opts::DumpIpiRecordBytes)
764 return true;
765 if (opts::DumpSectionContribs)
766 return true;
767 if (opts::DumpSectionMap)
683768 return true;
684769 return false;
685770 }
845930 opts::DumpStreamBlocks = true;
846931 opts::DumpTpiRecords = true;
847932 opts::DumpIpiRecords = true;
933 opts::DumpSectionMap = true;
934 opts::DumpSectionContribs = true;
848935 }
849936
850937 // When adding filters for excluded compilands and types, we need to remember
863950 opts::ExcludeCompilands.push_back("d:\\\\th.obj.x86fre\\\\minkernel");
864951 }
865952
866 #if defined(HAVE_DIA_SDK)
867 CoInitializeEx(nullptr, COINIT_MULTITHREADED);
868 #endif
953 llvm::sys::InitializeCOMRAII COM(llvm::sys::COMThreadingMode::MultiThreaded);
869954
870955 std::for_each(opts::InputFilenames.begin(), opts::InputFilenames.end(),
871956 dumpInput);
872957
873 #if defined(HAVE_DIA_SDK)
874 CoUninitialize();
875 #endif
876958 outs().flush();
877959 return 0;
878960 }