31 CVSymbolDumperImpl(TypeCollection &Types, SymbolDumpDelegate *ObjDelegate,
32 ScopedPrinter &W,
CPUType CPU,
bool PrintRecordBytes)
33 : Types(Types), ObjDelegate(ObjDelegate), W(W), CompilationCPUType(CPU),
34 PrintRecordBytes(PrintRecordBytes), InFunctionScope(
false) {}
37#define SYMBOL_RECORD(EnumName, EnumVal, Name) \
38 Error visitKnownRecord(CVSymbol &CVR, Name &Record) override;
39#define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName)
40#include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"
46 CPUType getCompilationCPUType()
const {
return CompilationCPUType; }
49 void printLocalVariableAddrRange(
const LocalVariableAddrRange &
Range,
50 uint32_t RelocationOffset);
54 TypeCollection &Types;
55 SymbolDumpDelegate *ObjDelegate;
59 CPUType CompilationCPUType = CPUType::X64;
61 bool PrintRecordBytes;
68#define SYMBOL_RECORD(EnumName, EnumVal, Name) \
71#include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"
78void CVSymbolDumperImpl::printLocalVariableAddrRange(
80 DictScope S(W,
"LocalVariableAddrRange");
88void CVSymbolDumperImpl::printLocalVariableAddrGap(
90 for (
auto &Gap : Gaps) {
91 ListScope S(W,
"LocalVariableAddrGap");
92 W.
printHex(
"GapStartOffset", Gap.GapStartOffset);
97void CVSymbolDumperImpl::printTypeIndex(StringRef FieldName, TypeIndex TI) {
110 if (PrintRecordBytes && ObjDelegate)
133Error CVSymbolDumperImpl::visitKnownRecord(
CVSymbol &CVR, Thunk32Sym &Thunk) {
146 TrampolineSym &Tramp) {
156Error CVSymbolDumperImpl::visitKnownRecord(
CVSymbol &CVR, SectionSym &Section) {
170 CoffGroupSym &CoffGroup) {
182 BPRelativeSym &BPRel) {
190 BuildInfoSym &BuildInfo) {
211 EnvBlockSym &EnvBlock) {
212 ListScope
L(W,
"Entries");
213 for (
auto Entry : EnvBlock.
Fields) {
220 FileStaticSym &FileStatic) {
236 Compile2Sym &Compile2) {
240 CompilationCPUType = Compile2.
Machine;
241 std::string FrontendVersion;
243 raw_string_ostream Out(FrontendVersion);
247 std::string BackendVersion;
249 raw_string_ostream Out(BackendVersion);
260 Compile3Sym &Compile3) {
265 CompilationCPUType = Compile3.
Machine;
266 std::string FrontendVersion;
268 raw_string_ostream Out(FrontendVersion);
273 std::string BackendVersion;
275 raw_string_ostream Out(BackendVersion);
287 ConstantSym &Constant) {
307Error CVSymbolDumperImpl::visitKnownRecord(
309 DefRangeFramePointerRelFullScopeSym &DefRangeFramePointerRelFullScope) {
314Error CVSymbolDumperImpl::visitKnownRecord(
315 CVSymbol &CVR, DefRangeFramePointerRelSym &DefRangeFramePointerRel) {
317 printLocalVariableAddrRange(DefRangeFramePointerRel.
Range,
319 printLocalVariableAddrGap(DefRangeFramePointerRel.
Gaps);
323Error CVSymbolDumperImpl::visitKnownRecord(
324 CVSymbol &CVR, DefRangeRegisterRelSym &DefRangeRegisterRel) {
331 printLocalVariableAddrRange(DefRangeRegisterRel.
Range,
333 printLocalVariableAddrGap(DefRangeRegisterRel.
Gaps);
337Error CVSymbolDumperImpl::visitKnownRecord(
338 CVSymbol &CVR, DefRangeRegisterRelIndirSym &DefRangeRegisterRelIndir) {
347 printLocalVariableAddrRange(DefRangeRegisterRelIndir.
Range,
349 printLocalVariableAddrGap(DefRangeRegisterRelIndir.
Gaps);
353Error CVSymbolDumperImpl::visitKnownRecord(
354 CVSymbol &CVR, DefRangeRegisterSym &DefRangeRegister) {
358 printLocalVariableAddrRange(DefRangeRegister.
Range,
360 printLocalVariableAddrGap(DefRangeRegister.
Gaps);
364Error CVSymbolDumperImpl::visitKnownRecord(
365 CVSymbol &CVR, DefRangeSubfieldRegisterSym &DefRangeSubfieldRegister) {
370 printLocalVariableAddrRange(DefRangeSubfieldRegister.
Range,
372 printLocalVariableAddrGap(DefRangeSubfieldRegister.
Gaps);
376Error CVSymbolDumperImpl::visitKnownRecord(
377 CVSymbol &CVR, DefRangeSubfieldSym &DefRangeSubfield) {
379 DebugStringTableSubsectionRef Strings = ObjDelegate->
getStringTable();
381 if (!ExpectedProgram) {
384 "String table offset outside of bounds of String Table!");
389 printLocalVariableAddrRange(DefRangeSubfield.
Range,
391 printLocalVariableAddrGap(DefRangeSubfield.
Gaps);
396 DefRangeSym &DefRange) {
398 DebugStringTableSubsectionRef Strings = ObjDelegate->
getStringTable();
400 if (!ExpectedProgram) {
403 "String table offset outside of bounds of String Table!");
408 printLocalVariableAddrGap(DefRange.
Gaps);
413 FrameCookieSym &FrameCookie) {
429 FrameProcSym &FrameProc) {
433 W.
printHex(
"BytesOfCalleeSavedRegisters",
436 W.
printHex(
"SectionIdOfExceptionHandler",
449Error CVSymbolDumperImpl::visitKnownRecord(
450 CVSymbol &CVR, HeapAllocationSiteSym &HeapAllocSite) {
471 ListScope BinaryAnnotations(W,
"BinaryAnnotations");
472 for (
auto &Annotation :
InlineSite.annotations()) {
474 case BinaryAnnotationsOpCode::Invalid:
477 case BinaryAnnotationsOpCode::CodeOffset:
478 case BinaryAnnotationsOpCode::ChangeCodeOffset:
479 case BinaryAnnotationsOpCode::ChangeCodeLength:
482 case BinaryAnnotationsOpCode::ChangeCodeOffsetBase:
483 case BinaryAnnotationsOpCode::ChangeLineEndDelta:
484 case BinaryAnnotationsOpCode::ChangeRangeKind:
485 case BinaryAnnotationsOpCode::ChangeColumnStart:
486 case BinaryAnnotationsOpCode::ChangeColumnEnd:
489 case BinaryAnnotationsOpCode::ChangeLineOffset:
490 case BinaryAnnotationsOpCode::ChangeColumnEndDelta:
493 case BinaryAnnotationsOpCode::ChangeFile:
503 case BinaryAnnotationsOpCode::ChangeCodeOffsetAndLineOffset: {
504 W.
startLine() <<
"ChangeCodeOffsetAndLineOffset: {CodeOffset: "
509 case BinaryAnnotationsOpCode::ChangeCodeLengthAndCodeOffset: {
510 W.
startLine() <<
"ChangeCodeLengthAndCodeOffset: {CodeOffset: "
537Error CVSymbolDumperImpl::visitKnownRecord(
CVSymbol &CVR, ProcRefSym &ProcRef) {
545Error CVSymbolDumperImpl::visitKnownRecord(
CVSymbol &CVR, LabelSym &Label) {
567Error CVSymbolDumperImpl::visitKnownRecord(
CVSymbol &CVR, ObjNameSym &ObjName) {
573Error CVSymbolDumperImpl::visitKnownRecord(
CVSymbol &CVR, ProcSym &Proc) {
576 "Visiting a ProcSym while inside function scope!");
578 InFunctionScope =
true;
602 ScopeEndSym &ScopeEnd) {
603 InFunctionScope =
false;
607Error CVSymbolDumperImpl::visitKnownRecord(
CVSymbol &CVR, CallerSym &Caller) {
608 llvm::StringRef ScopeName;
609 switch (CVR.
kind()) {
611 ScopeName =
"Callees";
614 ScopeName =
"Callers";
617 ScopeName =
"Inlinees";
621 "Unknown CV Record type for a CallerSym object!");
623 ListScope S(W, ScopeName);
624 for (
auto FuncID :
Caller.Indices)
630 RegRelativeSym &RegRel) {
640 RegRelativeIndirSym &RegRelIndir) {
651 ThreadLocalDataSym &
Data) {
664Error CVSymbolDumperImpl::visitKnownRecord(
CVSymbol &CVR, UDTSym &UDT) {
671 UsingNamespaceSym &UN) {
677 AnnotationSym &Annot) {
681 ListScope S(W,
"Strings");
682 for (StringRef Str : Annot.
Strings)
689 JumpTableSym &JumpTable) {
703 HotPatchFuncSym &HotPatchFunc) {
717 CVSymbolDumperImpl Dumper(Types, ObjDelegate.get(), W, CompilationCPUType,
724 CompilationCPUType = Dumper.getCompilationCPUType();
731 CVSymbolDumperImpl Dumper(Types, ObjDelegate.get(), W, CompilationCPUType,
738 CompilationCPUType = Dumper.getCompilationCPUType();
Function Alias Analysis false
Promote Memory to Register
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
static StringRef getSymbolKindName(SymbolKind Kind)
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
virtual void printString(StringRef Value)
void indent(int Levels=1)
void unindent(int Levels=1)
void printEnum(StringRef Label, T Value, ArrayRef< EnumEntry< TEnum > > EnumValues)
virtual raw_ostream & getOStream()
virtual raw_ostream & startLine()
virtual void printNumber(StringRef Label, char Value)
void printHex(StringRef Label, T Value)
void printFlags(StringRef Label, T Value, ArrayRef< EnumEntry< TFlag > > Flags, TFlag EnumMask1={}, TFlag EnumMask2={}, TFlag EnumMask3={}, ArrayRef< FlagEntry > ExtraFlags={})
virtual void printBoolean(StringRef Label, bool Value)
StringRef - Represent a constant reference to a string, i.e.
std::vector< StringRef > Strings
CVRecord is a fat pointer (base + size pair) to a symbol or type record.
ArrayRef< uint8_t > content() const
LLVM_ABI Error dump(CVRecord< SymbolKind > &Record)
Dumps one type record.
LLVM_ABI Error visitSymbolRecord(CVSymbol &Record)
LLVM_ABI Error visitSymbolStream(const CVSymbolArray &Symbols)
uint8_t getLanguage() const
uint32_t getFlags() const
uint16_t VersionBackendMajor
uint16_t VersionFrontendMajor
uint16_t VersionBackendMinor
uint16_t VersionFrontendMinor
uint16_t VersionBackendBuild
uint16_t VersionFrontendBuild
CompileSym3Flags getFlags() const
uint16_t VersionBackendBuild
uint16_t VersionBackendQFE
SourceLanguage getLanguage() const
uint16_t VersionFrontendMajor
uint16_t VersionBackendMajor
uint16_t VersionBackendMinor
uint16_t VersionFrontendBuild
uint16_t VersionFrontendMinor
uint16_t VersionFrontendQFE
LLVM_ABI Expected< StringRef > getString(uint32_t Offset) const
DefRangeFramePointerRelHeader Hdr
LocalVariableAddrRange Range
uint32_t getRelocationOffset() const
std::vector< LocalVariableAddrGap > Gaps
uint16_t offsetInParent() const
std::vector< LocalVariableAddrGap > Gaps
uint32_t getRelocationOffset() const
bool hasSpilledUDTMember() const
DefRangeRegisterRelIndirHeader Hdr
LocalVariableAddrRange Range
DefRangeRegisterRelHeader Hdr
bool hasSpilledUDTMember() const
uint32_t getRelocationOffset() const
uint16_t offsetInParent() const
std::vector< LocalVariableAddrGap > Gaps
LocalVariableAddrRange Range
uint32_t getRelocationOffset() const
std::vector< LocalVariableAddrGap > Gaps
LocalVariableAddrRange Range
DefRangeRegisterHeader Hdr
LocalVariableAddrRange Range
uint32_t getRelocationOffset() const
std::vector< LocalVariableAddrGap > Gaps
DefRangeSubfieldRegisterHeader Hdr
std::vector< LocalVariableAddrGap > Gaps
LocalVariableAddrRange Range
uint32_t getRelocationOffset() const
std::vector< LocalVariableAddrGap > Gaps
uint32_t getRelocationOffset() const
LocalVariableAddrRange Range
std::vector< StringRef > Fields
FrameCookieKind CookieKind
uint32_t getRelocationOffset() const
uint32_t BytesOfCalleeSavedRegisters
uint16_t SectionIdOfExceptionHandler
uint32_t PaddingFrameBytes
RegisterId getLocalFramePtrReg(CPUType CPU) const
Extract the register this frame uses to refer to local variables.
RegisterId getParamFramePtrReg(CPUType CPU) const
Extract the register this frame uses to refer to parameters.
uint32_t OffsetOfExceptionHandler
FrameProcedureOptions Flags
uint16_t CallInstructionSize
uint32_t getRelocationOffset() const
uint32_t getRelocationOffset() const
virtual void printBinaryBlockWithRelocs(StringRef Label, ArrayRef< uint8_t > Block)=0
virtual void printRelocatedField(StringRef Label, uint32_t RelocOffset, uint32_t Offset, StringRef *RelocSym=nullptr)=0
void addCallbackToPipeline(SymbolVisitorCallbacks &Callbacks)
virtual DebugStringTableSubsectionRef getStringTable()=0
virtual StringRef getFileNameForFileOffset(uint32_t FileOffset)=0
VarStreamArray< CVSymbol > CVSymbolArray
CPUType
These values correspond to the CV_CPU_TYPE_e enumeration, and are documented here: https://msdn....
LLVM_ABI ArrayRef< EnumEntry< uint32_t > > getCompileSym2FlagNames()
LLVM_ABI ArrayRef< EnumEntry< COFF::SectionCharacteristics > > getImageSectionCharacteristicNames()
CVRecord< SymbolKind > CVSymbol
LLVM_ABI ArrayRef< EnumEntry< uint16_t > > getExportSymFlagNames()
LLVM_ABI ArrayRef< EnumEntry< uint16_t > > getJumpTableEntrySizeNames()
LLVM_ABI ArrayRef< EnumEntry< SymbolKind > > getSymbolTypeNames()
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< SourceLanguage > > getSourceLanguageNames()
LLVM_ABI ArrayRef< EnumEntry< uint32_t > > getFrameProcSymFlagNames()
LLVM_ABI ArrayRef< EnumEntry< uint16_t > > getTrampolineNames()
LLVM_ABI ArrayRef< EnumEntry< uint32_t > > getPublicSymFlagNames()
LLVM_ABI ArrayRef< EnumEntry< uint32_t > > getCompileSym3FlagNames()
LLVM_ABI ArrayRef< EnumEntry< uint8_t > > getFrameCookieKindNames()
LLVM_ABI void printTypeIndex(ScopedPrinter &Printer, StringRef FieldName, TypeIndex TI, TypeCollection &Types)
This is an optimization pass for GlobalISel generic memory operations.
std::tuple< uint64_t, uint32_t > InlineSite
@ Export
Export information to summary.
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
FunctionAddr VTableAddr uintptr_t uintptr_t Data
ArrayRef(const T &OneElt) -> ArrayRef< T >
void consumeError(Error Err)
Consume a Error without doing anything.