10 #ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGFRAME_H 11 #define LLVM_DEBUGINFO_DWARF_DWARFDEBUGFRAME_H 60 unsigned size()
const {
return (
unsigned)Instructions.size(); }
61 bool empty()
const {
return Instructions.empty(); }
63 CFIProgram(uint64_t CodeAlignmentFactor, int64_t DataAlignmentFactor,
65 : CodeAlignmentFactor(CodeAlignmentFactor),
66 DataAlignmentFactor(DataAlignmentFactor),
76 unsigned IndentLevel = 1)
const;
79 std::vector<Instruction> Instructions;
80 const uint64_t CodeAlignmentFactor;
81 const int64_t DataAlignmentFactor;
85 void addInstruction(uint8_t
Opcode) {
90 void addInstruction(uint8_t Opcode, uint64_t Operand1) {
92 Instructions.back().Ops.push_back(Operand1);
96 void addInstruction(uint8_t Opcode, uint64_t Operand1, uint64_t Operand2) {
98 Instructions.back().Ops.push_back(Operand1);
99 Instructions.back().Ops.push_back(Operand2);
113 OT_FactoredCodeOffset,
114 OT_SignedFactDataOffset,
115 OT_UnsignedFactDataOffset,
127 uint64_t Operand)
const;
138 :
Kind(K), Offset(Offset), Length(Length),
139 CFIs(CodeAlign, DataAlign, Arch) {}
151 bool IsEH)
const = 0;
172 uint8_t SegmentDescriptorSize, uint64_t CodeAlignmentFactor,
173 int64_t DataAlignmentFactor, uint64_t ReturnAddressRegister,
177 :
FrameEntry(FK_CIE, Offset, Length, CodeAlignmentFactor,
178 DataAlignmentFactor, Arch),
179 Version(Version), Augmentation(
std::move(Augmentation)),
180 AddressSize(AddressSize), SegmentDescriptorSize(SegmentDescriptorSize),
181 CodeAlignmentFactor(CodeAlignmentFactor),
182 DataAlignmentFactor(DataAlignmentFactor),
183 ReturnAddressRegister(ReturnAddressRegister),
184 AugmentationData(
std::move(AugmentationData)),
185 FDEPointerEncoding(FDEPointerEncoding),
186 LSDAPointerEncoding(LSDAPointerEncoding), Personality(Personality),
187 PersonalityEnc(PersonalityEnc) {}
204 bool IsEH)
const override;
210 const uint8_t AddressSize;
211 const uint8_t SegmentDescriptorSize;
212 const uint64_t CodeAlignmentFactor;
213 const int64_t DataAlignmentFactor;
214 const uint64_t ReturnAddressRegister;
230 FDE(uint64_t
Offset, uint64_t Length, int64_t LinkedCIEOffset,
231 uint64_t InitialLocation, uint64_t AddressRange,
CIE *Cie,
234 Cie ? Cie->getCodeAlignmentFactor() : 0,
237 LinkedCIEOffset(LinkedCIEOffset), InitialLocation(InitialLocation),
238 AddressRange(AddressRange), LinkedCIE(Cie), LSDAAddress(LSDAAddress) {}
240 ~
FDE()
override =
default;
248 bool IsEH)
const override;
254 const uint64_t LinkedCIEOffset;
255 const uint64_t InitialLocation;
256 const uint64_t AddressRange;
257 const CIE *LinkedCIE;
269 const uint64_t EHFrameAddress;
271 std::vector<std::unique_ptr<dwarf::FrameEntry>> Entries;
283 bool IsEH =
false, uint64_t EHFrameAddress = 0);
295 bool empty()
const {
return Entries.empty(); }
309 #endif // LLVM_DEBUGINFO_DWARF_DWARFDEBUGFRAME_H int64_t getDataAlignmentFactor() const
iterator_range< iterator > entries() const
static int getDataAlignmentFactor(MCStreamer &streamer)
InstrList::iterator iterator
iterator begin() const
DWARF Frame entries accessors.
InstrList::const_iterator const_iterator
static bool classof(const FrameEntry *FE)
A parsed .debug_frame or .eh_frame section.
This class represents lattice values for constants.
Optional< uint64_t > getPersonalityAddress() const
FDE(uint64_t Offset, uint64_t Length, int64_t LinkedCIEOffset, uint64_t InitialLocation, uint64_t AddressRange, CIE *Cie, Optional< uint64_t > LSDAAddress, Triple::ArchType Arch)
Error parse(DataExtractor Data, uint32_t *Offset, uint32_t EndOffset)
Parse and store a sequence of CFI instructions from Data, starting at *Offset and ending at EndOffset...
An entry in either debug_frame or eh_frame.
uint8_t getVersion() const
uint64_t getEHFrameAddress() const
uint32_t getLSDAPointerEncoding() const
uint64_t getCodeAlignmentFactor() const
uint64_t getInitialLocation() const
Instruction(uint8_t Opcode)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
CFIProgram(uint64_t CodeAlignmentFactor, int64_t DataAlignmentFactor, Triple::ArchType Arch)
unsigned const MachineRegisterInfo * MRI
DWARF Frame Description Entry (FDE)
uint32_t getFDEPointerEncoding() const
const uint64_t Offset
Offset of this entry in the section.
uint64_t getLength() const
Represent a sequence of Call Frame Information instructions that, when read in order, construct a table mapping PC to frame state.
CIE(uint64_t Offset, uint64_t Length, uint8_t Version, SmallString< 8 > Augmentation, uint8_t AddressSize, uint8_t SegmentDescriptorSize, uint64_t CodeAlignmentFactor, int64_t DataAlignmentFactor, uint64_t ReturnAddressRegister, SmallString< 8 > AugmentationData, uint32_t FDEPointerEncoding, uint32_t LSDAPointerEncoding, Optional< uint64_t > Personality, Optional< uint32_t > PersonalityEnc, Triple::ArchType Arch)
static bool classof(const FrameEntry *FE)
void dump(raw_ostream &OS, const MCRegisterInfo *MRI, bool IsEH, unsigned IndentLevel=1) const
const CIE * getLinkedCIE() const
Optional< uint32_t > getPersonalityEncoding() const
std::vector< Instruction > InstrList
bool empty() const
Return whether the section has any entries.
An iterator type that allows iterating over the pointees via some other iterator. ...
DWARF Common Information Entry (CIE)
SmallVector< uint64_t, 2 > Operands
A range adaptor for a pair of iterators.
const_iterator end() const
const CFIProgram & cfis() const
StringRef getAugmentationString() const
const uint64_t Length
Entry length as specified in DWARF.
FrameKind getKind() const
Optional< uint64_t > getLSDAAddress() const
An instruction consists of a DWARF CFI opcode and an optional sequence of operands.
uint64_t getOffset() const
const_iterator begin() const
FrameEntry(FrameKind K, uint64_t Offset, uint64_t Length, uint64_t CodeAlign, int64_t DataAlign, Triple::ArchType Arch)
Lightweight error class with error context and mandatory checking.
Optional< DWARFExpression > Expression
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.
uint64_t getReturnAddressRegister() const
uint64_t getAddressRange() const