From bddab9285812e060c776233fc779654c1447f9e0 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Tue, 3 Mar 2020 18:27:39 +0100 Subject: [PATCH] Use new DWARFDataExtractor::getInitialLength in DWARFDebugFrame --- llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp index 8516467..c3057f2 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp @@ -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 @@ -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)); -- 2.7.4