Index: include/llvm/DebugInfo/DWARF/DWARFVerifier.h =================================================================== --- include/llvm/DebugInfo/DWARF/DWARFVerifier.h +++ include/llvm/DebugInfo/DWARF/DWARFVerifier.h @@ -34,7 +34,6 @@ uint32_t NumDebugInfoErrors = 0; uint32_t NumDebugLineErrors = 0; uint32_t NumAppleNamesErrors = 0; - uint32_t UnitType = 0; /// Verifies the header of a unit in the .debug_info section. /// @@ -51,12 +50,13 @@ /// \param Offset A reference to the offset start of the unit. The offset will /// be updated to point to the next unit in .debug_info /// \param UnitIndex The index of the unit to be verified + /// \param UnitType A reference to the type of the unit /// \param isUnitDWARF64 A reference to a flag that shows whether the unit is /// in 64-bit format. /// /// \returns true if the header is verified successfully, false otherwise. bool verifyUnitHeader(const DWARFDataExtractor DebugInfoData, - uint32_t *Offset, unsigned UnitIndex, + uint32_t *Offset, unsigned UnitIndex, uint8_t &UnitType, bool &isUnitDWARF64); bool verifyUnitContents(DWARFUnit Unit); Index: lib/DebugInfo/DWARF/DWARFVerifier.cpp =================================================================== --- lib/DebugInfo/DWARF/DWARFVerifier.cpp +++ lib/DebugInfo/DWARF/DWARFVerifier.cpp @@ -25,8 +25,8 @@ using namespace object; bool DWARFVerifier::verifyUnitHeader(const DWARFDataExtractor DebugInfoData, - uint32_t *Offset, unsigned UnitIndex, - bool &isUnitDWARF64) { + uint32_t *Offset, unsigned UnitIndex, + uint8_t &UnitType, bool &isUnitDWARF64) { uint32_t AbbrOffset, Length; uint8_t AddrSize = 0; uint16_t Version; @@ -109,11 +109,14 @@ DWARFDataExtractor DebugInfoData(DCtx.getInfoSection(), DCtx.isLittleEndian(), 0); uint32_t OffsetStart = 0, Offset = 0, UnitIdx = 0; + uint8_t UnitType = 0; bool isUnitDWARF64 = false; bool Success = true; bool hasDIE = DebugInfoData.isValidOffset(Offset); while (hasDIE) { - if (!verifyUnitHeader(DebugInfoData, &Offset, UnitIdx, isUnitDWARF64)) { + OffsetStart = Offset; + if (!verifyUnitHeader(DebugInfoData, &Offset, UnitIdx, UnitType, + isUnitDWARF64)) { Success = false; if (isUnitDWARF64) break;