LLVM: lib/DebugInfo/CodeView/CVSymbolVisitor.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

10

15

16using namespace llvm;

18

20 : Callbacks(Callbacks) {}

21

22template

26 T KnownRecord(RK);

27 if (auto EC = Callbacks.visitKnownRecord(Record, KnownRecord))

28 return EC;

30}

31

34 switch (Record.kind()) {

35 default:

37 return EC;

38 break;

39#define SYMBOL_RECORD(EnumName, EnumVal, Name) \

40 case EnumName: { \

41 if (auto EC = visitKnownRecord(Record, Callbacks)) \

42 return EC; \

43 break; \

44 }

45#define SYMBOL_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) \

46 SYMBOL_RECORD(EnumVal, EnumVal, AliasName)

47#include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"

48 }

49

51 return EC;

52

54}

55

57 if (auto EC = Callbacks.visitSymbolBegin(Record))

58 return EC;

60}

61

67

75

80 return EC;

81 InitialOffset += I.length();

82 }

84}

85

88 if (Filter.SymbolOffset)

91 uint32_t ParentRecurseDepth = Filter.ParentRecursiveDepth.value_or(0);

92 uint32_t ChildrenRecurseDepth = Filter.ChildRecursiveDepth.value_or(0);

93 if (Symbols.isOffsetValid(SymbolOffset))

98

99 std::vector<uint32_t> ParentOffsets;

100 std::vector<uint32_t> ParentEndOffsets;

102 for (auto Begin = Symbols.begin(), End = Symbols.end(); Begin != End;

103 ++Begin) {

104 uint32_t BeginOffset = Begin.offset();

106 if (BeginOffset < SymbolOffset) {

109 if (SymbolOffset < EndOffset) {

110 ParentOffsets.push_back(BeginOffset);

111 ParentEndOffsets.push_back(EndOffset);

112 }

113 }

114 } else if (BeginOffset == SymbolOffset) {

115

116 if (ParentRecurseDepth >= ParentOffsets.size())

117 ParentRecurseDepth = ParentOffsets.size();

118 uint32_t StartIndex = ParentOffsets.size() - ParentRecurseDepth;

119 while (StartIndex < ParentOffsets.size()) {

120 if (Symbols.isOffsetValid(ParentOffsets[StartIndex]))

121 break;

122 CVSymbol Parent = *Symbols.at(ParentOffsets[StartIndex]);

124 return EC;

125 ++StartIndex;

126 }

128 return EC;

129 } else if (BeginOffset <= SymEndOffset) {

130 if (ChildrenRecurseDepth) {

131

133 --ChildrenDepth;

134 if (ChildrenDepth < ChildrenRecurseDepth ||

135 BeginOffset == SymEndOffset) {

137 return EC;

138 }

140 ++ChildrenDepth;

141 }

142 } else {

143

144 if (ParentRecurseDepth && BeginOffset == ParentEndOffsets.back()) {

146 return EC;

147 ParentEndOffsets.pop_back();

148 --ParentRecurseDepth;

149 }

150 }

151 }

153}

Lightweight arrays that are backed by an arbitrary BinaryStream.

static Error finishVisitation(CVSymbol &Record, SymbolVisitorCallbacks &Callbacks)

Definition CVSymbolVisitor.cpp:32

static Error visitKnownRecord(CVSymbol &Record, SymbolVisitorCallbacks &Callbacks)

Definition CVSymbolVisitor.cpp:23

Lightweight error class with error context and mandatory checking.

static ErrorSuccess success()

Create a success value.

LLVM_ABI CVSymbolVisitor(SymbolVisitorCallbacks &Callbacks)

Definition CVSymbolVisitor.cpp:19

LLVM_ABI Error visitSymbolStreamFiltered(const CVSymbolArray &Symbols, const FilterOptions &Filter)

Definition CVSymbolVisitor.cpp:86

LLVM_ABI Error visitSymbolRecord(CVSymbol &Record)

Definition CVSymbolVisitor.cpp:56

LLVM_ABI Error visitSymbolStream(const CVSymbolArray &Symbols)

Definition CVSymbolVisitor.cpp:68

virtual Error visitSymbolEnd(CVSymbol &Record)

virtual Error visitUnknownSymbol(CVSymbol &Record)

Action to take on unknown symbols. By default, they are ignored.

VarStreamArray< CVSymbol > CVSymbolArray

CVRecord< SymbolKind > CVSymbol

bool symbolEndsScope(SymbolKind Kind)

Return true if this ssymbol ends a scope.

SymbolRecordKind

Distinguishes individual records in the Symbols subsection of a .debug$S section.

LLVM_ABI uint32_t getScopeEndOffset(const CVSymbol &Symbol)

Given a symbol P for which symbolOpensScope(P) == true, return the corresponding end offset.

bool symbolOpensScope(SymbolKind Kind)

Return true if this symbol opens a scope.

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI std::error_code inconvertibleErrorCode()

The value returned by this function can be returned from convertToErrorCode for Error values where no...

Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)

Create formatted StringError object.