13
13
#include " llvm/ADT/ArrayRef.h"
14
14
#include " llvm/ADT/iterator.h"
15
15
#include " llvm/ADT/SmallString.h"
16
+ #include " llvm/ADT/Triple.h"
16
17
#include " llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
17
18
#include " llvm/DebugInfo/DWARF/DWARFExpression.h"
18
19
#include " llvm/Support/Error.h"
@@ -59,9 +60,11 @@ class CFIProgram {
59
60
unsigned size () const { return (unsigned )Instructions.size (); }
60
61
bool empty () const { return Instructions.empty (); }
61
62
62
- CFIProgram (uint64_t CodeAlignmentFactor, int64_t DataAlignmentFactor)
63
+ CFIProgram (uint64_t CodeAlignmentFactor, int64_t DataAlignmentFactor,
64
+ Triple::ArchType Arch)
63
65
: CodeAlignmentFactor(CodeAlignmentFactor),
64
- DataAlignmentFactor (DataAlignmentFactor) {}
66
+ DataAlignmentFactor (DataAlignmentFactor),
67
+ Arch(Arch) {}
65
68
66
69
// / Parse and store a sequence of CFI instructions from Data,
67
70
// / starting at *Offset and ending at EndOffset. *Offset is updated
@@ -76,6 +79,7 @@ class CFIProgram {
76
79
std::vector<Instruction> Instructions;
77
80
const uint64_t CodeAlignmentFactor;
78
81
const int64_t DataAlignmentFactor;
82
+ Triple::ArchType Arch;
79
83
80
84
// / Convenience method to add a new instruction with the given opcode.
81
85
void addInstruction (uint8_t Opcode) {
@@ -130,8 +134,9 @@ class FrameEntry {
130
134
enum FrameKind { FK_CIE, FK_FDE };
131
135
132
136
FrameEntry (FrameKind K, uint64_t Offset, uint64_t Length, uint64_t CodeAlign,
133
- int64_t DataAlign)
134
- : Kind(K), Offset(Offset), Length(Length), CFIs(CodeAlign, DataAlign) {}
137
+ int64_t DataAlign, Triple::ArchType Arch)
138
+ : Kind(K), Offset(Offset), Length(Length),
139
+ CFIs (CodeAlign, DataAlign, Arch) {}
135
140
136
141
virtual ~FrameEntry () {}
137
142
@@ -168,9 +173,9 @@ class CIE : public FrameEntry {
168
173
int64_t DataAlignmentFactor, uint64_t ReturnAddressRegister,
169
174
SmallString<8 > AugmentationData, uint32_t FDEPointerEncoding,
170
175
uint32_t LSDAPointerEncoding, Optional<uint64_t > Personality,
171
- Optional<uint32_t > PersonalityEnc)
176
+ Optional<uint32_t > PersonalityEnc, Triple::ArchType Arch )
172
177
: FrameEntry(FK_CIE, Offset, Length, CodeAlignmentFactor,
173
- DataAlignmentFactor),
178
+ DataAlignmentFactor, Arch ),
174
179
Version (Version), Augmentation(std::move(Augmentation)),
175
180
AddressSize(AddressSize), SegmentDescriptorSize(SegmentDescriptorSize),
176
181
CodeAlignmentFactor(CodeAlignmentFactor),
@@ -224,10 +229,11 @@ class FDE : public FrameEntry {
224
229
// is obtained lazily once it's actually required.
225
230
FDE (uint64_t Offset, uint64_t Length, int64_t LinkedCIEOffset,
226
231
uint64_t InitialLocation, uint64_t AddressRange, CIE *Cie,
227
- Optional<uint64_t > LSDAAddress)
232
+ Optional<uint64_t > LSDAAddress, Triple::ArchType Arch )
228
233
: FrameEntry(FK_FDE, Offset, Length,
229
234
Cie ? Cie->getCodeAlignmentFactor () : 0,
230
- Cie ? Cie->getDataAlignmentFactor() : 0),
235
+ Cie ? Cie->getDataAlignmentFactor() : 0,
236
+ Arch),
231
237
LinkedCIEOffset(LinkedCIEOffset), InitialLocation(InitialLocation),
232
238
AddressRange(AddressRange), LinkedCIE(Cie), LSDAAddress(LSDAAddress) {}
233
239
@@ -256,6 +262,7 @@ class FDE : public FrameEntry {
256
262
257
263
// / A parsed .debug_frame or .eh_frame section
258
264
class DWARFDebugFrame {
265
+ const Triple::ArchType Arch;
259
266
// True if this is parsing an eh_frame section.
260
267
const bool IsEH;
261
268
// Not zero for sane pointer values coming out of eh_frame
@@ -272,7 +279,8 @@ class DWARFDebugFrame {
272
279
// it is a .debug_frame section. EHFrameAddress should be different
273
280
// than zero for correct parsing of .eh_frame addresses when they
274
281
// use a PC-relative encoding.
275
- DWARFDebugFrame (bool IsEH = false , uint64_t EHFrameAddress = 0 );
282
+ DWARFDebugFrame (Triple::ArchType Arch,
283
+ bool IsEH = false , uint64_t EHFrameAddress = 0 );
276
284
~DWARFDebugFrame ();
277
285
278
286
// / Dump the section data into the given stream.
0 commit comments