42 LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(
TypeIndex)
59 LLVM_YAML_DECLARE_ENUM_TRAITS(
CPUType)
69 return ScalarTraits<StringRef>::input(S, V, T.value);
72 void ScalarTraits<TypeName>::output(
const TypeName &
T,
void *V,
74 ScalarTraits<StringRef>::output(T.value, V, R);
77 void ScalarEnumerationTraits<SymbolKind>::enumeration(IO &io,
80 for (
const auto &
E : SymbolNames)
81 io.enumCase(Value,
E.Name.str().c_str(),
E.Value);
84 void ScalarBitSetTraits<CompileSym2Flags>::bitset(IO &io,
87 for (
const auto &
E : FlagNames) {
88 io.bitSetCase(Flags,
E.Name.str().c_str(),
93 void ScalarBitSetTraits<CompileSym3Flags>::bitset(IO &io,
96 for (
const auto &
E : FlagNames) {
97 io.bitSetCase(Flags,
E.Name.str().c_str(),
102 void ScalarBitSetTraits<ExportFlags>::bitset(IO &io,
ExportFlags &Flags) {
104 for (
const auto &
E : FlagNames) {
105 io.bitSetCase(Flags,
E.Name.str().c_str(),
110 void ScalarBitSetTraits<PublicSymFlags>::bitset(IO &io,
PublicSymFlags &Flags) {
112 for (
const auto &
E : FlagNames) {
113 io.bitSetCase(Flags,
E.Name.str().c_str(),
118 void ScalarBitSetTraits<LocalSymFlags>::bitset(IO &io,
LocalSymFlags &Flags) {
120 for (
const auto &
E : FlagNames) {
121 io.bitSetCase(Flags,
E.Name.str().c_str(),
126 void ScalarBitSetTraits<ProcSymFlags>::bitset(IO &io,
ProcSymFlags &Flags) {
128 for (
const auto &
E : FlagNames) {
129 io.bitSetCase(Flags,
E.Name.str().c_str(),
134 void ScalarBitSetTraits<FrameProcedureOptions>::bitset(
137 for (
const auto &
E : FlagNames) {
138 io.bitSetCase(Flags,
E.Name.str().c_str(),
143 void ScalarEnumerationTraits<CPUType>::enumeration(IO &io,
CPUType &Cpu) {
145 for (
const auto &
E : CpuNames) {
146 io.enumCase(Cpu,
E.Name.str().c_str(),
static_cast<CPUType>(
E.Value));
150 void ScalarEnumerationTraits<RegisterId>::enumeration(IO &io,
RegisterId &
Reg) {
152 for (
const auto &
E : RegNames) {
153 io.enumCase(Reg,
E.Name.str().c_str(),
static_cast<RegisterId>(
E.Value));
155 io.enumFallback<Hex16>(
Reg);
158 void ScalarEnumerationTraits<TrampolineType>::enumeration(
161 for (
const auto &
E : TrampNames) {
162 io.enumCase(Tramp,
E.Name.str().c_str(),
167 void ScalarEnumerationTraits<ThunkOrdinal>::enumeration(IO &io,
170 for (
const auto &
E : ThunkNames) {
171 io.enumCase(Ord,
E.Name.str().c_str(),
static_cast<ThunkOrdinal>(
E.Value));
175 void ScalarEnumerationTraits<FrameCookieKind>::enumeration(
178 for (
const auto &
E : ThunkNames) {
179 io.enumCase(FC,
E.Name.str().c_str(),
189 io.mapRequired(
"ISectStart", Range.
ISectStart);
190 io.mapRequired(
"Range", Range.
Range);
196 io.mapRequired(
"Range", Gap.
Range);
203 namespace CodeViewYAML {
212 virtual void map(yaml::IO &io) = 0;
223 void map(yaml::IO &io)
override;
232 return SymbolDeserializer::deserializeAs<T>(CVS,
Symbol);
241 void map(yaml::IO &io)
override;
249 uint8_t *Buffer = Allocator.
Allocate<uint8_t>(TotalLen);
266 void UnknownSymbolRecord::map(yaml::IO &io) {
270 io.mapRequired(
"Data", Binary);
271 if (!io.outputting()) {
276 Data.assign(Str.begin(), Str.end());
281 IO.mapRequired(
"Parent",
Symbol.Parent);
282 IO.mapRequired(
"End",
Symbol.End);
283 IO.mapRequired(
"Next",
Symbol.Next);
284 IO.mapRequired(
"Off",
Symbol.Offset);
285 IO.mapRequired(
"Seg",
Symbol.Segment);
286 IO.mapRequired(
"Len",
Symbol.Length);
287 IO.mapRequired(
"Ordinal",
Symbol.Thunk);
291 IO.mapRequired(
"Type",
Symbol.Type);
292 IO.mapRequired(
"Size",
Symbol.Size);
293 IO.mapRequired(
"ThunkOff",
Symbol.ThunkOffset);
294 IO.mapRequired(
"TargetOff",
Symbol.TargetOffset);
295 IO.mapRequired(
"ThunkSection",
Symbol.ThunkSection);
296 IO.mapRequired(
"TargetSection",
Symbol.TargetSection);
300 IO.mapRequired(
"SectionNumber",
Symbol.SectionNumber);
301 IO.mapRequired(
"Alignment",
Symbol.Alignment);
302 IO.mapRequired(
"Rva",
Symbol.Rva);
303 IO.mapRequired(
"Length",
Symbol.Length);
304 IO.mapRequired(
"Characteristics",
Symbol.Characteristics);
305 IO.mapRequired(
"Name",
Symbol.Name);
309 IO.mapRequired(
"Size",
Symbol.Size);
310 IO.mapRequired(
"Characteristics",
Symbol.Characteristics);
311 IO.mapRequired(
"Offset",
Symbol.Offset);
312 IO.mapRequired(
"Segment",
Symbol.Segment);
313 IO.mapRequired(
"Name",
Symbol.Name);
317 IO.mapRequired(
"Ordinal",
Symbol.Ordinal);
318 IO.mapRequired(
"Flags",
Symbol.Flags);
319 IO.mapRequired(
"Name",
Symbol.Name);
323 IO.mapOptional(
"PtrParent",
Symbol.Parent, 0U);
324 IO.mapOptional(
"PtrEnd",
Symbol.End, 0U);
325 IO.mapOptional(
"PtrNext",
Symbol.Next, 0U);
326 IO.mapRequired(
"CodeSize",
Symbol.CodeSize);
327 IO.mapRequired(
"DbgStart",
Symbol.DbgStart);
328 IO.mapRequired(
"DbgEnd",
Symbol.DbgEnd);
329 IO.mapRequired(
"FunctionType",
Symbol.FunctionType);
330 IO.mapOptional(
"Offset",
Symbol.CodeOffset, 0U);
331 IO.mapOptional(
"Segment",
Symbol.Segment, uint16_t(0));
332 IO.mapRequired(
"Flags",
Symbol.Flags);
333 IO.mapRequired(
"DisplayName",
Symbol.Name);
337 IO.mapRequired(
"Type",
Symbol.Index);
338 IO.mapRequired(
"Seg",
Symbol.Register);
339 IO.mapRequired(
"Name",
Symbol.Name);
343 IO.mapRequired(
"Flags",
Symbol.Flags);
344 IO.mapOptional(
"Offset",
Symbol.Offset, 0U);
345 IO.mapOptional(
"Segment",
Symbol.Segment, uint16_t(0));
346 IO.mapRequired(
"Name",
Symbol.Name);
350 IO.mapRequired(
"SumName",
Symbol.SumName);
351 IO.mapRequired(
"SymOffset",
Symbol.SymOffset);
352 IO.mapRequired(
"Mod",
Symbol.Module);
353 IO.mapRequired(
"Name",
Symbol.Name);
357 IO.mapRequired(
"Entries",
Symbol.Fields);
361 IO.mapOptional(
"PtrParent",
Symbol.Parent, 0U);
362 IO.mapOptional(
"PtrEnd",
Symbol.End, 0U);
363 IO.mapRequired(
"Inlinee",
Symbol.Inlinee);
368 IO.mapRequired(
"Type",
Symbol.Type);
369 IO.mapRequired(
"Flags",
Symbol.Flags);
371 IO.mapRequired(
"VarName",
Symbol.Name);
375 IO.mapRequired(
"Program",
Symbol.Program);
376 IO.mapRequired(
"Range",
Symbol.Range);
377 IO.mapRequired(
"Gaps",
Symbol.Gaps);
381 IO.mapRequired(
"Program",
Symbol.Program);
382 IO.mapRequired(
"OffsetInParent",
Symbol.OffsetInParent);
383 IO.mapRequired(
"Range",
Symbol.Range);
384 IO.mapRequired(
"Gaps",
Symbol.Gaps);
388 IO.mapRequired(
"Register",
Symbol.Hdr.Register);
389 IO.mapRequired(
"MayHaveNoName",
Symbol.Hdr.MayHaveNoName);
390 IO.mapRequired(
"Range",
Symbol.Range);
391 IO.mapRequired(
"Gaps",
Symbol.Gaps);
395 IO.mapRequired(
"Offset",
Symbol.Offset);
396 IO.mapRequired(
"Range",
Symbol.Range);
397 IO.mapRequired(
"Gaps",
Symbol.Gaps);
401 IO.mapRequired(
"Register",
Symbol.Hdr.Register);
402 IO.mapRequired(
"MayHaveNoName",
Symbol.Hdr.MayHaveNoName);
403 IO.mapRequired(
"OffsetInParent",
Symbol.Hdr.OffsetInParent);
404 IO.mapRequired(
"Range",
Symbol.Range);
405 IO.mapRequired(
"Gaps",
Symbol.Gaps);
410 IO.mapRequired(
"Register",
Symbol.Offset);
414 IO.mapRequired(
"Register",
Symbol.Hdr.Register);
415 IO.mapRequired(
"Flags",
Symbol.Hdr.Flags);
416 IO.mapRequired(
"BasePointerOffset",
Symbol.Hdr.BasePointerOffset);
417 IO.mapRequired(
"Range",
Symbol.Range);
418 IO.mapRequired(
"Gaps",
Symbol.Gaps);
422 IO.mapOptional(
"PtrParent",
Symbol.Parent, 0U);
423 IO.mapOptional(
"PtrEnd",
Symbol.End, 0U);
424 IO.mapRequired(
"CodeSize",
Symbol.CodeSize);
425 IO.mapOptional(
"Offset",
Symbol.CodeOffset, 0U);
426 IO.mapOptional(
"Segment",
Symbol.Segment, uint16_t(0));
427 IO.mapRequired(
"BlockName",
Symbol.Name);
431 IO.mapOptional(
"Offset",
Symbol.CodeOffset, 0U);
432 IO.mapOptional(
"Segment",
Symbol.Segment, uint16_t(0));
433 IO.mapRequired(
"Flags",
Symbol.Flags);
434 IO.mapRequired(
"Flags",
Symbol.Flags);
435 IO.mapRequired(
"DisplayName",
Symbol.Name);
439 IO.mapRequired(
"Signature",
Symbol.Signature);
440 IO.mapRequired(
"ObjectName",
Symbol.Name);
444 IO.mapRequired(
"Flags",
Symbol.Flags);
445 IO.mapRequired(
"Machine",
Symbol.Machine);
446 IO.mapRequired(
"FrontendMajor",
Symbol.VersionFrontendMajor);
447 IO.mapRequired(
"FrontendMinor",
Symbol.VersionFrontendMinor);
448 IO.mapRequired(
"FrontendBuild",
Symbol.VersionFrontendBuild);
449 IO.mapRequired(
"BackendMajor",
Symbol.VersionBackendMajor);
450 IO.mapRequired(
"BackendMinor",
Symbol.VersionBackendMinor);
451 IO.mapRequired(
"BackendBuild",
Symbol.VersionBackendBuild);
452 IO.mapRequired(
"Version",
Symbol.Version);
456 IO.mapRequired(
"Flags",
Symbol.Flags);
457 IO.mapRequired(
"Machine",
Symbol.Machine);
458 IO.mapRequired(
"FrontendMajor",
Symbol.VersionFrontendMajor);
459 IO.mapRequired(
"FrontendMinor",
Symbol.VersionFrontendMinor);
460 IO.mapRequired(
"FrontendBuild",
Symbol.VersionFrontendBuild);
461 IO.mapRequired(
"FrontendQFE",
Symbol.VersionFrontendQFE);
462 IO.mapRequired(
"BackendMajor",
Symbol.VersionBackendMajor);
463 IO.mapRequired(
"BackendMinor",
Symbol.VersionBackendMinor);
464 IO.mapRequired(
"BackendBuild",
Symbol.VersionBackendBuild);
465 IO.mapRequired(
"BackendQFE",
Symbol.VersionBackendQFE);
466 IO.mapRequired(
"Version",
Symbol.Version);
470 IO.mapRequired(
"TotalFrameBytes",
Symbol.TotalFrameBytes);
471 IO.mapRequired(
"PaddingFrameBytes",
Symbol.PaddingFrameBytes);
472 IO.mapRequired(
"OffsetToPadding",
Symbol.OffsetToPadding);
473 IO.mapRequired(
"BytesOfCalleeSavedRegisters",
474 Symbol.BytesOfCalleeSavedRegisters);
475 IO.mapRequired(
"OffsetOfExceptionHandler",
Symbol.OffsetOfExceptionHandler);
476 IO.mapRequired(
"SectionIdOfExceptionHandler",
477 Symbol.SectionIdOfExceptionHandler);
478 IO.mapRequired(
"Flags",
Symbol.Flags);
482 IO.mapOptional(
"Offset",
Symbol.CodeOffset, 0U);
483 IO.mapOptional(
"Segment",
Symbol.Segment, uint16_t(0));
484 IO.mapRequired(
"Type",
Symbol.Type);
488 IO.mapRequired(
"Index",
Symbol.Index);
489 IO.mapRequired(
"ModFilenameOffset",
Symbol.ModFilenameOffset);
490 IO.mapRequired(
"Flags",
Symbol.Flags);
491 IO.mapRequired(
"Name",
Symbol.Name);
495 IO.mapOptional(
"Offset",
Symbol.CodeOffset, 0U);
496 IO.mapOptional(
"Segment",
Symbol.Segment, uint16_t(0));
497 IO.mapRequired(
"CallInstructionSize",
Symbol.CallInstructionSize);
498 IO.mapRequired(
"Type",
Symbol.Type);
502 IO.mapRequired(
"Register",
Symbol.Register);
503 IO.mapRequired(
"CookieKind",
Symbol.CookieKind);
504 IO.mapRequired(
"Flags",
Symbol.Flags);
508 IO.mapRequired(
"FuncID",
Symbol.Indices);
512 IO.mapRequired(
"Type",
Symbol.Type);
513 IO.mapRequired(
"UDTName",
Symbol.Name);
517 IO.mapRequired(
"BuildId",
Symbol.BuildId);
521 IO.mapRequired(
"Offset",
Symbol.Offset);
522 IO.mapRequired(
"Type",
Symbol.Type);
523 IO.mapRequired(
"VarName",
Symbol.Name);
527 IO.mapRequired(
"Offset",
Symbol.Offset);
528 IO.mapRequired(
"Type",
Symbol.Type);
529 IO.mapRequired(
"Register",
Symbol.Register);
530 IO.mapRequired(
"VarName",
Symbol.Name);
534 IO.mapRequired(
"Type",
Symbol.Type);
535 IO.mapRequired(
"Value",
Symbol.Value);
536 IO.mapRequired(
"Name",
Symbol.Name);
540 IO.mapRequired(
"Type",
Symbol.Type);
541 IO.mapOptional(
"Offset",
Symbol.DataOffset, 0U);
542 IO.mapOptional(
"Segment",
Symbol.Segment, uint16_t(0));
543 IO.mapRequired(
"DisplayName",
Symbol.Name);
547 IO.mapRequired(
"Type",
Symbol.Type);
548 IO.mapOptional(
"Offset",
Symbol.DataOffset, 0U);
549 IO.mapOptional(
"Segment",
Symbol.Segment, uint16_t(0));
550 IO.mapRequired(
"DisplayName",
Symbol.Name);
554 IO.mapRequired(
"Namespace",
Symbol.Name);
563 return Symbol->toCodeViewSymbol(Allocator, Container);
576 template <
typename SymbolType>
581 auto Impl = std::make_shared<SymbolType>(Symbol.
kind());
582 if (
auto EC = Impl->fromCodeViewSymbol(Symbol))
583 return std::move(
EC);
590 #define SYMBOL_RECORD(EnumName, EnumVal, ClassName) \ 592 return fromCodeViewSymbolImpl<SymbolRecordImpl<ClassName>>(Symbol); 593 #define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName) \ 594 SYMBOL_RECORD(EnumName, EnumVal, ClassName) 595 switch (Symbol.
kind()) {
596 #include "llvm/DebugInfo/CodeView/CodeViewSymbols.def" 598 return fromCodeViewSymbolImpl<UnknownSymbolRecord>(
Symbol);
603 template <
typename ConcreteType>
606 if (!IO.outputting())
607 Obj.
Symbol = std::make_shared<ConcreteType>(Kind);
609 IO.mapRequired(Class, *Obj.
Symbol);
617 IO.mapRequired(
"Kind", Kind);
619 #define SYMBOL_RECORD(EnumName, EnumVal, ClassName) \ 621 mapSymbolRecordImpl<SymbolRecordImpl<ClassName>>(IO, #ClassName, Kind, \ 624 #define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, AliasName, ClassName) \ 625 SYMBOL_RECORD(EnumName, EnumVal, ClassName) 627 #include "llvm/DebugInfo/CodeView/CodeViewSymbols.def" 629 mapSymbolRecordImpl<UnknownSymbolRecord>(IO,
"UnknownSym",
Kind, Obj);
static void mapping(IO &io, LocalVariableAddrRange &Range)
SymbolRecordKind
Distinguishes individual records in the Symbols subsection of a .debug$S section. ...
This class represents lattice values for constants.
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.
ArrayRef< EnumEntry< uint32_t > > getPublicSymFlagNames()
CVRecord< SymbolKind > CVSymbol
ArrayRef< EnumEntry< uint8_t > > getThunkOrdinalNames()
Error fromCodeViewSymbol(codeview::CVSymbol CVS) override
Tagged union holding either a T or a Error.
UnknownSymbolRecord(codeview::SymbolKind K)
ArrayRef< EnumEntry< uint8_t > > getFrameCookieKindNames()
PublicSymFlags
Corresponds to the CV_PUBSYMFLAGS bitfield.
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.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
SymbolRecordImpl(codeview::SymbolKind K)
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...
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)
constexpr char TypeName[]
Key for Kernel::Arg::Metadata::mTypeName.
static void mapping(IO &io, LocalVariableAddrGap &Gap)
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()
CPUType
These values correspond to the CV_CPU_TYPE_e enumeration, and are documented here: https://msdn...
ArrayRef< EnumEntry< uint8_t > > getProcSymFlagNames()
ArrayRef< EnumEntry< uint32_t > > getCompileSym2FlagNames()
std::shared_ptr< detail::SymbolRecordBase > Symbol
ArrayRef< EnumEntry< uint16_t > > getTrampolineNames()
Specialized YAMLIO scalar type for representing a binary blob.
ArrayRef< uint8_t > RecordData
ArrayRef< T > drop_front(size_t N=1) const
Drop the first N elements of the array.
SymbolKind
Duplicate copy of the above enum, but using the official CV names.
ThunkOrdinal
These values correspond to the THUNK_ORDINAL enumeration.
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.
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.
codeview::CVSymbol toCodeViewSymbol(BumpPtrAllocator &Allocator, codeview::CodeViewContainer Container) const