Skip to content

Commit

Permalink
Use new DWARFDataExtractor::getInitialLength in DWARFDebugFrame
Browse files Browse the repository at this point in the history
  • Loading branch information
labath committed Mar 4, 2020
1 parent 2458492 commit bddab92
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
Expand Up @@ -364,18 +364,11 @@ void DWARFDebugFrame::parse(DWARFDataExtractor Data) {
while (Data.isValidOffset(Offset)) {
uint64_t StartOffset = Offset;

bool IsDWARF64 = false;
uint64_t Length = Data.getRelocatedValue(4, &Offset);
uint64_t Length;
DwarfFormat Format;
std::tie(Length, Format) = Data.getInitialLength(&Offset);
uint64_t Id;

if (Length == dwarf::DW_LENGTH_DWARF64) {
// DWARF-64 is distinguished by the first 32 bits of the initial length
// field being 0xffffffff. Then, the next 64 bits are the actual entry
// length.
IsDWARF64 = true;
Length = Data.getRelocatedValue(8, &Offset);
}

// At this point, Offset points to the next field after Length.
// Length is the structure size excluding itself. Compute an offset one
// past the end of the structure (needed to know how many instructions to
Expand All @@ -384,6 +377,7 @@ void DWARFDebugFrame::parse(DWARFDataExtractor Data) {
uint64_t EndStructureOffset = Offset + Length;

// The Id field's size depends on the DWARF format
bool IsDWARF64 = Format == DWARF64;
Id = Data.getRelocatedValue((IsDWARF64 && !IsEH) ? 8 : 4, &Offset);
bool IsCIE =
((IsDWARF64 && Id == DW64_CIE_ID) || Id == DW_CIE_ID || (IsEH && !Id));
Expand Down

0 comments on commit bddab92

Please sign in to comment.