37 using namespace llvm::codeview;
38 using namespace llvm::CodeViewYAML;
39 using namespace llvm::CodeViewYAML::detail;
40 using namespace llvm::yaml;
67 StringRef
ScalarTraits<TypeName>::input(StringRef S,
void *V, TypeName &
T) {
79 for (
const auto &
E : SymbolNames)
80 io.
enumCase(Value,
E.Name.str().c_str(),
E.Value);
86 for (
const auto &
E : FlagNames) {
95 for (
const auto &
E : FlagNames) {
103 for (
const auto &
E : FlagNames) {
111 for (
const auto &
E : FlagNames) {
119 for (
const auto &
E : FlagNames) {
127 for (
const auto &
E : FlagNames) {
136 for (
const auto &
E : FlagNames) {
144 for (
const auto &
E : CpuNames) {
151 for (
const auto &
E : RegNames) {
160 for (
const auto &
E : TrampNames) {
169 for (
const auto &
E : ThunkNames) {
177 for (
const auto &
E : ThunkNames) {
184 namespace CodeViewYAML {
213 return SymbolDeserializer::deserializeAs<T>(CVS,
Symbol);
230 uint8_t *Buffer = Allocator.
Allocate<uint8_t>(TotalLen);
257 Data.assign(Str.begin(), Str.end());
437 Symbol.BytesOfCalleeSavedRegisters);
440 Symbol.SectionIdOfExceptionHandler);
522 return Symbol->toCodeViewSymbol(Allocator, Container);
535 template <
typename SymbolType>
540 auto Impl = std::make_shared<SymbolType>(Symbol.
kind());
541 if (
auto EC = Impl->fromCodeViewSymbol(Symbol))
542 return std::move(
EC);
549 #define SYMBOL_RECORD(EnumName, EnumVal, ClassName) \
551 return fromCodeViewSymbolImpl<SymbolRecordImpl<ClassName>>(Symbol);
552 #define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName) \
553 SYMBOL_RECORD(EnumName, EnumVal, ClassName)
554 switch (Symbol.
kind()) {
555 #include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"
557 return fromCodeViewSymbolImpl<UnknownSymbolRecord>(
Symbol);
562 template <
typename ConcreteType>
566 Obj.
Symbol = std::make_shared<ConcreteType>(Kind);
578 #define SYMBOL_RECORD(EnumName, EnumVal, ClassName) \
580 mapSymbolRecordImpl<SymbolRecordImpl<ClassName>>(IO, #ClassName, Kind, \
583 #define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName) \
584 SYMBOL_RECORD(EnumName, EnumVal, ClassName)
586 #include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"
588 mapSymbolRecordImpl<UnknownSymbolRecord>(IO,
"UnknownSym",
Kind, Obj);
void bitSetCase(T &Val, const char *Str, const T ConstVal)
void mapOptional(const char *Key, T &Val)
void writeAsBinary(raw_ostream &OS) const
Write the contents (regardless of whether it is binary or a hex string) as binary to the given raw_os...
SymbolRecordKind
Distinguishes individual records in the Symbols subsection of a .debug$S section. ...
ArrayRef< EnumEntry< uint16_t > > getExportSymFlagNames()
ArrayRef< EnumEntry< uint32_t > > getCompileSym3FlagNames()
CompileSym3Flags
Corresponds to COMPILESYM3::Flags bitfield.
SymbolRecordBase(codeview::SymbolKind K)
ArrayRef< EnumEntry< uint16_t > > getRegisterNames()
std::vector< uint8_t > Data
codeview::SymbolKind Kind
Error fromCodeViewSymbol(CVSymbol CVS) override
codeview::CVSymbol toCodeViewSymbol(BumpPtrAllocator &Allocator, CodeViewContainer Container) const override
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
#define LLVM_YAML_DECLARE_ENUM_TRAITS(Type)
CVRecord< SymbolKind > CVSymbol
ArrayRef< EnumEntry< uint8_t > > getThunkOrdinalNames()
Reg
All possible values of the reg field in the ModR/M byte.
Error fromCodeViewSymbol(codeview::CVSymbol CVS) override
Tagged union holding either a T or a Error.
void enumFallback(T &Val)
UnknownSymbolRecord(codeview::SymbolKind K)
ArrayRef< EnumEntry< uint8_t > > getFrameCookieKindNames()
This class should be specialized by any type that needs to be converted to/from a YAML mapping...
PublicSymFlags
Corresponds to the CV_PUBSYMFLAGS bitfield.
void enumCase(T &Val, const char *Str, const T ConstVal)
Function Alias Analysis false
ArrayRef< EnumEntry< unsigned > > getCPUTypeNames()
virtual void map(yaml::IO &io)=0
The instances of the Type class are immutable: once they are created, they are never changed...
Allocate memory in an ever growing pool, as if by bump-pointer.
SymbolRecordImpl(codeview::SymbolKind K)
LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ATTRIBUTE_RETURNS_NOALIAS void * Allocate(size_t Size, size_t Alignment)
Allocate space at the specified alignment.
static Expected< SymbolRecord > fromCodeViewSymbol(codeview::CVSymbol Symbol)
static Expected< CodeViewYAML::SymbolRecord > fromCodeViewSymbolImpl(CVSymbol Symbol)
static CVSymbol writeOneSymbol(SymType &Sym, BumpPtrAllocator &Storage, CodeViewContainer Container)
ArrayRef< EnumEntry< uint32_t > > getFrameProcSymFlagNames()
static ErrorSuccess success()
Create a success value.
ArrayRef< EnumEntry< SymbolKind > > getSymbolTypeNames()
#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...
This class should be specialized by any integral type that converts to/from a YAML scalar where there...
#define LLVM_YAML_STRONG_TYPEDEF(_base, _type)
YAML I/O does conversion based on types.
CPUType
These values correspond to the CV_CPU_TYPE_e enumeration, and are documented here: https://msdn...
This class should be specialized by type that requires custom conversion to/from a yaml scalar...
ArrayRef< EnumEntry< uint8_t > > getProcSymFlagNames()
ArrayRef< EnumEntry< uint32_t > > getCompileSym2FlagNames()
#define LLVM_YAML_DECLARE_SCALAR_TRAITS(Type, MustQuote)
#define LLVM_YAML_DECLARE_BITSET_TRAITS(Type)
std::shared_ptr< detail::SymbolRecordBase > Symbol
ArrayRef< EnumEntry< uint16_t > > getTrampolineNames()
codeview::CVSymbol toCodeViewSymbol(BumpPtrAllocator &Allocator, codeview::CodeViewContainer Container) const
Specialized YAMLIO scalar type for representing a binary blob.
static std::vector< std::string > Flags
ArrayRef< uint8_t > RecordData
constexpr char TypeName[]
Key for Kernel::Arg::Metadata::mTypeName.
SymbolKind
Duplicate copy of the above enum, but using the official CV names.
ThunkOrdinal
These values correspond to the THUNK_ORDINAL enumeration.
virtual bool outputting()=0
This class should be specialized by any integer type that is a union of bit values and the YAML repre...
ArrayRef< T > drop_front(size_t N=1) const
Drop the first N elements of the array.
A raw_ostream that writes to an std::string.
LLVM Value Representation.
static void mapSymbolRecordImpl(IO &IO, const char *Class, SymbolKind Kind, CodeViewYAML::SymbolRecord &Obj)
Lightweight error class with error context and mandatory checking.
ArrayRef< EnumEntry< uint16_t > > getLocalFlagNames()
This class implements an extremely fast bulk output stream that can only output to a stream...
static void mapping(IO &io, SymbolRecordBase &Record)
StringRef - Represent a constant reference to a string, i.e.
void mapRequired(const char *Key, T &Val)
CVSymbol toCodeViewSymbol(BumpPtrAllocator &Allocator, CodeViewContainer Container) const override
ProcSymFlags
Corresponds to the CV_PROCFLAGS bitfield.
LocalSymFlags
Corresponds to CV_LVARFLAGS bitfield.
CompileSym2Flags
Corresponds to COMPILESYM2::Flags bitfield.