9 #ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGFRAME_H 10 #define LLVM_DEBUGINFO_DWARF_DWARFDEBUGFRAME_H 59 unsigned size()
const {
return (
unsigned)Instructions.size(); }
60 bool empty()
const {
return Instructions.empty(); }
62 CFIProgram(uint64_t CodeAlignmentFactor, int64_t DataAlignmentFactor,
64 : CodeAlignmentFactor(CodeAlignmentFactor),
65 DataAlignmentFactor(DataAlignmentFactor),
75 unsigned IndentLevel = 1)
const;
78 std::vector<Instruction> Instructions;
79 const uint64_t CodeAlignmentFactor;
80 const int64_t DataAlignmentFactor;
84 void addInstruction(uint8_t
Opcode) {
89 void addInstruction(uint8_t Opcode, uint64_t Operand1) {
91 Instructions.back().Ops.push_back(Operand1);
95 void addInstruction(uint8_t Opcode, uint64_t Operand1, uint64_t Operand2) {
97 Instructions.back().Ops.push_back(Operand1);
98 Instructions.back().Ops.push_back(Operand2);
112 OT_FactoredCodeOffset,
113 OT_SignedFactDataOffset,
114 OT_UnsignedFactDataOffset,
126 uint64_t Operand)
const;
137 :
Kind(K), Offset(Offset), Length(Length),
138 CFIs(CodeAlign, DataAlign, Arch) {}
150 bool IsEH)
const = 0;
171 uint8_t SegmentDescriptorSize, uint64_t CodeAlignmentFactor,
172 int64_t DataAlignmentFactor, uint64_t ReturnAddressRegister,
176 :
FrameEntry(FK_CIE, Offset, Length, CodeAlignmentFactor,
177 DataAlignmentFactor, Arch),
178 Version(Version), Augmentation(
std::move(Augmentation)),
179 AddressSize(AddressSize), SegmentDescriptorSize(SegmentDescriptorSize),
180 CodeAlignmentFactor(CodeAlignmentFactor),
181 DataAlignmentFactor(DataAlignmentFactor),
182 ReturnAddressRegister(ReturnAddressRegister),
183 AugmentationData(
std::move(AugmentationData)),
184 FDEPointerEncoding(FDEPointerEncoding),
185 LSDAPointerEncoding(LSDAPointerEncoding), Personality(Personality),
186 PersonalityEnc(PersonalityEnc) {}
203 bool IsEH)
const override;
209 const uint8_t AddressSize;
210 const uint8_t SegmentDescriptorSize;
211 const uint64_t CodeAlignmentFactor;
212 const int64_t DataAlignmentFactor;
213 const uint64_t ReturnAddressRegister;
229 FDE(uint64_t
Offset, uint64_t Length, int64_t LinkedCIEOffset,
230 uint64_t InitialLocation, uint64_t AddressRange,
CIE *Cie,
233 Cie ? Cie->getCodeAlignmentFactor() : 0,
236 LinkedCIEOffset(LinkedCIEOffset), InitialLocation(InitialLocation),
237 AddressRange(AddressRange), LinkedCIE(Cie), LSDAAddress(LSDAAddress) {}
239 ~
FDE()
override =
default;
247 bool IsEH)
const override;
253 const uint64_t LinkedCIEOffset;
254 const uint64_t InitialLocation;
255 const uint64_t AddressRange;
256 const CIE *LinkedCIE;
268 const uint64_t EHFrameAddress;
270 std::vector<std::unique_ptr<dwarf::FrameEntry>> Entries;
282 bool IsEH =
false, uint64_t EHFrameAddress = 0);
294 bool empty()
const {
return Entries.empty(); }
308 #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
Error parse(DWARFDataExtractor Data, uint64_t *Offset, uint64_t EndOffset)
Parse and store a sequence of CFI instructions from Data, starting at *Offset and ending at EndOffset...
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)
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