LLVM: lib/ObjectYAML/CodeViewYAMLSymbols.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
30#include
31#include
32#include
33#include
34#include
35#include
36
37using namespace llvm;
42
45
46
49
52
65
67
69
72}
73
77}
78
82 for (const auto &E : SymbolNames)
84}
85
89 for (const auto &E : FlagNames) {
91 }
92}
93
97 for (const auto &E : FlagNames) {
99 }
100}
101
104 for (const auto &E : FlagNames) {
106 }
107}
108
111 for (const auto &E : FlagNames) {
113 }
114}
115
118 for (const auto &E : FlagNames) {
120 }
121}
122
125 for (const auto &E : FlagNames) {
127 }
128}
129
133 for (const auto &E : FlagNames) {
135 }
136}
137
140 for (const auto &E : CpuNames) {
142 }
143}
144
147 assert(Header && "The IO context is not initialized");
148
149 std::optional CpuType;
151
152 switch (Header->Machine) {
155 break;
158 break;
161 break;
166 break;
167 }
168
169 if (CpuType)
171
172 for (const auto &E : RegNames) {
174 }
176}
177
181 for (const auto &E : TrampNames) {
183 }
184}
185
189 for (const auto &E : ThunkNames) {
191 }
192}
193
197 for (const auto &E : ThunkNames) {
199 }
200}
201
205 for (const auto &E : ThunkNames) {
207 }
208}
209
210namespace llvm {
211namespace yaml {
225}
226}
227
228namespace llvm {
231
244
263
266
268
273 Prefix.RecordKind = Kind;
274 Prefix.RecordLen = TotalLen - 2;
275 uint8_t *Buffer = Allocator.Allocate<uint8_t>(TotalLen);
276 ::memcpy(Buffer, &Prefix, sizeof(RecordPrefix));
279 }
280
286
287 std::vector<uint8_t> Data;
288};
289
291
298 std::string Str;
300 Binary.writeAsBinary(OS);
301 Data.assign(Str.begin(), Str.end());
302 }
303}
304
314
323
332
340
346
360
366
373
380
384
391
398
404
411
418
424
432
433template <>
437
445
454
461
466
478
492
498 Symbol.BytesOfCalleeSavedRegisters);
499 IO.mapRequired("OffsetOfExceptionHandler", Symbol.OffsetOfExceptionHandler);
501 Symbol.SectionIdOfExceptionHandler);
503}
504
510
517
524
530
534
539
543
549
556
562
569
576
580
586
597
602
603}
604}
605}
606
609 return Symbol->toCodeViewSymbol(Allocator, Container);
610}
611
612namespace llvm {
613namespace yaml {
614
618
619}
620}
621
622template
623static inline ExpectedCodeViewYAML::SymbolRecord
626
627 auto Impl = std::make_shared(Symbol.kind());
628 if (auto EC = Impl->fromCodeViewSymbol(Symbol))
629 return std::move(EC);
630 Result.Symbol = Impl;
631 return Result;
632}
633
634ExpectedCodeViewYAML::SymbolRecord
636#define SYMBOL_RECORD(EnumName, EnumVal, ClassName) \
637 case EnumName: \
638 return fromCodeViewSymbolImpl<SymbolRecordImpl>(Symbol);
639#define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName) \
640 SYMBOL_RECORD(EnumName, EnumVal, ClassName)
641 switch (Symbol.kind()) {
642#include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"
643 default:
645 }
647}
648
649template
653 Obj.Symbol = std::make_shared(Kind);
654
656}
657
658void MappingTraitsCodeViewYAML::SymbolRecord::mapping(
659 IO &IO, CodeViewYAML::SymbolRecord &Obj) {
664
665#define SYMBOL_RECORD(EnumName, EnumVal, ClassName) \
666 case EnumName: \
667 mapSymbolRecordImpl<SymbolRecordImpl>(IO, #ClassName, Kind, \
668 Obj); \
669 break;
670#define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName) \
671 SYMBOL_RECORD(EnumName, EnumVal, ClassName)
672 switch (Kind) {
673#include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"
674 default:
676 }
677}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the BumpPtrAllocator interface.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static void mapSymbolRecordImpl(IO &IO, const char *Class, SymbolKind Kind, CodeViewYAML::SymbolRecord &Obj)
Definition CodeViewYAMLSymbols.cpp:650
static Expected< CodeViewYAML::SymbolRecord > fromCodeViewSymbolImpl(CVSymbol Symbol)
Definition CodeViewYAMLSymbols.cpp:624
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
#define LLVM_YAML_DECLARE_BITSET_TRAITS(Type)
#define LLVM_YAML_IS_SEQUENCE_VECTOR(type)
Utility for declaring that a std::vector of a particular type should be considered a YAML sequence.
#define LLVM_YAML_DECLARE_SCALAR_TRAITS(Type, MustQuote)
#define LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(type)
Utility for declaring that a std::vector of a particular type should be considered a YAML flow sequen...
#define LLVM_YAML_STRONG_TYPEDEF(_base, _type)
YAML I/O does conversion based on types. But often native data types are just a typedef of built in i...
#define LLVM_YAML_DECLARE_ENUM_TRAITS(Type)
An arbitrary precision integer that knows its signedness.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
ArrayRef< T > drop_front(size_t N=1) const
Drop the first N elements of the array.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
StringRef - Represent a constant reference to a string, i.e.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
ArrayRef< uint8_t > RecordData
static Error deserializeAs(CVSymbol Symbol, T &Record)
static CVSymbol writeOneSymbol(SymType &Sym, BumpPtrAllocator &Storage, CodeViewContainer Container)
This class implements an extremely fast bulk output stream that can only output to a stream.
A raw_ostream that writes to an std::string.
Specialized YAMLIO scalar type for representing a binary blob.
void bitSetCase(T &Val, StringRef Str, const T ConstVal)
virtual bool outputting() const =0
void enumCase(T &Val, StringRef Str, const T ConstVal)
void mapOptional(StringRef Key, T &Val)
void * getContext() const
void enumFallback(T &Val)
void mapRequired(StringRef Key, T &Val)
@ IMAGE_FILE_MACHINE_ARM64
@ IMAGE_FILE_MACHINE_AMD64
@ IMAGE_FILE_MACHINE_ARM64EC
@ IMAGE_FILE_MACHINE_I386
@ IMAGE_FILE_MACHINE_ARM64X
@ IMAGE_FILE_MACHINE_ARMNT
ProcSymFlags
Corresponds to the CV_PROCFLAGS bitfield.
LocalSymFlags
Corresponds to CV_LVARFLAGS bitfield.
CompileSym2Flags
Corresponds to COMPILESYM2::Flags bitfield.
CPUType
These values correspond to the CV_CPU_TYPE_e enumeration, and are documented here: https://msdn....
CompileSym3Flags
Corresponds to COMPILESYM3::Flags bitfield.
LLVM_ABI ArrayRef< EnumEntry< uint32_t > > getCompileSym2FlagNames()
CVRecord< SymbolKind > CVSymbol
LLVM_ABI ArrayRef< EnumEntry< uint16_t > > getExportSymFlagNames()
LLVM_ABI ArrayRef< EnumEntry< uint16_t > > getJumpTableEntrySizeNames()
SymbolRecordKind
Distinguishes individual records in the Symbols subsection of a .debug$S section.
LLVM_ABI ArrayRef< EnumEntry< SymbolKind > > getSymbolTypeNames()
ThunkOrdinal
These values correspond to the THUNK_ORDINAL enumeration.
LLVM_ABI ArrayRef< EnumEntry< uint16_t > > getLocalFlagNames()
LLVM_ABI ArrayRef< EnumEntry< uint16_t > > getRegisterNames(CPUType Cpu)
LLVM_ABI ArrayRef< EnumEntry< uint8_t > > getThunkOrdinalNames()
LLVM_ABI ArrayRef< EnumEntry< uint8_t > > getProcSymFlagNames()
SymbolKind
Duplicate copy of the above enum, but using the official CV names.
LLVM_ABI ArrayRef< EnumEntry< unsigned > > getCPUTypeNames()
LLVM_ABI ArrayRef< EnumEntry< uint32_t > > getFrameProcSymFlagNames()
LLVM_ABI ArrayRef< EnumEntry< uint16_t > > getTrampolineNames()
PublicSymFlags
Corresponds to the CV_PUBSYMFLAGS bitfield.
LLVM_ABI ArrayRef< EnumEntry< uint32_t > > getPublicSymFlagNames()
LLVM_ABI ArrayRef< EnumEntry< uint32_t > > getCompileSym3FlagNames()
LLVM_ABI ArrayRef< EnumEntry< uint8_t > > getFrameCookieKindNames()
This is an optimization pass for GlobalISel generic memory operations.
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
LLVM_ABI codeview::CVSymbol toCodeViewSymbol(BumpPtrAllocator &Allocator, codeview::CodeViewContainer Container) const
Definition CodeViewYAMLSymbols.cpp:607
std::shared_ptr< detail::SymbolRecordBase > Symbol
static LLVM_ABI Expected< SymbolRecord > fromCodeViewSymbol(codeview::CVSymbol Symbol)
Definition CodeViewYAMLSymbols.cpp:635
SymbolRecordBase(codeview::SymbolKind K)
Definition CodeViewYAMLSymbols.cpp:235
codeview::SymbolKind Kind
Definition CodeViewYAMLSymbols.cpp:233
virtual void map(yaml::IO &io)=0
virtual codeview::CVSymbol toCodeViewSymbol(BumpPtrAllocator &Allocator, CodeViewContainer Container) const =0
virtual ~SymbolRecordBase()=default
virtual Error fromCodeViewSymbol(codeview::CVSymbol Type)=0
codeview::CVSymbol toCodeViewSymbol(BumpPtrAllocator &Allocator, CodeViewContainer Container) const override
Definition CodeViewYAMLSymbols.cpp:252
void map(yaml::IO &io) override
Error fromCodeViewSymbol(codeview::CVSymbol CVS) override
Definition CodeViewYAMLSymbols.cpp:257
SymbolRecordImpl(codeview::SymbolKind K)
Definition CodeViewYAMLSymbols.cpp:246
T Symbol
Definition CodeViewYAMLSymbols.cpp:261
std::vector< uint8_t > Data
Definition CodeViewYAMLSymbols.cpp:287
Error fromCodeViewSymbol(CVSymbol CVS) override
Definition CodeViewYAMLSymbols.cpp:281
void map(yaml::IO &io) override
Definition CodeViewYAMLSymbols.cpp:292
UnknownSymbolRecord(codeview::SymbolKind K)
Definition CodeViewYAMLSymbols.cpp:265
CVSymbol toCodeViewSymbol(BumpPtrAllocator &Allocator, CodeViewContainer Container) const override
Definition CodeViewYAMLSymbols.cpp:269
static void mapping(IO &io, LocalVariableAddrGap &Gap)
Definition CodeViewYAMLSymbols.cpp:220
static void mapping(IO &io, LocalVariableAddrRange &Range)
Definition CodeViewYAMLSymbols.cpp:213
static void mapping(IO &io, SymbolRecordBase &Record)
Definition CodeViewYAMLSymbols.cpp:616
This class should be specialized by any type that needs to be converted to/from a YAML mapping.
This class should be specialized by any integer type that is a union of bit values and the YAML repre...
This class should be specialized by any integral type that converts to/from a YAML scalar where there...
This class should be specialized by type that requires custom conversion to/from a yaml scalar.