[llvm][dwwarf] Change CU/TU index to 64-bit
authorAlexander Yermolovich <ayermolo@fb.com>
Tue, 6 Dec 2022 00:37:26 +0000 (16:37 -0800)
committerAlexander Yermolovich <ayermolo@fb.com>
Wed, 7 Dec 2022 21:08:35 +0000 (13:08 -0800)
Summary:

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.

24 files changed:
bolt/lib/Core/DebugData.cpp
bolt/lib/Rewrite/DWARFRewriter.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h
llvm/lib/DWP/DWP.cpp
llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
llvm/test/DebugInfo/X86/debug-cu-index-unknown-section.s
llvm/test/DebugInfo/X86/dwp-v2-cu-index.s
llvm/test/DebugInfo/X86/dwp-v2-tu-index.s
llvm/test/DebugInfo/X86/dwp-v5-cu-index.s
llvm/test/DebugInfo/X86/dwp-v5-tu-index.s
llvm/test/DebugInfo/dwarfdump-dwp.test
llvm/test/tools/llvm-dwp/X86/debug_macro_v5.s
llvm/test/tools/llvm-dwp/X86/info-v5.s
llvm/test/tools/llvm-dwp/X86/loclists.s
llvm/test/tools/llvm-dwp/X86/merge.test
llvm/test/tools/llvm-dwp/X86/rnglists.s
llvm/test/tools/llvm-dwp/X86/simple.test
llvm/test/tools/llvm-dwp/X86/tu_units_v5.s
llvm/test/tools/llvm-dwp/X86/unknown-section-id.s

index 1d6f656..5be8558 100644 (file)
@@ -1170,8 +1170,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();
 
index c3a8e39..b91e731 100644 (file)
@@ -1209,11 +1209,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;
   };
@@ -1224,7 +1224,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: {
@@ -1307,14 +1307,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;
 }
@@ -1354,11 +1355,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(
@@ -1507,9 +1509,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
@@ -1538,9 +1541,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));
       }
     }
index 399578b..9a3933e 100644 (file)
@@ -335,7 +335,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;
   }
@@ -483,7 +483,7 @@ void DWARFUnit::SetLoclistsBase(dw_addr_t loclists_base) {
           *GetDWOId());
       return;
     }
-    offset += contribution->Offset;
+    offset += contribution->getOffset32();
   }
   m_loclists_base = loclists_base;
 
@@ -521,8 +521,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;
@@ -534,8 +534,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 "
         "0x%" PRIx64,
@@ -916,7 +916,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");
     }
@@ -927,7 +927,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);
index b587b4f..233b57d 100644 (file)
@@ -41,7 +41,7 @@ DWARFCompileUnit *SymbolFileDWARFDwo::GetDWOCompileUnitForHash(uint64_t hash) {
       if (auto *unit_contrib = entry->getContribution())
         return llvm::dyn_cast_or_null<DWARFCompileUnit>(
             DebugInfo().GetUnitAtOffset(DIERef::Section::DebugInfo,
-                                        unit_contrib->Offset));
+                                        unit_contrib->getOffset32()));
     }
     return nullptr;
   }
index 584cc55..b4978cc 100644 (file)
@@ -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;
   }
 
index b5e191b..8459594 100644 (file)
@@ -110,9 +110,33 @@ class DWARFUnitIndex {
 public:
   class Entry {
   public:
-    struct SectionContribution {
-      uint32_t Offset;
-      uint32_t Length;
+    class SectionContribution {
+    private:
+      uint64_t Fields[2];
+
+    public:
+      static constexpr unsigned OffsetFieldIndex = 0;
+      static constexpr unsigned LengthFieldIndex = 1;
+      SectionContribution() { memset(&Fields, 0, sizeof(Fields)); }
+      SectionContribution(uint64_t Offset, uint64_t Length) {
+        Fields[OffsetFieldIndex] = Offset;
+        Fields[LengthFieldIndex] = Length;
+      }
+
+      void setField(unsigned Index, uint64_t Value) { Fields[Index] = Value; }
+      void setOffset(uint64_t Value) { Fields[OffsetFieldIndex] = Value; }
+      void setLength(uint64_t Value) { Fields[LengthFieldIndex] = Value; }
+      uint64_t getField32(unsigned Index) const {
+        return (uint32_t)Fields[Index];
+      }
+      uint64_t getOffset() const { return Fields[OffsetFieldIndex]; }
+      uint64_t getLength() const { return Fields[LengthFieldIndex]; }
+      uint32_t getOffset32() const {
+        return (uint32_t)Fields[OffsetFieldIndex];
+      }
+      uint32_t getLength32() const {
+        return (uint32_t)Fields[LengthFieldIndex];
+      }
     };
 
   private:
@@ -160,7 +184,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<DWARFSectionKind> getColumnKinds() const {
index 25badc8..7133622 100644 (file)
@@ -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,13 @@ void writeStringsAndOffsets(MCStreamer &Out, DWPStringPool &Strings,
   }
 }
 
-void writeIndexTable(
-    MCStreamer &Out, ArrayRef<unsigned> ContributionOffsets,
-    const MapVector<uint64_t, UnitIndexEntry> &IndexEntries,
-    uint32_t DWARFUnitIndex::Entry::SectionContribution::*Field) {
+void writeIndexTable(MCStreamer &Out, ArrayRef<unsigned> ContributionOffsets,
+                     const MapVector<uint64_t, UnitIndexEntry> &IndexEntries,
+                     unsigned Index) {
   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((E.second.Contributions[I].getField32(Index)), 4);
 }
 
 void writeIndex(MCStreamer &Out, MCSection *Section,
@@ -461,11 +461,11 @@ void writeIndex(MCStreamer &Out, MCSection *Section,
 
   // Write the offsets.
   writeIndexTable(Out, ContributionOffsets, IndexEntries,
-                  &DWARFUnitIndex::Entry::SectionContribution::Offset);
+                  DWARFUnitIndex::Entry::SectionContribution::OffsetFieldIndex);
 
   // Write the lengths.
   writeIndexTable(Out, ContributionOffsets, IndexEntries,
-                  &DWARFUnitIndex::Entry::SectionContribution::Length);
+                  DWARFUnitIndex::Entry::SectionContribution::LengthFieldIndex);
 }
 
 Error buildDuplicateError(const std::pair<uint64_t, UnitIndexEntry> &PrevE,
@@ -642,9 +642,9 @@ Error write(MCStreamer &Out, ArrayRef<std::string> 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 +664,21 @@ Error write(MCStreamer &Out, ArrayRef<std::string> 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<uint32_t>::max() - InfoSectionOffset <
-              C.Length)
+              C.getLength32())
             return make_error<DWPError>(
                 "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<CompileUnitIdentifiers> EID =
-                getCUIdentifiers(Header, AbbrevSection,
-                                 Info.substr(UnitOffset - C.Length, C.Length),
-                                 CurStrOffsetSection, CurStrSection);
+            Expected<CompileUnitIdentifiers> EID = getCUIdentifiers(
+                Header, AbbrevSection,
+                Info.substr(UnitOffset - C.getLength32(), C.getLength32()),
+                CurStrOffsetSection, CurStrSection);
 
             if (!EID)
               return createFileError(Input, EID.takeError());
@@ -696,8 +696,9 @@ Error write(MCStreamer &Out, ArrayRef<std::string> 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 +761,15 @@ Error write(MCStreamer &Out, ArrayRef<std::string> 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()) {
index 522357b..14adce5 100644 (file)
@@ -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<DWARFUnit> &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(),
index d161bee..90eb96c 100644 (file)
@@ -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;
 }
index 20cd056..541f0ff 100644 (file)
@@ -405,7 +405,7 @@ unsigned DWARFVerifier::verifyIndex(StringRef Name,
   DataExtractor D(IndexStr, DCtx.isLittleEndian(), 0);
   if (!Index.parse(D))
     return 1;
-  using MapType = IntervalMap<uint32_t, uint64_t>;
+  using MapType = IntervalMap<uint64_t, uint64_t>;
   MapType::Allocator Alloc;
   std::vector<std::unique_ptr<MapType>> Sections(Index.getColumnKinds().size());
   for (const DWARFUnitIndex::Entry &E : Index.getRows()) {
@@ -418,20 +418,20 @@ unsigned DWARFVerifier::verifyIndex(StringRef Name,
                                 : makeArrayRef(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<MapType>(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);
     }
   }
 
index 66a592c..054a9e2 100644 (file)
@@ -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:
index e66865b..96703d1 100644 (file)
@@ -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:
index d10bb4c..94630f7 100644 (file)
@@ -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:
index 6c4aac8..43836ba 100644 (file)
@@ -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:
index 0d65277..6a4f94f 100644 (file)
@@ -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:
index 0f57a51..c1f0f1c 100644 (file)
@@ -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
index d5e8be4..f95a218 100644 (file)
@@ -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
index c628df3..7021020 100644 (file)
@@ -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
index b96e5ee..48c5b74 100644 (file)
 # 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
index dfd8fb8..0cf56bd 100644 (file)
@@ -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)
index 602cb3c..25eed13 100644 (file)
@@ -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
index 83fa7bc..91c4021 100644 (file)
@@ -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
index 6436281..7f2dc83 100644 (file)
@@ -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
index 387dbc8..6786521 100644 (file)
@@ -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