From: Alexander Yermolovich Date: Tue, 10 Jan 2023 18:33:23 +0000 (-0800) Subject: [llvm][dwwarf] Change CU/TU index to 64-bit X-Git-Tag: upstream/17.0.6~21514 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fa3fa4d0d42326005dfd5887bf047b86904d3be6;p=platform%2Fupstream%2Fllvm.git [llvm][dwwarf] Change CU/TU index to 64-bit Changed contribution data structure to 64 bit. I added the 32bit and 64bit accessors to make it explicit where we use 32bit and where we use 64bit. Also to make sure sure we catch all the cases where this data structure is used. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D139379 --- diff --git a/bolt/lib/Core/DebugData.cpp b/bolt/lib/Core/DebugData.cpp index fa5505a..2cbd119 100644 --- a/bolt/lib/Core/DebugData.cpp +++ b/bolt/lib/Core/DebugData.cpp @@ -1241,8 +1241,8 @@ void DebugAbbrevWriter::addUnitAbbreviations(DWARFUnit &Unit) { const DWARFUnitIndex::Entry::SectionContribution *DWOContrubution = DWOEntry->getContribution(DWARFSectionKind::DW_SECT_ABBREV); - AbbrevContents = AbbrevSectionContents.substr(DWOContrubution->Offset, - DWOContrubution->Length); + AbbrevContents = AbbrevSectionContents.substr( + DWOContrubution->getOffset(), DWOContrubution->getLength()); } else if (!Unit.isDWOUnit()) { const uint64_t StartOffset = Unit.getAbbreviationsOffset(); diff --git a/bolt/lib/Rewrite/DWARFRewriter.cpp b/bolt/lib/Rewrite/DWARFRewriter.cpp index a76d128..5b8a284 100644 --- a/bolt/lib/Rewrite/DWARFRewriter.cpp +++ b/bolt/lib/Rewrite/DWARFRewriter.cpp @@ -1212,11 +1212,11 @@ updateDebugData(DWARFContext &DWCtx, std::string &Storage, const DWARFUnitIndex::Entry::SectionContribution; auto getSliceData = [&](const DWARFUnitIndex::Entry *DWOEntry, StringRef OutData, DWARFSectionKind Sec, - uint32_t &DWPOffset) -> StringRef { + uint64_t &DWPOffset) -> StringRef { if (DWOEntry) { DWOSectionContribution *DWOContrubution = DWOEntry->getContribution(Sec); - DWPOffset = DWOContrubution->Offset; - OutData = OutData.substr(DWPOffset, DWOContrubution->Length); + DWPOffset = DWOContrubution->getOffset(); + OutData = OutData.substr(DWPOffset, DWOContrubution->getLength()); } return OutData; }; @@ -1227,7 +1227,7 @@ updateDebugData(DWARFContext &DWCtx, std::string &Storage, Streamer.switchSection(SectionIter->second.first); StringRef OutData = SectionContents; - uint32_t DWPOffset = 0; + uint64_t DWPOffset = 0; switch (SectionIter->second.second) { default: { @@ -1310,14 +1310,15 @@ static std::string extractDWOTUFromDWP( // Sorting so it's easy to compare output. // They should be sharing the same Abbrev. llvm::sort(TUContributions, [](const TUEntry &V1, const TUEntry &V2) -> bool { - return V1.second->Offset < V2.second->Offset; + return V1.second->getOffset() < V2.second->getOffset(); }); for (auto &PairEntry : TUContributions) { const DWARFUnitIndex::Entry::SectionContribution *C = PairEntry.second; const uint64_t TUSignature = PairEntry.first; - DWOTUSection.append(Contents.slice(C->Offset, C->Offset + C->Length).str()); - TUContributionsToCU.push_back({TUSignature, C->Length}); + DWOTUSection.append( + Contents.slice(C->getOffset(), C->getOffset() + C->getLength()).str()); + TUContributionsToCU.push_back({TUSignature, C->getLength32()}); } return DWOTUSection; } @@ -1357,11 +1358,12 @@ static void extractTypesFromDWPDWARF5( llvm::sort(TUContributions, [](const DWARFUnitIndex::Entry::SectionContribution *V1, const DWARFUnitIndex::Entry::SectionContribution *V2) -> bool { - return V1->Offset < V2->Offset; + return V1->getOffset() < V2->getOffset(); }); Streamer.switchSection(MCOFI.getDwarfInfoDWOSection()); for (const auto *C : TUContributions) - Streamer.emitBytes(Contents.slice(C->Offset, C->Offset + C->Length)); + Streamer.emitBytes( + Contents.slice(C->getOffset(), C->getOffset() + C->getLength())); } void DWARFRewriter::writeDWP( @@ -1510,9 +1512,10 @@ void DWARFRewriter::writeDWP( Streamer->emitBytes(OutData); auto Index = getContributionIndex(SectionIter->second.second, IndexVersion); - CurEntry.Contributions[Index].Offset = ContributionOffsets[Index]; - CurEntry.Contributions[Index].Length = OutData.size(); - ContributionOffsets[Index] += CurEntry.Contributions[Index].Length; + CurEntry.Contributions[Index].setOffset(ContributionOffsets[Index]); + CurEntry.Contributions[Index].setLength(OutData.size()); + ContributionOffsets[Index] += + CurEntry.Contributions[Index].getLength32(); } // Strings are combined in to a new string section, and de-duplicated @@ -1541,9 +1544,10 @@ void DWARFRewriter::writeDWP( for (const TUContribution &TUC : TUContributionsToCU) { UnitIndexEntry TUEntry = CurEntry; TUEntry.Contributions[0] = {}; - TUEntry.Contributions[Index].Offset = ContributionOffsets[Index]; - TUEntry.Contributions[Index].Length = TUC.Length; - ContributionOffsets[Index] += TUEntry.Contributions[Index].Length; + TUEntry.Contributions[Index].setOffset(ContributionOffsets[Index]); + TUEntry.Contributions[Index].setLength(TUC.Length); + ContributionOffsets[Index] += + TUEntry.Contributions[Index].getLength32(); TypeIndexEntries.insert(std::make_pair(TUC.Signature, TUEntry)); } } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp index 3002a20..ba8d0e9 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -341,7 +341,7 @@ void DWARFUnit::SetDwoStrOffsetsBase() { if (const llvm::DWARFUnitIndex::Entry *entry = m_header.GetIndexEntry()) { if (const auto *contribution = entry->getContribution(llvm::DW_SECT_STR_OFFSETS)) - baseOffset = contribution->Offset; + baseOffset = contribution->getOffset32(); else return; } @@ -489,7 +489,7 @@ void DWARFUnit::SetLoclistsBase(dw_addr_t loclists_base) { *GetDWOId()); return; } - offset += contribution->Offset; + offset += contribution->getOffset32(); } m_loclists_base = loclists_base; @@ -527,8 +527,8 @@ DWARFDataExtractor DWARFUnit::GetLocationData() const { if (const llvm::DWARFUnitIndex::Entry *entry = m_header.GetIndexEntry()) { if (const auto *contribution = entry->getContribution( GetVersion() >= 5 ? llvm::DW_SECT_LOCLISTS : llvm::DW_SECT_EXT_LOC)) - return DWARFDataExtractor(data, contribution->Offset, - contribution->Length); + return DWARFDataExtractor(data, contribution->getOffset32(), + contribution->getLength32()); return DWARFDataExtractor(); } return data; @@ -540,8 +540,8 @@ DWARFDataExtractor DWARFUnit::GetRnglistData() const { if (const llvm::DWARFUnitIndex::Entry *entry = m_header.GetIndexEntry()) { if (const auto *contribution = entry->getContribution(llvm::DW_SECT_RNGLISTS)) - return DWARFDataExtractor(data, contribution->Offset, - contribution->Length); + return DWARFDataExtractor(data, contribution->getOffset32(), + contribution->getLength32()); GetSymbolFileDWARF().GetObjectFile()->GetModule()->ReportError( "Failed to find range list contribution for CU with signature {0:x16}", entry->getSignature()); @@ -924,7 +924,7 @@ DWARFUnitHeader::extract(const DWARFDataExtractor &data, "Package unit with a non-zero abbreviation offset"); } auto *unit_contrib = header.m_index_entry->getContribution(); - if (!unit_contrib || unit_contrib->Length != header.m_length + 4) { + if (!unit_contrib || unit_contrib->getLength32() != header.m_length + 4) { return llvm::createStringError(llvm::inconvertibleErrorCode(), "Inconsistent DWARF package unit index"); } @@ -935,7 +935,7 @@ DWARFUnitHeader::extract(const DWARFDataExtractor &data, llvm::inconvertibleErrorCode(), "DWARF package index missing abbreviation column"); } - header.m_abbr_offset = abbr_entry->Offset; + header.m_abbr_offset = abbr_entry->getOffset32(); } bool length_OK = data.ValidOffset(header.GetNextUnitOffset() - 1); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp index 6aa56da..a1223a5 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp @@ -42,7 +42,7 @@ DWARFCompileUnit *SymbolFileDWARFDwo::GetDWOCompileUnitForHash(uint64_t hash) { if (auto *unit_contrib = entry->getContribution()) return llvm::dyn_cast_or_null( DebugInfo().GetUnitAtOffset(DIERef::Section::DebugInfo, - unit_contrib->Offset)); + unit_contrib->getOffset32())); } return nullptr; } diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h index 584cc55..b4978cc 100644 --- a/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h +++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h @@ -536,7 +536,7 @@ public: uint32_t getLineTableOffset() const { if (auto IndexEntry = Header.getIndexEntry()) if (const auto *Contrib = IndexEntry->getContribution(DW_SECT_LINE)) - return Contrib->Offset; + return Contrib->getOffset32(); return 0; } diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h index b3c1807..f2a8611 100644 --- a/llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h +++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h @@ -110,9 +110,22 @@ class DWARFUnitIndex { public: class Entry { public: - struct SectionContribution { - uint32_t Offset; - uint32_t Length; + class SectionContribution { + private: + uint64_t Offset; + uint64_t Length; + + public: + SectionContribution() : Offset(0), Length(0) {} + SectionContribution(uint64_t Offset, uint64_t Length) + : Offset(Offset), Length(Length) {} + + void setOffset(uint64_t Value) { Offset = Value; } + void setLength(uint64_t Value) { Length = Value; } + uint64_t getOffset() const { return Offset; } + uint64_t getLength() const { return Length; } + uint32_t getOffset32() const { return (uint32_t)Offset; } + uint32_t getLength32() const { return (uint32_t)Length; } }; private: @@ -160,7 +173,7 @@ public: uint32_t getVersion() const { return Header.Version; } - const Entry *getFromOffset(uint32_t Offset) const; + const Entry *getFromOffset(uint64_t Offset) const; const Entry *getFromHash(uint64_t Offset) const; ArrayRef getColumnKinds() const { diff --git a/llvm/lib/DWP/DWP.cpp b/llvm/lib/DWP/DWP.cpp index 25badc8..5044704 100644 --- a/llvm/lib/DWP/DWP.cpp +++ b/llvm/lib/DWP/DWP.cpp @@ -175,7 +175,7 @@ static StringRef getSubsection(StringRef Section, const auto *Off = Entry.getContribution(Kind); if (!Off) return StringRef(); - return Section.substr(Off->Offset, Off->Length); + return Section.substr(Off->getOffset(), Off->getLength()); } static void @@ -200,16 +200,17 @@ addAllTypesFromDWP(MCStreamer &Out, continue; auto &C = Entry.Contributions[getContributionIndex(Kind, TUIndex.getVersion())]; - C.Offset += I->Offset; - C.Length = I->Length; + C.setOffset(C.getOffset() + I->getOffset()); + C.setLength(I->getLength()); ++I; } auto &C = Entry.Contributions[TypesContributionIndex]; Out.emitBytes(Types.substr( - C.Offset - TUEntry.Contributions[TypesContributionIndex].Offset, - C.Length)); - C.Offset = TypesOffset; - TypesOffset += C.Length; + C.getOffset() - + TUEntry.Contributions[TypesContributionIndex].getOffset(), + C.getLength())); + C.setOffset(TypesOffset); + TypesOffset += C.getLength(); } } @@ -226,23 +227,23 @@ static void addAllTypesFromTypesSection( // Zero out the debug_info contribution Entry.Contributions[0] = {}; auto &C = Entry.Contributions[getContributionIndex(DW_SECT_EXT_TYPES, 2)]; - C.Offset = TypesOffset; + C.setOffset(TypesOffset); auto PrevOffset = Offset; // Length of the unit, including the 4 byte length field. - C.Length = Data.getU32(&Offset) + 4; + C.setLength(Data.getU32(&Offset) + 4); Data.getU16(&Offset); // Version Data.getU32(&Offset); // Abbrev offset Data.getU8(&Offset); // Address size auto Signature = Data.getU64(&Offset); - Offset = PrevOffset + C.Length; + Offset = PrevOffset + C.getLength32(); auto P = TypeIndexEntries.insert(std::make_pair(Signature, Entry)); if (!P.second) continue; - Out.emitBytes(Types.substr(PrevOffset, C.Length)); - TypesOffset += C.Length; + Out.emitBytes(Types.substr(PrevOffset, C.getLength32())); + TypesOffset += C.getLength32(); } } } @@ -402,14 +403,17 @@ void writeStringsAndOffsets(MCStreamer &Out, DWPStringPool &Strings, } } -void writeIndexTable( - MCStreamer &Out, ArrayRef ContributionOffsets, - const MapVector &IndexEntries, - uint32_t DWARFUnitIndex::Entry::SectionContribution::*Field) { +enum AccessField { Offset, Length }; +void writeIndexTable(MCStreamer &Out, ArrayRef ContributionOffsets, + const MapVector &IndexEntries, + const AccessField &Field) { for (const auto &E : IndexEntries) for (size_t I = 0; I != std::size(E.second.Contributions); ++I) if (ContributionOffsets[I]) - Out.emitIntValue(E.second.Contributions[I].*Field, 4); + Out.emitIntValue((Field == AccessField::Offset + ? E.second.Contributions[I].getOffset32() + : E.second.Contributions[I].getLength32()), + 4); } void writeIndex(MCStreamer &Out, MCSection *Section, @@ -460,12 +464,10 @@ void writeIndex(MCStreamer &Out, MCSection *Section, Out.emitIntValue(getOnDiskSectionId(I), 4); // Write the offsets. - writeIndexTable(Out, ContributionOffsets, IndexEntries, - &DWARFUnitIndex::Entry::SectionContribution::Offset); + writeIndexTable(Out, ContributionOffsets, IndexEntries, AccessField::Offset); // Write the lengths. - writeIndexTable(Out, ContributionOffsets, IndexEntries, - &DWARFUnitIndex::Entry::SectionContribution::Length); + writeIndexTable(Out, ContributionOffsets, IndexEntries, AccessField::Length); } Error buildDuplicateError(const std::pair &PrevE, @@ -642,9 +644,9 @@ Error write(MCStreamer &Out, ArrayRef Inputs) { for (auto Pair : SectionLength) { auto Index = getContributionIndex(Pair.first, IndexVersion); - CurEntry.Contributions[Index].Offset = ContributionOffsets[Index]; - ContributionOffsets[Index] += - (CurEntry.Contributions[Index].Length = Pair.second); + CurEntry.Contributions[Index].setOffset(ContributionOffsets[Index]); + CurEntry.Contributions[Index].setLength(Pair.second); + ContributionOffsets[Index] += CurEntry.Contributions[Index].getLength32(); } uint32_t &InfoSectionOffset = @@ -664,21 +666,21 @@ Error write(MCStreamer &Out, ArrayRef Inputs) { UnitIndexEntry Entry = CurEntry; auto &C = Entry.Contributions[getContributionIndex(DW_SECT_INFO, IndexVersion)]; - C.Offset = InfoSectionOffset; - C.Length = Header.Length + 4; + C.setOffset(InfoSectionOffset); + C.setLength(Header.Length + 4); if (std::numeric_limits::max() - InfoSectionOffset < - C.Length) + C.getLength32()) return make_error( "debug information section offset is greater than 4GB"); - UnitOffset += C.Length; + UnitOffset += C.getLength32(); if (Header.Version < 5 || Header.UnitType == dwarf::DW_UT_split_compile) { - Expected EID = - getCUIdentifiers(Header, AbbrevSection, - Info.substr(UnitOffset - C.Length, C.Length), - CurStrOffsetSection, CurStrSection); + Expected EID = getCUIdentifiers( + Header, AbbrevSection, + Info.substr(UnitOffset - C.getLength32(), C.getLength32()), + CurStrOffsetSection, CurStrSection); if (!EID) return createFileError(Input, EID.takeError()); @@ -696,8 +698,9 @@ Error write(MCStreamer &Out, ArrayRef Inputs) { if (!P.second) continue; } - Out.emitBytes(Info.substr(UnitOffset - C.Length, C.Length)); - InfoSectionOffset += C.Length; + Out.emitBytes( + Info.substr(UnitOffset - C.getLength32(), C.getLength32())); + InfoSectionOffset += C.getLength32(); } } @@ -760,15 +763,15 @@ Error write(MCStreamer &Out, ArrayRef Inputs) { continue; auto &C = NewEntry.Contributions[getContributionIndex(Kind, IndexVersion)]; - C.Offset += I->Offset; - C.Length = I->Length; + C.setOffset(C.getOffset() + I->getOffset()); + C.setLength(I->getLength()); ++I; } unsigned Index = getContributionIndex(DW_SECT_INFO, IndexVersion); auto &C = NewEntry.Contributions[Index]; Out.emitBytes(CUInfoSection); - C.Offset = InfoSectionOffset; - InfoSectionOffset += C.Length; + C.setOffset(InfoSectionOffset); + InfoSectionOffset += C.getLength32(); } if (!CurTUIndexSection.empty()) { diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp index 5e40509..c199e01 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp @@ -160,11 +160,11 @@ DWARFUnitVector::getUnitForIndexEntry(const DWARFUnitIndex::Entry &E) { if (!CUOff) return nullptr; - auto Offset = CUOff->Offset; + uint64_t Offset = CUOff->getOffset(); auto end = begin() + getNumInfoUnits(); auto *CU = - std::upper_bound(begin(), end, CUOff->Offset, + std::upper_bound(begin(), end, CUOff->getOffset(), [](uint64_t LHS, const std::unique_ptr &RHS) { return LHS < RHS->getNextUnitOffset(); }); @@ -353,12 +353,12 @@ bool DWARFUnitHeader::applyIndexEntry(const DWARFUnitIndex::Entry *Entry) { return false; auto *UnitContrib = IndexEntry->getContribution(); if (!UnitContrib || - UnitContrib->Length != (getLength() + getUnitLengthFieldByteSize())) + UnitContrib->getLength() != (getLength() + getUnitLengthFieldByteSize())) return false; auto *AbbrEntry = IndexEntry->getContribution(DW_SECT_ABBREV); if (!AbbrEntry) return false; - AbbrOffset = AbbrEntry->Offset; + AbbrOffset = AbbrEntry->getOffset(); return true; } @@ -544,7 +544,7 @@ Error DWARFUnit::tryExtractDIEsIfNeeded(bool CUDieOnly) { uint64_t ContributionBaseOffset = 0; if (auto *IndexEntry = Header.getIndexEntry()) if (auto *Contrib = IndexEntry->getContribution(DW_SECT_RNGLISTS)) - ContributionBaseOffset = Contrib->Offset; + ContributionBaseOffset = Contrib->getOffset(); setRangesSection( &Context.getDWARFObj().getRnglistsDWOSection(), ContributionBaseOffset + @@ -565,7 +565,7 @@ Error DWARFUnit::tryExtractDIEsIfNeeded(bool CUDieOnly) { if (auto *IndexEntry = Header.getIndexEntry()) if (const auto *C = IndexEntry->getContribution( Header.getVersion() >= 5 ? DW_SECT_LOCLISTS : DW_SECT_EXT_LOC)) - Data = Data.substr(C->Offset, C->Length); + Data = Data.substr(C->getOffset(), C->getLength()); DWARFDataExtractor DWARFData(Data, IsLittleEndian, getAddressByteSize()); LocTable = @@ -1156,7 +1156,7 @@ DWARFUnit::determineStringOffsetsTableContributionDWO(DWARFDataExtractor &DA) { const auto *C = IndexEntry ? IndexEntry->getContribution(DW_SECT_STR_OFFSETS) : nullptr; if (C) - Offset = C->Offset; + Offset = C->getOffset(); if (getVersion() >= 5) { if (DA.getData().data() == nullptr) return std::nullopt; @@ -1172,7 +1172,7 @@ DWARFUnit::determineStringOffsetsTableContributionDWO(DWARFDataExtractor &DA) { // the length of the string offsets section. StrOffsetsContributionDescriptor Desc; if (C) - Desc = StrOffsetsContributionDescriptor(C->Offset, C->Length, 4, + Desc = StrOffsetsContributionDescriptor(C->getOffset(), C->getLength(), 4, Header.getFormat()); else if (!IndexEntry && !StringOffsetSection.Data.empty()) Desc = StrOffsetsContributionDescriptor(0, StringOffsetSection.Data.size(), diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp index d161bee..90eb96c 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp @@ -181,14 +181,14 @@ bool DWARFUnitIndex::parseImpl(DataExtractor IndexData) { for (unsigned i = 0; i != Header.NumUnits; ++i) { auto *Contrib = Contribs[i]; for (unsigned i = 0; i != Header.NumColumns; ++i) - Contrib[i].Offset = IndexData.getU32(&Offset); + Contrib[i].setOffset(IndexData.getU32(&Offset)); } // Read Table of Section Sizes for (unsigned i = 0; i != Header.NumUnits; ++i) { auto *Contrib = Contribs[i]; for (unsigned i = 0; i != Header.NumColumns; ++i) - Contrib[i].Length = IndexData.getU32(&Offset); + Contrib[i].setLength(IndexData.getU32(&Offset)); } return true; @@ -222,13 +222,21 @@ void DWARFUnitIndex::dump(raw_ostream &OS) const { DWARFSectionKind Kind = ColumnKinds[i]; StringRef Name = getColumnHeader(Kind); if (!Name.empty()) - OS << ' ' << left_justify(Name, 24); + OS << ' ' + << left_justify(Name, + Kind == DWARFSectionKind::DW_SECT_INFO ? 40 : 24); else OS << format(" Unknown: %-15" PRIu32, RawSectionIds[i]); } OS << "\n----- ------------------"; - for (unsigned i = 0; i != Header.NumColumns; ++i) - OS << " ------------------------"; + for (unsigned i = 0; i != Header.NumColumns; ++i) { + DWARFSectionKind Kind = ColumnKinds[i]; + if (Kind == DWARFSectionKind::DW_SECT_INFO || + Kind == DWARFSectionKind::DW_SECT_EXT_TYPES) + OS << " ----------------------------------------"; + else + OS << " ------------------------"; + } OS << '\n'; for (unsigned i = 0; i != Header.NumBuckets; ++i) { auto &Row = Rows[i]; @@ -236,8 +244,16 @@ void DWARFUnitIndex::dump(raw_ostream &OS) const { OS << format("%5u 0x%016" PRIx64 " ", i + 1, Row.Signature); for (unsigned i = 0; i != Header.NumColumns; ++i) { auto &Contrib = Contribs[i]; - OS << format("[0x%08x, 0x%08x) ", Contrib.Offset, - Contrib.Offset + Contrib.Length); + DWARFSectionKind Kind = ColumnKinds[i]; + if (Kind == DWARFSectionKind::DW_SECT_INFO || + Kind == DWARFSectionKind::DW_SECT_EXT_TYPES) + OS << format("[0x%016" PRIx64 ", 0x%016" PRIx64 ") ", + Contrib.getOffset(), + Contrib.getOffset() + Contrib.getLength()); + else + OS << format("[0x%08" PRIx32 ", 0x%08" PRIx32 ") ", + Contrib.getOffset(), + Contrib.getOffset() + Contrib.getLength()); } OS << '\n'; } @@ -259,25 +275,25 @@ DWARFUnitIndex::Entry::getContribution() const { } const DWARFUnitIndex::Entry * -DWARFUnitIndex::getFromOffset(uint32_t Offset) const { +DWARFUnitIndex::getFromOffset(uint64_t Offset) const { if (OffsetLookup.empty()) { for (uint32_t i = 0; i != Header.NumBuckets; ++i) if (Rows[i].Contributions) OffsetLookup.push_back(&Rows[i]); llvm::sort(OffsetLookup, [&](Entry *E1, Entry *E2) { - return E1->Contributions[InfoColumn].Offset < - E2->Contributions[InfoColumn].Offset; + return E1->Contributions[InfoColumn].getOffset() < + E2->Contributions[InfoColumn].getOffset(); }); } auto I = partition_point(OffsetLookup, [&](Entry *E2) { - return E2->Contributions[InfoColumn].Offset <= Offset; + return E2->Contributions[InfoColumn].getOffset() <= Offset; }); if (I == OffsetLookup.begin()) return nullptr; --I; const auto *E = *I; const auto &InfoContrib = E->Contributions[InfoColumn]; - if ((InfoContrib.Offset + InfoContrib.Length) <= Offset) + if ((InfoContrib.getOffset() + InfoContrib.getLength()) <= Offset) return nullptr; return E; } diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp index 9c5ccad..c90237d 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp @@ -405,7 +405,7 @@ unsigned DWARFVerifier::verifyIndex(StringRef Name, DataExtractor D(IndexStr, DCtx.isLittleEndian(), 0); if (!Index.parse(D)) return 1; - using MapType = IntervalMap; + using MapType = IntervalMap; MapType::Allocator Alloc; std::vector> Sections(Index.getColumnKinds().size()); for (const DWARFUnitIndex::Entry &E : Index.getRows()) { @@ -418,20 +418,20 @@ unsigned DWARFVerifier::verifyIndex(StringRef Name, : ArrayRef(E.getContribution(), 1))) { const DWARFUnitIndex::Entry::SectionContribution &SC = E.value(); int Col = E.index(); - if (SC.Length == 0) + if (SC.getLength() == 0) continue; if (!Sections[Col]) Sections[Col] = std::make_unique(Alloc); auto &M = *Sections[Col]; - auto I = M.find(SC.Offset); - if (I != M.end() && I.start() < (SC.Offset + SC.Length)) { + auto I = M.find(SC.getOffset()); + if (I != M.end() && I.start() < (SC.getOffset() + SC.getLength())) { error() << llvm::formatv( "overlapping index entries for entries {0:x16} " "and {1:x16} for column {2}\n", *I, Sig, toString(Index.getColumnKinds()[Col])); return 1; } - M.insert(SC.Offset, SC.Offset + SC.Length - 1, Sig); + M.insert(SC.getOffset(), SC.getOffset() + SC.getLength() - 1, Sig); } } diff --git a/llvm/test/DebugInfo/X86/debug-cu-index-unknown-section.s b/llvm/test/DebugInfo/X86/debug-cu-index-unknown-section.s index 66a592c..054a9e2 100644 --- a/llvm/test/DebugInfo/X86/debug-cu-index-unknown-section.s +++ b/llvm/test/DebugInfo/X86/debug-cu-index-unknown-section.s @@ -6,8 +6,8 @@ # CHECK-NEXT: version = 2, units = 1, slots = 2 # CHECK-EMPTY: # CHECK-NEXT: Index Signature Unknown: 9 INFO -# CHECK-NEXT: ----- ------------------ ------------------------ ------------------------ -# CHECK-NEXT: 1 0x1100001122222222 [0x00001000, 0x00001010) [0x00002000, 0x00002020) +# CHECK-NEXT: ----- ------------------ ------------------------ ---------------------------------------- +# CHECK-NEXT: 1 0x1100001122222222 [0x00001000, 0x00001010) [0x0000000000002000, 0x0000000000002020) .section .debug_cu_index, "", @progbits ## Header: diff --git a/llvm/test/DebugInfo/X86/dwp-v2-cu-index.s b/llvm/test/DebugInfo/X86/dwp-v2-cu-index.s index e66865b..96703d1 100644 --- a/llvm/test/DebugInfo/X86/dwp-v2-cu-index.s +++ b/llvm/test/DebugInfo/X86/dwp-v2-cu-index.s @@ -8,9 +8,9 @@ # CHECK: .debug_cu_index contents: # CHECK-NEXT: version = 2, units = 1, slots = 2 # CHECK-EMPTY: -# CHECK-NEXT: Index Signature INFO ABBREV LINE LOC STR_OFFSETS MACINFO MACRO -# CHECK-NEXT: ----- ------------------ ------------------------ ------------------------ ------------------------ ------------------------ ------------------------ ------------------------ ------------------------ -# CHECK-NEXT: 1 0x1100001122222222 [0x00001000, 0x00001010) [0x00002000, 0x00002020) [0x00003000, 0x00003030) [0x00004000, 0x00004040) [0x00005000, 0x00005050) [0x00006000, 0x00006060) [0x00007000, 0x00007070) +# CHECK-NEXT: Index Signature INFO ABBREV LINE LOC STR_OFFSETS MACINFO MACRO +# CHECK-NEXT: ----- ------------------ ---------------------------------------- ------------------------ ------------------------ ------------------------ ------------------------ ------------------------ ------------------------ +# CHECK-NEXT: 1 0x1100001122222222 [0x0000000000001000, 0x0000000000001010) [0x00002000, 0x00002020) [0x00003000, 0x00003030) [0x00004000, 0x00004040) [0x00005000, 0x00005050) [0x00006000, 0x00006060) [0x00007000, 0x00007070) .section .debug_cu_index, "", @progbits ## Header: diff --git a/llvm/test/DebugInfo/X86/dwp-v2-tu-index.s b/llvm/test/DebugInfo/X86/dwp-v2-tu-index.s index d10bb4c..94630f7 100644 --- a/llvm/test/DebugInfo/X86/dwp-v2-tu-index.s +++ b/llvm/test/DebugInfo/X86/dwp-v2-tu-index.s @@ -8,9 +8,9 @@ # CHECK: .debug_tu_index contents: # CHECK-NEXT: version = 2, units = 1, slots = 2 # CHECK-EMPTY: -# CHECK-NEXT: Index Signature TYPES ABBREV LINE STR_OFFSETS -# CHECK-NEXT: ----- ------------------ ------------------------ ------------------------ ------------------------ ------------------------ -# CHECK-NEXT: 1 0x1100001122222222 [0x00001000, 0x00001010) [0x00002000, 0x00002020) [0x00003000, 0x00003030) [0x00004000, 0x00004040) +# CHECK-NEXT: Index Signature TYPES ABBREV LINE STR_OFFSETS +# CHECK-NEXT: ----- ------------------ ---------------------------------------- ------------------------ ------------------------ ------------------------ +# CHECK-NEXT: 1 0x1100001122222222 [0x0000000000001000, 0x0000000000001010) [0x00002000, 0x00002020) [0x00003000, 0x00003030) [0x00004000, 0x00004040) .section .debug_tu_index, "", @progbits ## Header: diff --git a/llvm/test/DebugInfo/X86/dwp-v5-cu-index.s b/llvm/test/DebugInfo/X86/dwp-v5-cu-index.s index 6c4aac8..43836ba 100644 --- a/llvm/test/DebugInfo/X86/dwp-v5-cu-index.s +++ b/llvm/test/DebugInfo/X86/dwp-v5-cu-index.s @@ -8,9 +8,9 @@ # CHECK: .debug_cu_index contents: # CHECK-NEXT: version = 5, units = 1, slots = 2 # CHECK-EMPTY: -# CHECK-NEXT: Index Signature INFO ABBREV LINE LOCLISTS STR_OFFSETS MACRO RNGLISTS -# CHECK-NEXT: ----- ------------------ ------------------------ ------------------------ ------------------------ ------------------------ ------------------------ ------------------------ ------------------------ -# CHECK-NEXT: 1 0x1100001122222222 [0x00001000, 0x00001010) [0x00002000, 0x00002020) [0x00003000, 0x00003030) [0x00004000, 0x00004040) [0x00005000, 0x00005050) [0x00006000, 0x00006060) [0x00007000, 0x00007070) +# CHECK-NEXT: Index Signature INFO ABBREV LINE LOCLISTS STR_OFFSETS MACRO RNGLISTS +# CHECK-NEXT: ----- ------------------ ---------------------------------------- ------------------------ ------------------------ ------------------------ ------------------------ ------------------------ ------------------------ +# CHECK-NEXT: 1 0x1100001122222222 [0x0000000000001000, 0x0000000000001010) [0x00002000, 0x00002020) [0x00003000, 0x00003030) [0x00004000, 0x00004040) [0x00005000, 0x00005050) [0x00006000, 0x00006060) [0x00007000, 0x00007070) .section .debug_cu_index, "", @progbits ## Header: diff --git a/llvm/test/DebugInfo/X86/dwp-v5-tu-index.s b/llvm/test/DebugInfo/X86/dwp-v5-tu-index.s index 0d65277..6a4f94f 100644 --- a/llvm/test/DebugInfo/X86/dwp-v5-tu-index.s +++ b/llvm/test/DebugInfo/X86/dwp-v5-tu-index.s @@ -8,9 +8,9 @@ # CHECK: .debug_tu_index contents: # CHECK-NEXT: version = 5, units = 1, slots = 2 # CHECK-EMPTY: -# CHECK-NEXT: Index Signature INFO ABBREV LINE STR_OFFSETS -# CHECK-NEXT: ----- ------------------ ------------------------ ------------------------ ------------------------ ------------------------ -# CHECK-NEXT: 1 0x1100001122222222 [0x00001000, 0x00001010) [0x00002000, 0x00002020) [0x00003000, 0x00003030) [0x00004000, 0x00004040) +# CHECK-NEXT: Index Signature INFO ABBREV LINE STR_OFFSETS +# CHECK-NEXT: ----- ------------------ ---------------------------------------- ------------------------ ------------------------ ------------------------ +# CHECK-NEXT: 1 0x1100001122222222 [0x0000000000001000, 0x0000000000001010) [0x00002000, 0x00002020) [0x00003000, 0x00003030) [0x00004000, 0x00004040) .section .debug_tu_index, "", @progbits ## Header: diff --git a/llvm/test/DebugInfo/dwarfdump-dwp.test b/llvm/test/DebugInfo/dwarfdump-dwp.test index 0f57a51..c1f0f1c 100644 --- a/llvm/test/DebugInfo/dwarfdump-dwp.test +++ b/llvm/test/DebugInfo/dwarfdump-dwp.test @@ -38,17 +38,17 @@ RUN: llvm-dwarfdump -v %p/Inputs/dwarfdump-dwp.x86_64.o | FileCheck %s ; CHECK: .debug_cu_index contents: ; CHECK-NEXT: version = 2, units = 2, slots = 16 -; CHECK: Index Signature INFO ABBREV LINE STR_OFFSETS -; CHECK-NEXT: ----- ------------------ ------------------------ ------------------------ ------------------------ ------------------------ -; CHECK-NEXT: 3 0xfef104c25502f092 [0x0000002d, 0x0000005f) [0x00000043, 0x0000008e) [0x0000001a, 0x00000034) [0x00000010, 0x00000024) -; CHECK-NEXT: 9 0x03c30756e2d45008 [0x00000000, 0x0000002d) [0x00000000, 0x00000043) [0x00000000, 0x0000001a) [0x00000000, 0x00000010) +; CHECK: Index Signature INFO ABBREV LINE STR_OFFSETS +; CHECK-NEXT: ----- ------------------ ---------------------------------------- ------------------------ ------------------------ ------------------------ +; CHECK-NEXT: 3 0xfef104c25502f092 [0x000000000000002d, 0x000000000000005f) [0x00000043, 0x0000008e) [0x0000001a, 0x00000034) [0x00000010, 0x00000024) +; CHECK-NEXT: 9 0x03c30756e2d45008 [0x0000000000000000, 0x000000000000002d) [0x00000000, 0x00000043) [0x00000000, 0x0000001a) [0x00000000, 0x00000010) ; CHECK: .debug_tu_index contents: ; CHECK-NEXT: version = 2, units = 2, slots = 16 -; CHECK: Index Signature TYPES ABBREV LINE STR_OFFSETS -; CHECK-NEXT: ----- ------------------ ------------------------ ------------------------ ------------------------ ------------------------ -; CHECK-NEXT: 9 0x1d02f3be30cc5688 [0x00000024, 0x00000048) [0x00000043, 0x0000008e) [0x0000001a, 0x00000034) [0x00000010, 0x00000024) -; CHECK-NEXT: 13 0x3875c0e21cda63fc [0x00000000, 0x00000024) [0x00000000, 0x00000043) [0x00000000, 0x0000001a) [0x00000000, 0x00000010) +; CHECK: Index Signature TYPES ABBREV LINE STR_OFFSETS +; CHECK-NEXT: ----- ------------------ ---------------------------------------- ------------------------ ------------------------ ------------------------ +; CHECK-NEXT: 9 0x1d02f3be30cc5688 [0x0000000000000024, 0x0000000000000048) [0x00000043, 0x0000008e) [0x0000001a, 0x00000034) [0x00000010, 0x00000024) +; CHECK-NEXT: 13 0x3875c0e21cda63fc [0x0000000000000000, 0x0000000000000024) [0x00000000, 0x00000043) [0x00000000, 0x0000001a) [0x00000000, 0x00000010) ; TODO: use the index section offset info to correctly dump strings in debug info ; TODO: use the index section offset info to correctly dump file names in debug info diff --git a/llvm/test/tools/llvm-dwp/X86/debug_macro_v5.s b/llvm/test/tools/llvm-dwp/X86/debug_macro_v5.s index d5e8be4..f95a218 100644 --- a/llvm/test/tools/llvm-dwp/X86/debug_macro_v5.s +++ b/llvm/test/tools/llvm-dwp/X86/debug_macro_v5.s @@ -12,8 +12,8 @@ # CHECK-DAG: .debug_cu_index contents: # CHECK-NEXT: version = 5, units = 1, slots = 2 -# CHECK: Index Signature INFO ABBREV STR_OFFSETS MACRO -# CHECK: 1 0x0000000000000000 [0x00000000, 0x00000019) [0x00000000, 0x00000008) [0x00000000, 0x0000000c) [0x00000000, 0x0000000b) +# CHECK: Index Signature INFO ABBREV STR_OFFSETS MACRO +# CHECK: 1 0x0000000000000000 [0x0000000000000000, 0x0000000000000019) [0x00000000, 0x00000008) [0x00000000, 0x0000000c) [0x00000000, 0x0000000b) .section .debug_info.dwo,"e",@progbits .long .Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit diff --git a/llvm/test/tools/llvm-dwp/X86/info-v5.s b/llvm/test/tools/llvm-dwp/X86/info-v5.s index c628df3..7021020d 100644 --- a/llvm/test/tools/llvm-dwp/X86/info-v5.s +++ b/llvm/test/tools/llvm-dwp/X86/info-v5.s @@ -10,8 +10,8 @@ # CHECK-DAG: .debug_cu_index contents: # CHECK: version = 5, units = 1, slots = 2 -# CHECK: Index Signature INFO ABBREV -# CHECK: 1 [[DWOID]] [0x00000000, 0x00000054) [0x00000000, 0x0000002a) +# CHECK: Index Signature INFO ABBREV +# CHECK: 1 [[DWOID]] [0x0000000000000000, 0x0000000000000054) [0x00000000, 0x0000002a) .section .debug_info.dwo,"e",@progbits .long .Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit diff --git a/llvm/test/tools/llvm-dwp/X86/loclists.s b/llvm/test/tools/llvm-dwp/X86/loclists.s index b96e5ee..48c5b74 100644 --- a/llvm/test/tools/llvm-dwp/X86/loclists.s +++ b/llvm/test/tools/llvm-dwp/X86/loclists.s @@ -15,12 +15,12 @@ # CHECK-NEXT: DW_LLE_offset_pair (0x0000000000000004, 0x0000000000000008): DW_OP_reg3 RBX # CHECK-DAG: .debug_cu_index contents: -# CHECK: Index Signature INFO ABBREV LOCLISTS -# CHECK: 1 {{.*}} [0x00000018, 0x0000002d) [0x00000000, 0x00000004) [0x00000000, 0x0000001d) +# CHECK: Index Signature INFO ABBREV LOCLISTS +# CHECK: 1 {{.*}} [0x0000000000000018, 0x000000000000002d) [0x00000000, 0x00000004) [0x00000000, 0x0000001d) # CHECK-DAG: .debug_tu_index contents: -# CHECK: Index Signature INFO ABBREV LOCLISTS -# CHECK: 2 {{.*}} [0x00000000, 0x00000018) [0x00000000, 0x00000004) [0x00000000, 0x0000001d) +# CHECK: Index Signature INFO ABBREV LOCLISTS +# CHECK: 2 {{.*}} [0x0000000000000000, 0x0000000000000018) [0x00000000, 0x00000004) [0x00000000, 0x0000001d) .section .debug_info.dwo,"e",@progbits .long .Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit diff --git a/llvm/test/tools/llvm-dwp/X86/merge.test b/llvm/test/tools/llvm-dwp/X86/merge.test index dfd8fb8..0cf56bd 100644 --- a/llvm/test/tools/llvm-dwp/X86/merge.test +++ b/llvm/test/tools/llvm-dwp/X86/merge.test @@ -26,21 +26,21 @@ CHECK-LABEL: Abbrev table for offset: CHECK: 0x0000[[BAOFF:.*]] CHECK: .debug_info.dwo contents: -CHECK: [[COFF:0x[0-9a-f]*]]: +CHECK: 0x[[#%.8x,COFF:]]: CHECK-LABEL: Compile Unit: length = {{.*}}, version = 0x0004, abbr_offset = -CHECK: 0x[[CAOFF]], addr_size = 0x08 (next unit at [[AOFF:.*]]) +CHECK: 0x[[CAOFF]], addr_size = 0x08 (next unit at 0x[[#%.8x,AOFF:]]) CHECK: DW_AT_GNU_dwo_id {{.*}} ([[DWOC:.*]]) -CHECK: [[AOFF]]: +CHECK: [[#AOFF]]: CHECK-LABEL: Compile Unit: length = {{.*}}, version = 0x0004, abbr_offset = -CHECK: 0x[[AAOFF]], addr_size = 0x08 (next unit at [[BOFF:.*]]) +CHECK: 0x[[AAOFF]], addr_size = 0x08 (next unit at 0x[[#%.8x,BOFF:]]) CHECK: DW_AT_GNU_dwo_id {{.*}} ([[DWOA:.*]]) -CHECK: [[BOFF]]: +CHECK: [[#BOFF]]: CHECK-LABEL: Compile Unit: length = {{.*}}, version = 0x0004, abbr_offset = -CHECK: 0x[[BAOFF]], addr_size = 0x08 (next unit at [[XOFF:.*]]) +CHECK: 0x[[BAOFF]], addr_size = 0x08 (next unit at 0x[[#%.8x,XOFF:]]) CHECK: DW_AT_GNU_dwo_id {{.*}} ([[DWOB:.*]]) CHECK-LABEL: .debug_cu_index -CHECK: Index Signature INFO ABBREV LINE STR_OFFSETS -CHECK-DAG: [[DWOC]] [[[COFF]], [[AOFF]]) [0x0000[[CAOFF]], 0x0000[[AAOFF]]) [0x00000000, 0x00000011) [0x00000000, 0x00000018) -CHECK-DAG: [[DWOA]] [[[AOFF]], [[BOFF]]) [0x0000[[AAOFF]], 0x0000[[BAOFF]]) [0x00000011, 0x00000022) [0x00000018, 0x00000028) -CHECK-DAG: [[DWOB]] [[[BOFF]], [[XOFF]]) [0x0000[[BAOFF]], 0x000000c3) [0x00000022, 0x00000033) [0x00000028, 0x0000003c) +CHECK: Index Signature INFO ABBREV LINE STR_OFFSETS +CHECK-DAG: [[DWOC]] [0x00000000[[#COFF]], 0x00000000[[#AOFF]]) [0x0000[[CAOFF]], 0x0000[[AAOFF]]) [0x00000000, 0x00000011) [0x00000000, 0x00000018) +CHECK-DAG: [[DWOA]] [0x00000000[[#AOFF]], 0x00000000[[#BOFF]]) [0x0000[[AAOFF]], 0x0000[[BAOFF]]) [0x00000011, 0x00000022) [0x00000018, 0x00000028) +CHECK-DAG: [[DWOB]] [0x00000000[[#BOFF]], 0x00000000[[#XOFF]]) [0x0000[[BAOFF]], 0x000000c3) [0x00000022, 0x00000033) [0x00000028, 0x0000003c) diff --git a/llvm/test/tools/llvm-dwp/X86/rnglists.s b/llvm/test/tools/llvm-dwp/X86/rnglists.s index 602cb3c..25eed13 100644 --- a/llvm/test/tools/llvm-dwp/X86/rnglists.s +++ b/llvm/test/tools/llvm-dwp/X86/rnglists.s @@ -6,12 +6,12 @@ # RUN: llvm-dwarfdump -debug-rnglists -debug-cu-index -debug-tu-index %t.dwp | FileCheck %s # CHECK-DAG: .debug_cu_index contents: -# CHECK: Index Signature INFO ABBREV RNGLISTS -# CHECK: 1 {{.*}} [0x00000018, 0x0000002d) [0x00000000, 0x00000004) [0x00000000, 0x00000017) +# CHECK: Index Signature INFO ABBREV RNGLISTS +# CHECK: 1 {{.*}} [0x0000000000000018, 0x000000000000002d) [0x00000000, 0x00000004) [0x00000000, 0x00000017) # CHECK-DAG: .debug_tu_index contents: -# CHECK: Index Signature INFO ABBREV RNGLISTS -# CHECK: 2 {{.*}} [0x00000000, 0x00000018) [0x00000000, 0x00000004) [0x00000000, 0x00000017) +# CHECK: Index Signature INFO ABBREV RNGLISTS +# CHECK: 2 {{.*}} [0x0000000000000000, 0x0000000000000018) [0x00000000, 0x00000004) [0x00000000, 0x00000017) # CHECK-DAG: .debug_rnglists.dwo contents: # range list header: length = 0x00000013, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000001 diff --git a/llvm/test/tools/llvm-dwp/X86/simple.test b/llvm/test/tools/llvm-dwp/X86/simple.test index 83fa7bc..91c4021 100644 --- a/llvm/test/tools/llvm-dwp/X86/simple.test +++ b/llvm/test/tools/llvm-dwp/X86/simple.test @@ -28,9 +28,9 @@ CHECK: DW_TAG_subprogram CHECK: DW_TAG_formal_parameter CHECK: .debug_info.dwo contents: -CHECK: [[AOFF:0x[0-9a-f]*]]: +CHECK: 0x[[#%.8x,AOFF:]]: CHECK-LABEL: Compile Unit: length = {{.*}}, version = 0x0004, abbr_offset = -CHECK: 0x[[AAOFF]], addr_size = 0x08 (next unit at [[BOFF:.*]]) +CHECK: 0x[[AAOFF]], addr_size = 0x08 (next unit at 0x[[#%.8x,BOFF:]]) CHECK: DW_TAG_compile_unit CHECK: DW_AT_name {{.*}} "a.cpp" CHECK: DW_AT_GNU_dwo_id {{.*}} ([[DWOA:.*]]) @@ -40,9 +40,9 @@ CHECK: DW_TAG_structure_type NOTYP: DW_AT_name {{.*}} "foo" TYPES: DW_AT_signature {{.*}} ([[FOOSIG:.*]]) -CHECK: [[BOFF]]: +CHECK: 0x[[#BOFF]]: CHECK-LABEL: Compile Unit: length = {{.*}}, version = 0x0004, abbr_offset = -CHECK: 0x[[BAOFF]], addr_size = 0x08 (next unit at [[XOFF:.*]]) +CHECK: 0x[[BAOFF]], addr_size = 0x08 (next unit at 0x[[#%.8x,XOFF:]]) CHECK: DW_AT_name {{.*}} "b.cpp" CHECK: DW_AT_GNU_dwo_id {{.*}} ([[DWOB:.*]]) CHECK: DW_TAG_structure_type @@ -54,32 +54,32 @@ CHECK: DW_TAG_formal_parameter NOTYP-NOT: .debug_types.dwo contents: TYPES-LABEL: .debug_types.dwo contents: -TYPES: [[FOOUOFF:0x[0-9a-f]*]]: +TYPES: 0x[[#%.8x,FOOUOFF:]]: TYPES-LABEL: Type Unit: length = 0x00000020, format = DWARF32, version = 0x0004, abbr_offset = -TYPES: 0x[[AAOFF]], addr_size = 0x08, name = 'foo', type_signature = [[FOOSIG]], type_offset = 0x[[FOOOFF:.*]] (next unit at [[BARUOFF:.*]]) +TYPES: 0x[[AAOFF]], addr_size = 0x08, name = 'foo', type_signature = [[FOOSIG]], type_offset = 0x[[FOOOFF:.*]] (next unit at 0x[[#%.8x,BARUOFF:]]) TYPES: DW_TAG_type_unit TYPES: [[FOOOFF]]: DW_TAG_structure_type TYPES: DW_AT_name {{.*}} "foo" -TYPES: [[BARUOFF]]: +TYPES: 0x[[#BARUOFF]]: TYPES-LABEL: Type Unit: length = 0x00000020, format = DWARF32, version = 0x0004, abbr_offset = -TYPES: 0x[[BAOFF]], addr_size = 0x08, name = 'bar', type_signature = [[BARSIG]], type_offset = 0x001e (next unit at [[XUOFF:.*]]) +TYPES: 0x[[BAOFF]], addr_size = 0x08, name = 'bar', type_signature = [[BARSIG]], type_offset = 0x001e (next unit at 0x[[#%.8x,XUOFF:]]) TYPES: DW_TAG_type_unit TYPES: 0x00000042: DW_TAG_structure_type TYPES: DW_AT_name {{.*}} "bar" CHECK-LABEL: .debug_cu_index contents: -CHECK: Index Signature INFO ABBREV LINE STR_OFFSETS -TYPES: 1 [[DWOA]] [[[AOFF]], [[BOFF]]) [0x0000[[AAOFF]], 0x0000[[BAOFF]]) [0x00000000, 0x0000001a) [0x00000000, 0x00000010) -TYPES: 3 [[DWOB]] [[[BOFF]], [[XOFF]]) [0x0000[[BAOFF]], 0x00000099) [0x0000001a, 0x00000034) [0x00000010, 0x00000024) -NOTYP: 3 [[DWOA]] [[[AOFF]], [[BOFF]]) [0x0000[[AAOFF]], 0x0000[[BAOFF]]) [0x00000000, 0x00000011) [0x00000000, 0x00000010) -NOTYP: 4 [[DWOB]] [[[BOFF]], [[XOFF]]) [0x0000[[BAOFF]], 0x00000075) [0x00000011, 0x00000022) [0x00000010, 0x00000024) +CHECK: Index Signature INFO ABBREV LINE STR_OFFSETS +TYPES: 1 [[DWOA]] [0x00000000[[#AOFF]], 0x00000000[[#BOFF]]) [0x0000[[AAOFF]], 0x0000[[BAOFF]]) [0x00000000, 0x0000001a) [0x00000000, 0x00000010) +TYPES: 3 [[DWOB]] [0x00000000[[#BOFF]], 0x00000000[[#XOFF]]) [0x0000[[BAOFF]], 0x00000099) [0x0000001a, 0x00000034) [0x00000010, 0x00000024) +NOTYP: 3 [[DWOA]] [0x00000000[[#AOFF]], 0x00000000[[#BOFF]]) [0x0000[[AAOFF]], 0x0000[[BAOFF]]) [0x00000000, 0x00000011) [0x00000000, 0x00000010) +NOTYP: 4 [[DWOB]] [0x00000000[[#BOFF]], 0x00000000[[#XOFF]]) [0x0000[[BAOFF]], 0x00000075) [0x00000011, 0x00000022) [0x00000010, 0x00000024) Ensure we do not create a debug_tu_index, even an empty or malformed one. NOTYPOBJ-NOT: .debug_tu_index -TYPES: Index Signature TYPES ABBREV LINE STR_OFFSETS -TYPES: 1 [[FOOSIG]] [[[FOOUOFF]], [[BARUOFF]]) [0x0000[[AAOFF]], 0x0000[[BAOFF]]) [0x00000000, 0x0000001a) [0x00000000, 0x00000010) -TYPES: 4 [[BARSIG]] [[[BARUOFF]], [[XUOFF]]) [0x0000[[BAOFF]], 0x00000099) [0x0000001a, 0x00000034) [0x00000010, 0x00000024) +TYPES: Index Signature TYPES ABBREV LINE STR_OFFSETS +TYPES: 1 [[FOOSIG]] [0x00000000[[#FOOUOFF]], 0x00000000[[#BARUOFF]]) [0x0000[[AAOFF]], 0x0000[[BAOFF]]) [0x00000000, 0x0000001a) [0x00000000, 0x00000010) +TYPES: 4 [[BARSIG]] [0x00000000[[#BARUOFF]], 0x00000000[[#XUOFF]]) [0x0000[[BAOFF]], 0x00000099) [0x0000001a, 0x00000034) [0x00000010, 0x00000024) CHECK-LABEL: .debug_str.dwo contents: CHECK: "clang version diff --git a/llvm/test/tools/llvm-dwp/X86/tu_units_v5.s b/llvm/test/tools/llvm-dwp/X86/tu_units_v5.s index 6436281..7f2dc83 100644 --- a/llvm/test/tools/llvm-dwp/X86/tu_units_v5.s +++ b/llvm/test/tools/llvm-dwp/X86/tu_units_v5.s @@ -13,9 +13,9 @@ # CHECK: 0x0000001b: Type Unit: length = 0x00000017, format = DWARF32, version = 0x0005, unit_type = DW_UT_split_type, abbr_offset = 0x0000, addr_size = 0x08, name = '', type_signature = [[TUID2:.*]], type_offset = 0x0019 (next unit at 0x00000036) # CHECK-DAG: .debug_tu_index contents: # CHECK: version = 5, units = 2, slots = 4 -# CHECK: Index Signature INFO ABBREV -# CHECK: 1 [[TUID1]] [0x00000000, 0x0000001b) [0x00000000, 0x00000010) -# CHECK: 4 [[TUID2]] [0x0000001b, 0x00000036) [0x00000000, 0x00000010) +# CHECK: Index Signature INFO ABBREV +# CHECK: 1 [[TUID1]] [0x0000000000000000, 0x000000000000001b) [0x00000000, 0x00000010) +# CHECK: 4 [[TUID2]] [0x000000000000001b, 0x0000000000000036) [0x00000000, 0x00000010) .section .debug_info.dwo,"e",@progbits .long .Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit diff --git a/llvm/test/tools/llvm-dwp/X86/unknown-section-id.s b/llvm/test/tools/llvm-dwp/X86/unknown-section-id.s index 387dbc8..6786521 100644 --- a/llvm/test/tools/llvm-dwp/X86/unknown-section-id.s +++ b/llvm/test/tools/llvm-dwp/X86/unknown-section-id.s @@ -17,7 +17,7 @@ # CHECK: Index Signature INFO ABBREV # CHECK-NOT: Unknown # CHECK: ----- -# CHECK-NEXT: 1 0x1100002222222222 [0x00000000, 0x00000014) [0x00000000, 0x00000009) +# CHECK-NEXT: 1 0x1100002222222222 [0x0000000000000000, 0x0000000000000014) [0x00000000, 0x00000009) # CHECK-NOT: [ # CHECK: .debug_tu_index contents: @@ -25,7 +25,7 @@ # CHECK: Index Signature TYPES ABBREV # CHECK-NOT: Unknown # CHECK: ----- -# CHECK-NEXT: 2 0x1100003333333333 [0x00000000, 0x00000019) [0x00000009, 0x00000014) +# CHECK-NEXT: 2 0x1100003333333333 [0x0000000000000000, 0x0000000000000019) [0x00000009, 0x00000014) # CHECK-NOT: [ .section .debug_abbrev.dwo, "e", @progbits