9#ifndef LLVM_DEBUGINFO_CODEVIEW_SYMBOLRECORD_H
10#define LLVM_DEBUGINFO_CODEVIEW_SYMBOLRECORD_H
42 static constexpr uint32_t RelocationOffset = 32;
190 std::forward_iterator_tag,
195 : Data(
Other.Data) {}
198 return Data ==
Other.Data;
207 if (!ParseCurrentAnnotation()) {
218 ParseCurrentAnnotation();
230 if ((FirstByte & 0x80) == 0x00)
239 if ((FirstByte & 0xC0) == 0x80)
240 return ((FirstByte & 0x3F) << 8) | SecondByte;
254 if ((FirstByte & 0xE0) == 0xC0)
255 return ((FirstByte & 0x1F) << 24) | (SecondByte << 16) |
256 (ThirdByte << 8) | FourthByte;
261 static int32_t DecodeSignedOperand(
uint32_t Operand) {
263 return -(Operand >> 1);
267 static int32_t DecodeSignedOperand(ArrayRef<uint8_t> &Annotations) {
268 return DecodeSignedOperand(GetCompressedAnnotation(Annotations));
271 bool ParseCurrentAnnotation() {
282 Next = ArrayRef<uint8_t>();
285 Result.Name =
"CodeOffset";
286 Result.U1 = GetCompressedAnnotation(Next);
289 Result.Name =
"ChangeCodeOffsetBase";
290 Result.U1 = GetCompressedAnnotation(Next);
293 Result.Name =
"ChangeCodeOffset";
294 Result.U1 = GetCompressedAnnotation(Next);
297 Result.Name =
"ChangeCodeLength";
298 Result.U1 = GetCompressedAnnotation(Next);
301 Result.Name =
"ChangeFile";
302 Result.U1 = GetCompressedAnnotation(Next);
305 Result.Name =
"ChangeLineEndDelta";
306 Result.U1 = GetCompressedAnnotation(Next);
309 Result.Name =
"ChangeRangeKind";
310 Result.U1 = GetCompressedAnnotation(Next);
313 Result.Name =
"ChangeColumnStart";
314 Result.U1 = GetCompressedAnnotation(Next);
317 Result.Name =
"ChangeColumnEnd";
318 Result.U1 = GetCompressedAnnotation(Next);
321 Result.Name =
"ChangeLineOffset";
322 Result.S1 = DecodeSignedOperand(Next);
325 Result.Name =
"ChangeColumnEndDelta";
326 Result.S1 = DecodeSignedOperand(Next);
329 Result.Name =
"ChangeCodeOffsetAndLineOffset";
331 Result.S1 = DecodeSignedOperand(Annotation >> 4);
336 Result.Name =
"ChangeCodeLengthAndCodeOffset";
337 Result.U1 = GetCompressedAnnotation(Next);
338 Result.U2 = GetCompressedAnnotation(Next);
347 std::optional<DecodedAnnotation> Current;
348 ArrayRef<uint8_t> Data;
349 ArrayRef<uint8_t> Next;
458 static constexpr uint32_t RelocationOffset = 8;
472 std::vector<LocalVariableAddrGap>
Gaps;
479 static constexpr uint32_t RelocationOffset = 12;
494 std::vector<LocalVariableAddrGap>
Gaps;
516 std::vector<LocalVariableAddrGap>
Gaps;
540 std::vector<LocalVariableAddrGap>
Gaps;
551 static constexpr uint32_t RelocationOffset = 8;
566 std::vector<LocalVariableAddrGap>
Gaps;
601 std::vector<LocalVariableAddrGap>
Gaps;
622 static constexpr uint32_t RelocationOffset = 16;
645 static constexpr uint32_t RelocationOffset = 4;
822 static constexpr uint32_t RelocationOffset = 4;
842 static constexpr uint32_t RelocationOffset = 4;
864 static constexpr uint32_t RelocationOffset = 4;
957 static constexpr uint32_t RelocationOffset = 8;
978 static constexpr uint32_t RelocationOffset = 8;
This file implements the APSInt class, which is a simple class that represents an arbitrary sized int...
Lightweight arrays that are backed by an arbitrary BinaryStream.
An arbitrary precision integer that knows its signedness.
Annotations lets you mark points and ranges inside source code, for tests:
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
ArrayRef< T > take_front(size_t N=1) const
Return a copy of *this with only the first N elements.
size_t size() const
size - Get the array size.
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
Tagged union holding either a T or a Error.
A Module instance is used to store all the information related to an LLVM module.
Wrapper class representing virtual and physical registers.
StringRef - Represent a constant reference to a string, i.e.
std::vector< StringRef > Strings
AnnotationSym(uint32_t RecordOffset)
AnnotationSym(SymbolRecordKind Kind)
BPRelativeSym(uint32_t RecordOffset)
BPRelativeSym(SymbolRecordKind Kind)
uint32_t getRelocationOffset() const
BlockSym(uint32_t RecordOffset)
BlockSym(SymbolRecordKind Kind)
BuildInfoSym(SymbolRecordKind Kind)
BuildInfoSym(uint32_t RecordOffset)
uint32_t getRelocationOffset() const
CallSiteInfoSym(SymbolRecordKind Kind)
CallSiteInfoSym(uint32_t RecordOffset)
CallerSym(SymbolRecordKind Kind, uint32_t RecordOffset)
std::vector< TypeIndex > Indices
CallerSym(SymbolRecordKind Kind)
CoffGroupSym(SymbolRecordKind Kind)
CoffGroupSym(SymbolRecordKind Kind, uint32_t RecordOffset)
uint8_t getLanguage() const
Compile2Sym(uint32_t RecordOffset)
uint32_t getFlags() const
Compile2Sym(SymbolRecordKind Kind)
uint16_t VersionBackendMajor
uint16_t VersionFrontendMajor
uint16_t VersionBackendMinor
uint16_t VersionFrontendMinor
uint16_t VersionBackendBuild
uint16_t VersionFrontendBuild
std::vector< StringRef > ExtraStrings
CompileSym3Flags getFlags() const
uint16_t VersionBackendBuild
Compile3Sym(SymbolRecordKind Kind)
uint16_t VersionBackendQFE
Compile3Sym(uint32_t RecordOffset)
SourceLanguage getLanguage() const
uint16_t VersionFrontendMajor
void setLanguage(SourceLanguage Lang)
bool hasOptimizations() const
uint16_t VersionBackendMajor
uint16_t VersionBackendMinor
uint16_t VersionFrontendBuild
uint16_t VersionFrontendMinor
uint16_t VersionFrontendQFE
ConstantSym(SymbolRecordKind Kind)
ConstantSym(uint32_t RecordOffset)
DataSym(uint32_t RecordOffset)
DataSym(SymbolRecordKind Kind)
uint32_t getRelocationOffset() const
DefRangeFramePointerRelFullScopeSym(SymbolRecordKind Kind)
DefRangeFramePointerRelFullScopeSym(uint32_t RecordOffset)
DefRangeFramePointerRelSym(SymbolRecordKind Kind)
DefRangeFramePointerRelSym(uint32_t RecordOffset)
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
DefRangeRegisterRelSym(uint32_t RecordOffset)
LocalVariableAddrRange Range
DefRangeRegisterRelSym(SymbolRecordKind Kind)
uint32_t getRelocationOffset() const
DefRangeRegisterSym(SymbolRecordKind Kind)
std::vector< LocalVariableAddrGap > Gaps
LocalVariableAddrRange Range
DefRangeRegisterSym(uint32_t RecordOffset)
DefRangeRegisterHeader Hdr
DefRangeSubfieldRegisterSym(SymbolRecordKind Kind)
LocalVariableAddrRange Range
uint32_t getRelocationOffset() const
std::vector< LocalVariableAddrGap > Gaps
DefRangeSubfieldRegisterHeader Hdr
DefRangeSubfieldRegisterSym(uint32_t RecordOffset)
DefRangeSubfieldSym(SymbolRecordKind Kind)
std::vector< LocalVariableAddrGap > Gaps
DefRangeSubfieldSym(uint32_t RecordOffset)
LocalVariableAddrRange Range
uint32_t getRelocationOffset() const
DefRangeSym(SymbolRecordKind Kind)
std::vector< LocalVariableAddrGap > Gaps
uint32_t getRelocationOffset() const
DefRangeSym(uint32_t RecordOffset)
LocalVariableAddrRange Range
EnvBlockSym(SymbolRecordKind Kind)
std::vector< StringRef > Fields
EnvBlockSym(uint32_t RecordOffset)
ExportSym(SymbolRecordKind Kind)
ExportSym(uint32_t RecordOffset)
FileStaticSym(uint32_t RecordOffset)
FileStaticSym(SymbolRecordKind Kind)
uint32_t ModFilenameOffset
FrameCookieSym(SymbolRecordKind Kind)
FrameCookieKind CookieKind
uint32_t getRelocationOffset() const
FrameCookieSym(uint32_t RecordOffset)
uint32_t BytesOfCalleeSavedRegisters
uint16_t SectionIdOfExceptionHandler
uint32_t PaddingFrameBytes
FrameProcSym(SymbolRecordKind Kind)
FrameProcSym(uint32_t RecordOffset)
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
HeapAllocationSiteSym(uint32_t RecordOffset)
HeapAllocationSiteSym(SymbolRecordKind Kind)
std::vector< uint8_t > AnnotationData
InlineSiteSym(SymbolRecordKind Kind)
iterator_range< BinaryAnnotationIterator > annotations() const
InlineSiteSym(uint32_t RecordOffset)
JumpTableSym(SymbolRecordKind Kind)
JumpTableEntrySize SwitchType
JumpTableSym(uint32_t RecordOffset)
uint32_t getRelocationOffset() const
LabelSym(SymbolRecordKind Kind)
LabelSym(uint32_t RecordOffset)
LocalSym(SymbolRecordKind Kind)
LocalSym(uint32_t RecordOffset)
ObjNameSym(SymbolRecordKind Kind)
ObjNameSym(uint32_t RecordOffset)
ProcRefSym(uint32_t RecordOffset)
ProcRefSym(SymbolRecordKind Kind)
ProcSym(SymbolRecordKind Kind, uint32_t RecordOffset)
uint32_t getRelocationOffset() const
ProcSym(SymbolRecordKind Kind)
PublicSym32(SymbolRecordKind Kind)
PublicSym32(uint32_t RecordOffset)
RegRelativeSym(SymbolRecordKind Kind)
RegRelativeSym(uint32_t RecordOffset)
RegisterSym(uint32_t RecordOffset)
RegisterSym(SymbolRecordKind Kind)
ScopeEndSym(SymbolRecordKind Kind, uint32_t RecordOffset)
ScopeEndSym(SymbolRecordKind Kind)
SectionSym(SymbolRecordKind Kind)
SectionSym(SymbolRecordKind Kind, uint32_t RecordOffset)
SymbolRecord(SymbolRecordKind Kind)
SymbolRecordKind getKind() const
ThreadLocalDataSym(uint32_t RecordOffset)
uint32_t getRelocationOffset() const
ThreadLocalDataSym(SymbolRecordKind Kind)
ArrayRef< uint8_t > VariantData
Thunk32Sym(SymbolRecordKind Kind, uint32_t RecordOffset)
Thunk32Sym(SymbolRecordKind Kind)
TrampolineSym(SymbolRecordKind Kind, uint32_t RecordOffset)
TrampolineSym(SymbolRecordKind Kind)
UDTSym(SymbolRecordKind Kind)
UDTSym(uint32_t RecordOffset)
UsingNamespaceSym(uint32_t RecordOffset)
UsingNamespaceSym(SymbolRecordKind Kind)
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
A range adaptor for a pair of iterators.
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
@ ChangeCodeLengthAndCodeOffset
@ ChangeCodeOffsetAndLineOffset
ProcSymFlags
Corresponds to the CV_PROCFLAGS bitfield.
LocalSymFlags
Corresponds to CV_LVARFLAGS bitfield.
CompileSym2Flags
Corresponds to COMPILESYM2::Flags bitfield.
CPUType
These values correspond to the CV_CPU_TYPE_e enumeration, and are documented here: https://msdn....
CompileSym3Flags
Corresponds to COMPILESYM3::Flags bitfield.
SymbolRecordKind
Distinguishes individual records in the Symbols subsection of a .debug$S section.
ThunkOrdinal
These values correspond to the THUNK_ORDINAL enumeration.
EncodedFramePtrReg
Two-bit value indicating which register is the designated frame pointer register.
RegisterId decodeFramePtrReg(EncodedFramePtrReg EncodedReg, CPUType CPU)
PublicSymFlags
Corresponds to the CV_PUBSYMFLAGS bitfield.
SourceLanguage
These values correspond to the CV_CFL_LANG enumeration in the Microsoft Debug Interface Access SDK,...
Expected< CVSymbol > readSymbolFromStream(BinaryStreamRef Stream, uint32_t Offset)
This is an optimization pass for GlobalISel generic memory operations.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
DWARFExpression::Operation Op
BinaryAnnotationIterator & operator=(const BinaryAnnotationIterator Other)
BinaryAnnotationIterator & operator++()
BinaryAnnotationIterator(const BinaryAnnotationIterator &Other)
const DecodedAnnotation & operator*()
bool operator==(BinaryAnnotationIterator Other) const
BinaryAnnotationIterator()=default
BinaryAnnotationIterator(ArrayRef< uint8_t > Annotations)
BinaryAnnotationsOpCode OpCode
ArrayRef< uint8_t > Bytes