mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 00:24:26 +00:00
DWARFDebugFrame: Actually collect CIEs associated with FDEs.
This is the first commit in a small series aiming at making debug_frame dump more useful (right now it prints a list of opeartions without their operands). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230547 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -246,10 +246,11 @@ public:
|
|||||||
// an offset to the CIE (provided by parsing the FDE header). The CIE itself
|
// an offset to the CIE (provided by parsing the FDE header). The CIE itself
|
||||||
// is obtained lazily once it's actually required.
|
// is obtained lazily once it's actually required.
|
||||||
FDE(uint64_t Offset, uint64_t Length, int64_t LinkedCIEOffset,
|
FDE(uint64_t Offset, uint64_t Length, int64_t LinkedCIEOffset,
|
||||||
uint64_t InitialLocation, uint64_t AddressRange)
|
uint64_t InitialLocation, uint64_t AddressRange,
|
||||||
|
CIE *Cie)
|
||||||
: FrameEntry(FK_FDE, Offset, Length), LinkedCIEOffset(LinkedCIEOffset),
|
: FrameEntry(FK_FDE, Offset, Length), LinkedCIEOffset(LinkedCIEOffset),
|
||||||
InitialLocation(InitialLocation), AddressRange(AddressRange),
|
InitialLocation(InitialLocation), AddressRange(AddressRange),
|
||||||
LinkedCIE(nullptr) {}
|
LinkedCIE(Cie) {}
|
||||||
|
|
||||||
~FDE() {
|
~FDE() {
|
||||||
}
|
}
|
||||||
@ -299,6 +300,7 @@ static void LLVM_ATTRIBUTE_UNUSED dumpDataAux(DataExtractor Data,
|
|||||||
|
|
||||||
void DWARFDebugFrame::parse(DataExtractor Data) {
|
void DWARFDebugFrame::parse(DataExtractor Data) {
|
||||||
uint32_t Offset = 0;
|
uint32_t Offset = 0;
|
||||||
|
DenseMap<uint32_t, CIE *> CIEs;
|
||||||
|
|
||||||
while (Data.isValidOffset(Offset)) {
|
while (Data.isValidOffset(Offset)) {
|
||||||
uint32_t StartOffset = Offset;
|
uint32_t StartOffset = Offset;
|
||||||
@ -338,9 +340,11 @@ void DWARFDebugFrame::parse(DataExtractor Data) {
|
|||||||
int64_t DataAlignmentFactor = Data.getSLEB128(&Offset);
|
int64_t DataAlignmentFactor = Data.getSLEB128(&Offset);
|
||||||
uint64_t ReturnAddressRegister = Data.getULEB128(&Offset);
|
uint64_t ReturnAddressRegister = Data.getULEB128(&Offset);
|
||||||
|
|
||||||
Entries.emplace_back(new CIE(StartOffset, Length, Version,
|
auto Cie = make_unique<CIE>(StartOffset, Length, Version,
|
||||||
StringRef(Augmentation), CodeAlignmentFactor,
|
StringRef(Augmentation), CodeAlignmentFactor,
|
||||||
DataAlignmentFactor, ReturnAddressRegister));
|
DataAlignmentFactor, ReturnAddressRegister);
|
||||||
|
CIEs[StartOffset] = Cie.get();
|
||||||
|
Entries.emplace_back(std::move(Cie));
|
||||||
} else {
|
} else {
|
||||||
// FDE
|
// FDE
|
||||||
uint64_t CIEPointer = Id;
|
uint64_t CIEPointer = Id;
|
||||||
@ -348,7 +352,8 @@ void DWARFDebugFrame::parse(DataExtractor Data) {
|
|||||||
uint64_t AddressRange = Data.getAddress(&Offset);
|
uint64_t AddressRange = Data.getAddress(&Offset);
|
||||||
|
|
||||||
Entries.emplace_back(new FDE(StartOffset, Length, CIEPointer,
|
Entries.emplace_back(new FDE(StartOffset, Length, CIEPointer,
|
||||||
InitialLocation, AddressRange));
|
InitialLocation, AddressRange,
|
||||||
|
CIEs[CIEPointer]));
|
||||||
}
|
}
|
||||||
|
|
||||||
Entries.back()->parseInstructions(Data, &Offset, EndStructureOffset);
|
Entries.back()->parseInstructions(Data, &Offset, EndStructureOffset);
|
||||||
|
Reference in New Issue
Block a user