10 #ifndef LLVM_DEBUGINFO_CODEVIEW_SYMBOLRECORD_H
11 #define LLVM_DEBUGINFO_CODEVIEW_SYMBOLRECORD_H
43 static constexpr
uint32_t RelocationOffset = 32;
171 : Data(Other.Data) {}
174 return Data == Other.Data;
178 return !(*
this ==
Other);
187 if (!ParseCurrentAnnotation()) {
204 ParseCurrentAnnotation();
205 return Current.getValue();
210 if (Annotations.
empty())
213 uint8_t FirstByte = Annotations.
front();
216 if ((FirstByte & 0x80) == 0x00)
219 if (Annotations.
empty())
222 uint8_t SecondByte = Annotations.
front();
225 if ((FirstByte & 0xC0) == 0x80)
226 return ((FirstByte & 0x3F) << 8) | SecondByte;
228 if (Annotations.
empty())
231 uint8_t ThirdByte = Annotations.
front();
234 if (Annotations.
empty())
237 uint8_t FourthByte = Annotations.
front();
240 if ((FirstByte & 0xE0) == 0xC0)
241 return ((FirstByte & 0x1F) << 24) | (SecondByte << 16) |
242 (ThirdByte << 8) | FourthByte;
247 static int32_t DecodeSignedOperand(
uint32_t Operand) {
249 return -(Operand >> 1);
253 static int32_t DecodeSignedOperand(ArrayRef<uint8_t> &Annotations) {
254 return DecodeSignedOperand(GetCompressedAnnotation(Annotations));
257 bool ParseCurrentAnnotation() {
258 if (Current.hasValue())
263 AnnotationData Result;
265 switch (Result.OpCode) {
267 Result.Name =
"Invalid";
268 Next = ArrayRef<uint8_t>();
271 Result.Name =
"CodeOffset";
272 Result.U1 = GetCompressedAnnotation(Next);
275 Result.Name =
"ChangeCodeOffsetBase";
276 Result.U1 = GetCompressedAnnotation(Next);
279 Result.Name =
"ChangeCodeOffset";
280 Result.U1 = GetCompressedAnnotation(Next);
283 Result.Name =
"ChangeCodeLength";
284 Result.U1 = GetCompressedAnnotation(Next);
287 Result.Name =
"ChangeFile";
288 Result.U1 = GetCompressedAnnotation(Next);
291 Result.Name =
"ChangeLineEndDelta";
292 Result.U1 = GetCompressedAnnotation(Next);
295 Result.Name =
"ChangeRangeKind";
296 Result.U1 = GetCompressedAnnotation(Next);
299 Result.Name =
"ChangeColumnStart";
300 Result.U1 = GetCompressedAnnotation(Next);
303 Result.Name =
"ChangeColumnEnd";
304 Result.U1 = GetCompressedAnnotation(Next);
307 Result.Name =
"ChangeLineOffset";
308 Result.S1 = DecodeSignedOperand(Next);
311 Result.Name =
"ChangeColumnEndDelta";
312 Result.S1 = DecodeSignedOperand(Next);
315 Result.Name =
"ChangeCodeOffsetAndLineOffset";
317 Result.S1 = DecodeSignedOperand(Annotation >> 4);
318 Result.U1 = Annotation & 0xf;
322 Result.Name =
"ChangeCodeLengthAndCodeOffset";
323 Result.U1 = GetCompressedAnnotation(Next);
324 Result.U2 = GetCompressedAnnotation(Next);
332 Optional<AnnotationData> Current;
333 ArrayRef<uint8_t> Data;
334 ArrayRef<uint8_t> Next;
343 RecordOffset(RecordOffset) {}
364 RecordOffset(RecordOffset) {}
380 RecordOffset(RecordOffset) {}
434 static constexpr
uint32_t RelocationOffset = 8;
440 RecordOffset(RecordOffset) {}
448 std::vector<LocalVariableAddrGap>
Gaps;
455 static constexpr
uint32_t RelocationOffset = 12;
461 RecordOffset(RecordOffset) {}
470 std::vector<LocalVariableAddrGap>
Gaps;
486 RecordOffset(RecordOffset) {}
492 std::vector<LocalVariableAddrGap>
Gaps;
510 RecordOffset(RecordOffset) {}
516 std::vector<LocalVariableAddrGap>
Gaps;
523 static constexpr
uint32_t RelocationOffset = 8;
530 RecordOffset(RecordOffset) {}
538 std::vector<LocalVariableAddrGap>
Gaps;
555 RecordOffset(RecordOffset) {}
573 std::vector<LocalVariableAddrGap>
Gaps;
585 RecordOffset(RecordOffset) {}
594 static constexpr
uint32_t RelocationOffset = 16;
617 static constexpr
uint32_t RelocationOffset = 4;
656 RecordOffset(RecordOffset) {}
683 RecordOffset(RecordOffset) {}
699 RecordOffset(RecordOffset) {}
724 RecordOffset(RecordOffset) {}
754 RecordOffset(RecordOffset) {}
769 static constexpr
uint32_t RelocationOffset = 4;
789 static constexpr
uint32_t RelocationOffset = 4;
795 RecordOffset(RecordOffset) {}
811 static constexpr
uint32_t RelocationOffset = 4;
849 RecordOffset(RecordOffset) {}
862 RecordOffset(RecordOffset) {}
877 RecordOffset(RecordOffset) {}
893 RecordOffset(RecordOffset) {}
904 static constexpr
uint32_t RelocationOffset = 8;
925 static constexpr
uint32_t RelocationOffset = 8;
931 RecordOffset(RecordOffset) {}
951 #endif // LLVM_DEBUGINFO_CODEVIEW_SYMBOLRECORD_H
uint32_t getRelocationOffset() const
DefRangeFramePointerRelSym(SymbolRecordKind Kind)
uint32_t ModFilenameOffset
uint32_t OffsetOfExceptionHandler
SymbolRecordKind
Distinguishes individual records in the Symbols subsection of a .debug$S section. ...
ObjNameSym(uint32_t RecordOffset)
bool operator!=(const BinaryAnnotationIterator &Other) const
Thunk32Sym(SymbolRecordKind Kind, uint32_t RecordOffset)
CompileSym3Flags
Corresponds to COMPILESYM3::Flags bitfield.
uint32_t getRelocationOffset() const
DefRangeSubfieldRegisterSym(SymbolRecordKind Kind)
UDTSym(SymbolRecordKind Kind)
BPRelativeSym(SymbolRecordKind Kind)
const T & front() const
front - Get the first element.
LocalSym(SymbolRecordKind Kind)
uint16_t SectionIdOfExceptionHandler
PublicSym32(SymbolRecordKind Kind)
FrameProcedureOptions Flags
uint32_t getRelocationOffset() const
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
uint32_t BytesOfCalleeSavedRegisters
SymbolRecordKind getKind() const
uint32_t getRelocationOffset() const
ProcRefSym(uint32_t RecordOffset)
uint16_t VersionBackendMinor
ScopeEndSym(SymbolRecordKind Kind)
detail::packed_endian_specific_integral< uint16_t, little, unaligned > ulittle16_t
bool hasSpilledUDTMember() const
BlockSym(uint32_t RecordOffset)
uint16_t VersionFrontendMajor
ConstantSym(uint32_t RecordOffset)
iterator_range< BinaryAnnotationIterator > annotations() const
RegRelativeSym(SymbolRecordKind Kind)
ConstantSym(SymbolRecordKind Kind)
std::vector< LocalVariableAddrGap > Gaps
EnvBlockSym(SymbolRecordKind Kind)
ArrayRef< uint8_t > VariantData
void setLanguage(SourceLanguage Lang)
UDTSym(uint32_t RecordOffset)
uint16_t VersionBackendBuild
CallerSym(SymbolRecordKind Kind, uint32_t RecordOffset)
std::vector< LocalVariableAddrGap > Gaps
std::vector< uint8_t > AnnotationData
DefRangeRegisterSym(uint32_t RecordOffset)
uint16_t VersionFrontendMajor
uint16_t VersionFrontendQFE
ProcRefSym(SymbolRecordKind Kind)
ThreadLocalDataSym(uint32_t RecordOffset)
DefRangeRegisterRelSym(uint32_t RecordOffset)
uint16_t VersionBackendMajor
LabelSym(SymbolRecordKind Kind)
bool operator==(BinaryAnnotationIterator Other) const
EnvBlockSym(uint32_t RecordOffset)
std::vector< StringRef > ExtraStrings
BinaryAnnotationIterator(const BinaryAnnotationIterator &Other)
PublicSymFlags
Corresponds to the CV_PUBSYMFLAGS bitfield.
uint32_t getRelocationOffset() const
CallSiteInfoSym(SymbolRecordKind Kind)
uint16_t CallInstructionSize
uint32_t getRelocationOffset() const
BinaryAnnotationIterator()=default
RegisterSym(SymbolRecordKind Kind)
InlineSiteSym(uint32_t RecordOffset)
uint32_t getRelocationOffset() const
BinaryAnnotationIterator(ArrayRef< uint8_t > Annotations)
BlockSym(SymbolRecordKind Kind)
uint16_t VersionFrontendBuild
FrameCookieSym(SymbolRecordKind Kind)
DataSym(uint32_t RecordOffset)
std::vector< LocalVariableAddrGap > Gaps
ExportSym(uint32_t RecordOffset)
detail::packed_endian_specific_integral< uint32_t, little, unaligned > ulittle32_t
FrameProcSym(SymbolRecordKind Kind)
RegRelativeSym(uint32_t RecordOffset)
HeapAllocationSiteSym(uint32_t RecordOffset)
std::vector< StringRef > Fields
LocalVariableAddrRange Range
LocalVariableAddrRange Range
uint32_t getRelocationOffset() const
uint32_t getRelocationOffset() const
uint16_t offsetInParent() const
BPRelativeSym(uint32_t RecordOffset)
DefRangeSym(uint32_t RecordOffset)
DefRangeRegisterSym(SymbolRecordKind Kind)
BinaryAnnotationIterator operator++(int)
DataSym(SymbolRecordKind Kind)
uint16_t VersionBackendMajor
SectionSym(SymbolRecordKind Kind, uint32_t RecordOffset)
uint32_t getRelocationOffset() const
std::vector< TypeIndex > Indices
bool empty() const
empty - Check if the array is empty.
BinaryAnnotationsOpCode OpCode
const AnnotationData & operator*()
LocalVariableAddrRange Range
ProcSym(SymbolRecordKind Kind, uint32_t RecordOffset)
DefRangeSym(SymbolRecordKind Kind)
std::vector< LocalVariableAddrGap > Gaps
BinaryAnnotationIterator & operator=(const BinaryAnnotationIterator Other)
PublicSym32(uint32_t RecordOffset)
BinaryAnnotationIterator & operator++()
LocalVariableAddrRange Range
uint16_t VersionFrontendMinor
uint16_t VersionFrontendMinor
ThreadLocalDataSym(SymbolRecordKind Kind)
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
uint32_t getFlags() const
SourceLanguage
These values correspond to the CV_CFL_LANG enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx.
LocalVariableAddrRange Range
uint16_t VersionBackendMinor
CPUType
These values correspond to the CV_CPU_TYPE_e enumeration, and are documented here: https://msdn...
LocalVariableAddrRange Range
uint8_t getLanguage() const
TrampolineSym(SymbolRecordKind Kind, uint32_t RecordOffset)
DefRangeFramePointerRelFullScopeSym(uint32_t RecordOffset)
Compile3Sym(SymbolRecordKind Kind)
uint32_t PaddingFrameBytes
uint8_t getLanguage() const
FrameProcSym(uint32_t RecordOffset)
A range adaptor for a pair of iterators.
Thunk32Sym(SymbolRecordKind Kind)
FrameCookieSym(uint32_t RecordOffset)
ScopeEndSym(SymbolRecordKind Kind, uint32_t RecordOffset)
CoffGroupSym(SymbolRecordKind Kind)
std::vector< LocalVariableAddrGap > Gaps
DefRangeFramePointerRelSym(uint32_t RecordOffset)
uint16_t VersionBackendBuild
LabelSym(uint32_t RecordOffset)
detail::packed_endian_specific_integral< int32_t, little, unaligned > little32_t
HeapAllocationSiteSym(SymbolRecordKind Kind)
uint32_t getRelocationOffset() const
InlineSiteSym(SymbolRecordKind Kind)
SectionSym(SymbolRecordKind Kind)
CallerSym(SymbolRecordKind Kind)
LocalSym(uint32_t RecordOffset)
uint32_t getRelocationOffset() const
FileStaticSym(SymbolRecordKind Kind)
ThunkOrdinal
These values correspond to the THUNK_ORDINAL enumeration.
RegisterSym(uint32_t RecordOffset)
uint32_t getFlags() const
CoffGroupSym(SymbolRecordKind Kind, uint32_t RecordOffset)
TrampolineSym(SymbolRecordKind Kind)
std::vector< LocalVariableAddrGap > Gaps
ArrayRef< T > drop_front(size_t N=1) const
Drop the first N elements of the array.
uint16_t VersionBackendQFE
DefRangeFramePointerRelFullScopeSym(SymbolRecordKind Kind)
Compile3Sym(uint32_t RecordOffset)
BuildInfoSym(SymbolRecordKind Kind)
uint32_t getRelocationOffset() const
DefRangeRegisterRelSym(SymbolRecordKind Kind)
BuildInfoSym(uint32_t RecordOffset)
CallSiteInfoSym(uint32_t RecordOffset)
ObjNameSym(SymbolRecordKind Kind)
uint32_t getRelocationOffset() const
ProcSym(SymbolRecordKind Kind)
StringRef - Represent a constant reference to a string, i.e.
ProcSymFlags
Corresponds to the CV_PROCFLAGS bitfield.
LocalSymFlags
Corresponds to CV_LVARFLAGS bitfield.
Compile2Sym(SymbolRecordKind Kind)
DefRangeSubfieldRegisterSym(uint32_t RecordOffset)
FrameCookieKind CookieKind
FileStaticSym(uint32_t RecordOffset)
DefRangeSubfieldSym(uint32_t RecordOffset)
CompileSym2Flags
Corresponds to COMPILESYM2::Flags bitfield.
ExportSym(SymbolRecordKind Kind)
DefRangeSubfieldSym(SymbolRecordKind Kind)
SymbolRecord(SymbolRecordKind Kind)
Compile2Sym(uint32_t RecordOffset)
uint16_t VersionFrontendBuild