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, DefRangeRegisterSym &DefRangeRegister) {
342 printLocalVariableAddrRange(DefRangeRegister.
Range,
344 printLocalVariableAddrGap(DefRangeRegister.
Gaps);
348Error CVSymbolDumperImpl::visitKnownRecord(
349 CVSymbol &CVR, DefRangeSubfieldRegisterSym &DefRangeSubfieldRegister) {
354 printLocalVariableAddrRange(DefRangeSubfieldRegister.
Range,
356 printLocalVariableAddrGap(DefRangeSubfieldRegister.
Gaps);
360Error CVSymbolDumperImpl::visitKnownRecord(
361 CVSymbol &CVR, DefRangeSubfieldSym &DefRangeSubfield) {
363 DebugStringTableSubsectionRef Strings = ObjDelegate->
getStringTable();
365 if (!ExpectedProgram) {
368 "String table offset outside of bounds of String Table!");
373 printLocalVariableAddrRange(DefRangeSubfield.
Range,
375 printLocalVariableAddrGap(DefRangeSubfield.
Gaps);
380 DefRangeSym &DefRange) {
382 DebugStringTableSubsectionRef Strings = ObjDelegate->
getStringTable();
384 if (!ExpectedProgram) {
387 "String table offset outside of bounds of String Table!");
392 printLocalVariableAddrGap(DefRange.
Gaps);
397 FrameCookieSym &FrameCookie) {
413 FrameProcSym &FrameProc) {
417 W.
printHex(
"BytesOfCalleeSavedRegisters",
420 W.
printHex(
"SectionIdOfExceptionHandler",
433Error CVSymbolDumperImpl::visitKnownRecord(
434 CVSymbol &CVR, HeapAllocationSiteSym &HeapAllocSite) {
455 ListScope BinaryAnnotations(W,
"BinaryAnnotations");
456 for (
auto &Annotation :
InlineSite.annotations()) {
458 case BinaryAnnotationsOpCode::Invalid:
461 case BinaryAnnotationsOpCode::CodeOffset:
462 case BinaryAnnotationsOpCode::ChangeCodeOffset:
463 case BinaryAnnotationsOpCode::ChangeCodeLength:
466 case BinaryAnnotationsOpCode::ChangeCodeOffsetBase:
467 case BinaryAnnotationsOpCode::ChangeLineEndDelta:
468 case BinaryAnnotationsOpCode::ChangeRangeKind:
469 case BinaryAnnotationsOpCode::ChangeColumnStart:
470 case BinaryAnnotationsOpCode::ChangeColumnEnd:
473 case BinaryAnnotationsOpCode::ChangeLineOffset:
474 case BinaryAnnotationsOpCode::ChangeColumnEndDelta:
477 case BinaryAnnotationsOpCode::ChangeFile:
487 case BinaryAnnotationsOpCode::ChangeCodeOffsetAndLineOffset: {
488 W.
startLine() <<
"ChangeCodeOffsetAndLineOffset: {CodeOffset: "
493 case BinaryAnnotationsOpCode::ChangeCodeLengthAndCodeOffset: {
494 W.
startLine() <<
"ChangeCodeLengthAndCodeOffset: {CodeOffset: "
521Error CVSymbolDumperImpl::visitKnownRecord(
CVSymbol &CVR, ProcRefSym &ProcRef) {
529Error CVSymbolDumperImpl::visitKnownRecord(
CVSymbol &CVR, LabelSym &Label) {
551Error CVSymbolDumperImpl::visitKnownRecord(
CVSymbol &CVR, ObjNameSym &ObjName) {
557Error CVSymbolDumperImpl::visitKnownRecord(
CVSymbol &CVR, ProcSym &Proc) {
560 "Visiting a ProcSym while inside function scope!");
562 InFunctionScope =
true;
586 ScopeEndSym &ScopeEnd) {
587 InFunctionScope =
false;
591Error CVSymbolDumperImpl::visitKnownRecord(
CVSymbol &CVR, CallerSym &Caller) {
592 llvm::StringRef ScopeName;
593 switch (CVR.
kind()) {
595 ScopeName =
"Callees";
598 ScopeName =
"Callers";
601 ScopeName =
"Inlinees";
605 "Unknown CV Record type for a CallerSym object!");
607 ListScope S(W, ScopeName);
608 for (
auto FuncID :
Caller.Indices)
614 RegRelativeSym &RegRel) {
624 ThreadLocalDataSym &
Data) {
637Error CVSymbolDumperImpl::visitKnownRecord(
CVSymbol &CVR, UDTSym &UDT) {
644 UsingNamespaceSym &UN) {
650 AnnotationSym &Annot) {
654 ListScope S(W,
"Strings");
655 for (StringRef Str : Annot.
Strings)
662 JumpTableSym &JumpTable) {
676 HotPatchFuncSym &HotPatchFunc) {
690 CVSymbolDumperImpl Dumper(Types, ObjDelegate.get(), W, CompilationCPUType,
697 CompilationCPUType = Dumper.getCompilationCPUType();
704 CVSymbolDumperImpl Dumper(Types, ObjDelegate.get(), W, CompilationCPUType,
711 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
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.