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();
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;
};
Streamer.switchSection(SectionIter->second.first);
StringRef OutData = SectionContents;
- uint32_t DWPOffset = 0;
+ uint64_t DWPOffset = 0;
switch (SectionIter->second.second) {
default: {
// 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;
}
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(
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
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));
}
}
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;
}
*GetDWOId());
return;
}
- offset += contribution->Offset;
+ offset += contribution->getOffset32();
}
m_loclists_base = loclists_base;
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;
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,
"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");
}
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);
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;
}
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;
}
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:
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 {
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
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();
}
}
// 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();
}
}
}
}
}
-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,
// 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,
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 =
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());
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();
}
}
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()) {
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();
});
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;
}
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 +
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 =
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;
// 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(),
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;
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];
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';
}
}
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;
}
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()) {
: 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);
}
}
# 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:
# 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:
# 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:
# 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:
# 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:
; 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
# 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
# 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
# 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
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)
# 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
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:.*]])
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
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
# 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
# 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:
# 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