73 changes: 36 additions & 37 deletions llvm/lib/DWP/DWP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ static StringRef getSubsection(StringRef Section,
const auto *Off = Entry.getContribution(Kind);
if (!Off)
return StringRef();
return Section.substr(Off->getOffset(), Off->getLength());
return Section.substr(Off->Offset, Off->Length);
}

static void
Expand All @@ -200,17 +200,16 @@ addAllTypesFromDWP(MCStreamer &Out,
continue;
auto &C =
Entry.Contributions[getContributionIndex(Kind, TUIndex.getVersion())];
C.setOffset(C.getOffset() + I->getOffset());
C.setLength(I->getLength());
C.Offset += I->Offset;
C.Length = I->Length;
++I;
}
auto &C = Entry.Contributions[TypesContributionIndex];
Out.emitBytes(Types.substr(
C.getOffset() -
TUEntry.Contributions[TypesContributionIndex].getOffset(),
C.getLength()));
C.setOffset(TypesOffset);
TypesOffset += C.getLength();
C.Offset - TUEntry.Contributions[TypesContributionIndex].Offset,
C.Length));
C.Offset = TypesOffset;
TypesOffset += C.Length;
}
}

Expand All @@ -227,23 +226,23 @@ static void addAllTypesFromTypesSection(
// Zero out the debug_info contribution
Entry.Contributions[0] = {};
auto &C = Entry.Contributions[getContributionIndex(DW_SECT_EXT_TYPES, 2)];
C.setOffset(TypesOffset);
C.Offset = TypesOffset;
auto PrevOffset = Offset;
// Length of the unit, including the 4 byte length field.
C.setLength(Data.getU32(&Offset) + 4);
C.Length = 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.getLength32();
Offset = PrevOffset + C.Length;

auto P = TypeIndexEntries.insert(std::make_pair(Signature, Entry));
if (!P.second)
continue;

Out.emitBytes(Types.substr(PrevOffset, C.getLength32()));
TypesOffset += C.getLength32();
Out.emitBytes(Types.substr(PrevOffset, C.Length));
TypesOffset += C.Length;
}
}
}
Expand Down Expand Up @@ -403,13 +402,14 @@ void writeStringsAndOffsets(MCStreamer &Out, DWPStringPool &Strings,
}
}

void writeIndexTable(MCStreamer &Out, ArrayRef<unsigned> ContributionOffsets,
const MapVector<uint64_t, UnitIndexEntry> &IndexEntries,
unsigned Index) {
void writeIndexTable(
MCStreamer &Out, ArrayRef<unsigned> ContributionOffsets,
const MapVector<uint64_t, UnitIndexEntry> &IndexEntries,
uint32_t DWARFUnitIndex::Entry::SectionContribution::*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].getField32(Index)), 4);
Out.emitIntValue(E.second.Contributions[I].*Field, 4);
}

void writeIndex(MCStreamer &Out, MCSection *Section,
Expand Down Expand Up @@ -461,11 +461,11 @@ void writeIndex(MCStreamer &Out, MCSection *Section,

// Write the offsets.
writeIndexTable(Out, ContributionOffsets, IndexEntries,
DWARFUnitIndex::Entry::SectionContribution::OffsetFieldIndex);
&DWARFUnitIndex::Entry::SectionContribution::Offset);

// Write the lengths.
writeIndexTable(Out, ContributionOffsets, IndexEntries,
DWARFUnitIndex::Entry::SectionContribution::LengthFieldIndex);
&DWARFUnitIndex::Entry::SectionContribution::Length);
}

Error buildDuplicateError(const std::pair<uint64_t, UnitIndexEntry> &PrevE,
Expand Down Expand Up @@ -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].setOffset(ContributionOffsets[Index]);
CurEntry.Contributions[Index].setLength(Pair.second);
ContributionOffsets[Index] += CurEntry.Contributions[Index].getLength32();
CurEntry.Contributions[Index].Offset = ContributionOffsets[Index];
ContributionOffsets[Index] +=
(CurEntry.Contributions[Index].Length = Pair.second);
}

uint32_t &InfoSectionOffset =
Expand All @@ -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.setOffset(InfoSectionOffset);
C.setLength(Header.Length + 4);
C.Offset = InfoSectionOffset;
C.Length = Header.Length + 4;

if (std::numeric_limits<uint32_t>::max() - InfoSectionOffset <
C.getLength32())
C.Length)
return make_error<DWPError>(
"debug information section offset is greater than 4GB");

UnitOffset += C.getLength32();
UnitOffset += C.Length;
if (Header.Version < 5 ||
Header.UnitType == dwarf::DW_UT_split_compile) {
Expected<CompileUnitIdentifiers> EID = getCUIdentifiers(
Header, AbbrevSection,
Info.substr(UnitOffset - C.getLength32(), C.getLength32()),
CurStrOffsetSection, CurStrSection);
Expected<CompileUnitIdentifiers> EID =
getCUIdentifiers(Header, AbbrevSection,
Info.substr(UnitOffset - C.Length, C.Length),
CurStrOffsetSection, CurStrSection);

if (!EID)
return createFileError(Input, EID.takeError());
Expand All @@ -696,9 +696,8 @@ Error write(MCStreamer &Out, ArrayRef<std::string> Inputs) {
if (!P.second)
continue;
}
Out.emitBytes(
Info.substr(UnitOffset - C.getLength32(), C.getLength32()));
InfoSectionOffset += C.getLength32();
Out.emitBytes(Info.substr(UnitOffset - C.Length, C.Length));
InfoSectionOffset += C.Length;
}
}

Expand Down Expand Up @@ -761,15 +760,15 @@ Error write(MCStreamer &Out, ArrayRef<std::string> Inputs) {
continue;
auto &C =
NewEntry.Contributions[getContributionIndex(Kind, IndexVersion)];
C.setOffset(C.getOffset() + I->getOffset());
C.setLength(I->getLength());
C.Offset += I->Offset;
C.Length = I->Length;
++I;
}
unsigned Index = getContributionIndex(DW_SECT_INFO, IndexVersion);
auto &C = NewEntry.Contributions[Index];
Out.emitBytes(CUInfoSection);
C.setOffset(InfoSectionOffset);
InfoSectionOffset += C.getLength32();
C.Offset = InfoSectionOffset;
InfoSectionOffset += C.Length;
}

if (!CurTUIndexSection.empty()) {
Expand Down
75 changes: 2 additions & 73 deletions llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -782,82 +782,14 @@ bool DWARFContext::verify(raw_ostream &OS, DIDumpOptions DumpOpts) {
return Success;
}

void fixupIndex(const DWARFObject &DObj, DWARFContext &C,
DWARFUnitIndex &Index) {
using EntryType = DWARFUnitIndex::Entry::SectionContribution;
using EntryMap = DenseMap<uint32_t, EntryType>;
EntryMap Map;
if (DObj.getCUIndexSection().empty())
return;

uint64_t Offset = 0;
uint32_t TruncOffset = 0;
DObj.forEachInfoDWOSections([&](const DWARFSection &S) {
if (!(C.getParseCUTUIndexManually() ||
S.Data.size() >= std::numeric_limits<uint32_t>::max()))
return;

DWARFDataExtractor Data(DObj, S, C.isLittleEndian(), 0);
while (Data.isValidOffset(Offset)) {
DWARFUnitHeader Header;
if (!Header.extract(C, Data, &Offset, DWARFSectionKind::DW_SECT_INFO)) {
logAllUnhandledErrors(
createError("Failed to parse CU header in DWP file"), errs());
Map.clear();
break;
}

auto Iter = Map.insert({TruncOffset,
{Header.getOffset(), Header.getNextUnitOffset() -
Header.getOffset()}});
if (!Iter.second) {
logAllUnhandledErrors(
createError("Collision occured between for truncated offset 0x" +
Twine::utohexstr(TruncOffset)),
errs());
Map.clear();
return;
}

Offset = Header.getNextUnitOffset();
TruncOffset = Offset;
}
});

if (Map.empty())
return;

for (DWARFUnitIndex::Entry &E : Index.getMutableRows()) {
if (!E.isValid())
continue;
DWARFUnitIndex::Entry::SectionContribution &CUOff = E.getContribution();
auto Iter = Map.find(CUOff.getOffset());
if (Iter == Map.end()) {
logAllUnhandledErrors(createError("Could not find CU offset 0x" +
Twine::utohexstr(CUOff.getOffset()) +
" in the Map"),
errs());
break;
}
CUOff.setOffset(Iter->second.getOffset());
if (CUOff.getOffset() != Iter->second.getOffset())
logAllUnhandledErrors(createError("Length of CU in CU index doesn't "
"match calculated length at offset 0x" +
Twine::utohexstr(CUOff.getOffset())),
errs());
}

return;
}

const DWARFUnitIndex &DWARFContext::getCUIndex() {
if (CUIndex)
return *CUIndex;

DataExtractor CUIndexData(DObj->getCUIndexSection(), isLittleEndian(), 0);

CUIndex = std::make_unique<DWARFUnitIndex>(DW_SECT_INFO);
CUIndex->parse(CUIndexData);
fixupIndex(*DObj, *this, *CUIndex.get());
return *CUIndex;
}

Expand All @@ -866,12 +798,9 @@ const DWARFUnitIndex &DWARFContext::getTUIndex() {
return *TUIndex;

DataExtractor TUIndexData(DObj->getTUIndexSection(), isLittleEndian(), 0);

TUIndex = std::make_unique<DWARFUnitIndex>(DW_SECT_EXT_TYPES);
TUIndex->parse(TUIndexData);
// If we are parsing TU-index and for .debug_types section we don't need
// to do anything.
if (TUIndex->getVersion() != 2)
fixupIndex(*DObj, *this, *TUIndex.get());
return *TUIndex;
}

Expand Down
16 changes: 8 additions & 8 deletions llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ DWARFUnitVector::getUnitForIndexEntry(const DWARFUnitIndex::Entry &E) {
if (!CUOff)
return nullptr;

uint64_t Offset = CUOff->getOffset();
auto Offset = CUOff->Offset;
auto end = begin() + getNumInfoUnits();

auto *CU =
std::upper_bound(begin(), end, CUOff->getOffset(),
std::upper_bound(begin(), end, CUOff->Offset,
[](uint64_t LHS, const std::unique_ptr<DWARFUnit> &RHS) {
return LHS < RHS->getNextUnitOffset();
});
Expand Down Expand Up @@ -353,12 +353,12 @@ bool DWARFUnitHeader::applyIndexEntry(const DWARFUnitIndex::Entry *Entry) {
return false;
auto *UnitContrib = IndexEntry->getContribution();
if (!UnitContrib ||
UnitContrib->getLength() != (getLength() + getUnitLengthFieldByteSize()))
UnitContrib->Length != (getLength() + getUnitLengthFieldByteSize()))
return false;
auto *AbbrEntry = IndexEntry->getContribution(DW_SECT_ABBREV);
if (!AbbrEntry)
return false;
AbbrOffset = AbbrEntry->getOffset();
AbbrOffset = AbbrEntry->Offset;
return true;
}

Expand Down Expand Up @@ -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->getOffset();
ContributionBaseOffset = Contrib->Offset;
setRangesSection(
&Context.getDWARFObj().getRnglistsDWOSection(),
ContributionBaseOffset +
Expand All @@ -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->getOffset(), C->getLength());
Data = Data.substr(C->Offset, C->Length);

DWARFDataExtractor DWARFData(Data, IsLittleEndian, getAddressByteSize());
LocTable =
Expand Down Expand Up @@ -1156,7 +1156,7 @@ DWARFUnit::determineStringOffsetsTableContributionDWO(DWARFDataExtractor &DA) {
const auto *C =
IndexEntry ? IndexEntry->getContribution(DW_SECT_STR_OFFSETS) : nullptr;
if (C)
Offset = C->getOffset();
Offset = C->Offset;
if (getVersion() >= 5) {
if (DA.getData().data() == nullptr)
return std::nullopt;
Expand All @@ -1172,7 +1172,7 @@ DWARFUnit::determineStringOffsetsTableContributionDWO(DWARFDataExtractor &DA) {
// the length of the string offsets section.
StrOffsetsContributionDescriptor Desc;
if (C)
Desc = StrOffsetsContributionDescriptor(C->getOffset(), C->getLength(), 4,
Desc = StrOffsetsContributionDescriptor(C->Offset, C->Length, 4,
Header.getFormat());
else if (!IndexEntry && !StringOffsetSection.Data.empty())
Desc = StrOffsetsContributionDescriptor(0, StringOffsetSection.Data.size(),
Expand Down
45 changes: 12 additions & 33 deletions llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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].setOffset(IndexData.getU32(&Offset));
Contrib[i].Offset = 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].setLength(IndexData.getU32(&Offset));
Contrib[i].Length = IndexData.getU32(&Offset);
}

return true;
Expand Down Expand Up @@ -222,38 +222,22 @@ void DWARFUnitIndex::dump(raw_ostream &OS) const {
DWARFSectionKind Kind = ColumnKinds[i];
StringRef Name = getColumnHeader(Kind);
if (!Name.empty())
OS << ' '
<< left_justify(Name,
Kind == DWARFSectionKind::DW_SECT_INFO ? 40 : 24);
OS << ' ' << left_justify(Name, 24);
else
OS << format(" Unknown: %-15" PRIu32, RawSectionIds[i]);
}
OS << "\n----- ------------------";
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 << " ------------------------";
}
for (unsigned i = 0; i != Header.NumColumns; ++i)
OS << " ------------------------";
OS << '\n';
for (unsigned i = 0; i != Header.NumBuckets; ++i) {
auto &Row = Rows[i];
if (auto *Contribs = Row.Contributions.get()) {
OS << format("%5u 0x%016" PRIx64 " ", i + 1, Row.Signature);
for (unsigned i = 0; i != Header.NumColumns; ++i) {
auto &Contrib = Contribs[i];
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 << format("[0x%08x, 0x%08x) ", Contrib.Offset,
Contrib.Offset + Contrib.Length);
}
OS << '\n';
}
Expand All @@ -269,36 +253,31 @@ DWARFUnitIndex::Entry::getContribution(DWARFSectionKind Sec) const {
return nullptr;
}

DWARFUnitIndex::Entry::SectionContribution &
DWARFUnitIndex::Entry::getContribution() {
return Contributions[Index->InfoColumn];
}

const DWARFUnitIndex::Entry::SectionContribution *
DWARFUnitIndex::Entry::getContribution() const {
return &Contributions[Index->InfoColumn];
}

const DWARFUnitIndex::Entry *
DWARFUnitIndex::getFromOffset(uint64_t Offset) const {
DWARFUnitIndex::getFromOffset(uint32_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].getOffset() <
E2->Contributions[InfoColumn].getOffset();
return E1->Contributions[InfoColumn].Offset <
E2->Contributions[InfoColumn].Offset;
});
}
auto I = partition_point(OffsetLookup, [&](Entry *E2) {
return E2->Contributions[InfoColumn].getOffset() <= Offset;
return E2->Contributions[InfoColumn].Offset <= Offset;
});
if (I == OffsetLookup.begin())
return nullptr;
--I;
const auto *E = *I;
const auto &InfoContrib = E->Contributions[InfoColumn];
if ((InfoContrib.getOffset() + InfoContrib.getLength()) <= Offset)
if ((InfoContrib.Offset + InfoContrib.Length) <= Offset)
return nullptr;
return E;
}
Expand Down
10 changes: 5 additions & 5 deletions llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ unsigned DWARFVerifier::verifyIndex(StringRef Name,
DataExtractor D(IndexStr, DCtx.isLittleEndian(), 0);
if (!Index.parse(D))
return 1;
using MapType = IntervalMap<uint64_t, uint64_t>;
using MapType = IntervalMap<uint32_t, uint64_t>;
MapType::Allocator Alloc;
std::vector<std::unique_ptr<MapType>> Sections(Index.getColumnKinds().size());
for (const DWARFUnitIndex::Entry &E : Index.getRows()) {
Expand All @@ -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.getLength() == 0)
if (SC.Length == 0)
continue;
if (!Sections[Col])
Sections[Col] = std::make_unique<MapType>(Alloc);
auto &M = *Sections[Col];
auto I = M.find(SC.getOffset());
if (I != M.end() && I.start() < (SC.getOffset() + SC.getLength())) {
auto I = M.find(SC.Offset);
if (I != M.end() && I.start() < (SC.Offset + SC.Length)) {
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.getOffset(), SC.getOffset() + SC.getLength() - 1, Sig);
M.insert(SC.Offset, SC.Offset + SC.Length - 1, Sig);
}
}

Expand Down
4 changes: 2 additions & 2 deletions llvm/test/DebugInfo/X86/debug-cu-index-unknown-section.s
Original file line number Diff line number Diff line change
Expand Up @@ -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) [0x0000000000002000, 0x0000000000002020)
# CHECK-NEXT: ----- ------------------ ------------------------ ------------------------
# CHECK-NEXT: 1 0x1100001122222222 [0x00001000, 0x00001010) [0x00002000, 0x00002020)

.section .debug_cu_index, "", @progbits
## Header:
Expand Down
6 changes: 3 additions & 3 deletions llvm/test/DebugInfo/X86/dwp-v2-cu-index.s
Original file line number Diff line number Diff line change
Expand Up @@ -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 [0x0000000000001000, 0x0000000000001010) [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 [0x00001000, 0x00001010) [0x00002000, 0x00002020) [0x00003000, 0x00003030) [0x00004000, 0x00004040) [0x00005000, 0x00005050) [0x00006000, 0x00006060) [0x00007000, 0x00007070)

.section .debug_cu_index, "", @progbits
## Header:
Expand Down
6 changes: 3 additions & 3 deletions llvm/test/DebugInfo/X86/dwp-v2-tu-index.s
Original file line number Diff line number Diff line change
Expand Up @@ -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 [0x0000000000001000, 0x0000000000001010) [0x00002000, 0x00002020) [0x00003000, 0x00003030) [0x00004000, 0x00004040)
# CHECK-NEXT: Index Signature TYPES ABBREV LINE STR_OFFSETS
# CHECK-NEXT: ----- ------------------ ------------------------ ------------------------ ------------------------ ------------------------
# CHECK-NEXT: 1 0x1100001122222222 [0x00001000, 0x00001010) [0x00002000, 0x00002020) [0x00003000, 0x00003030) [0x00004000, 0x00004040)

.section .debug_tu_index, "", @progbits
## Header:
Expand Down
6 changes: 3 additions & 3 deletions llvm/test/DebugInfo/X86/dwp-v5-cu-index.s
Original file line number Diff line number Diff line change
Expand Up @@ -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 [0x0000000000001000, 0x0000000000001010) [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 [0x00001000, 0x00001010) [0x00002000, 0x00002020) [0x00003000, 0x00003030) [0x00004000, 0x00004040) [0x00005000, 0x00005050) [0x00006000, 0x00006060) [0x00007000, 0x00007070)

.section .debug_cu_index, "", @progbits
## Header:
Expand Down
6 changes: 3 additions & 3 deletions llvm/test/DebugInfo/X86/dwp-v5-tu-index.s
Original file line number Diff line number Diff line change
Expand Up @@ -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 [0x0000000000001000, 0x0000000000001010) [0x00002000, 0x00002020) [0x00003000, 0x00003030) [0x00004000, 0x00004040)
# CHECK-NEXT: Index Signature INFO ABBREV LINE STR_OFFSETS
# CHECK-NEXT: ----- ------------------ ------------------------ ------------------------ ------------------------ ------------------------
# CHECK-NEXT: 1 0x1100001122222222 [0x00001000, 0x00001010) [0x00002000, 0x00002020) [0x00003000, 0x00003030) [0x00004000, 0x00004040)

.section .debug_tu_index, "", @progbits
## Header:
Expand Down
16 changes: 8 additions & 8 deletions llvm/test/DebugInfo/dwarfdump-dwp.test
Original file line number Diff line number Diff line change
Expand Up @@ -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 [0x000000000000002d, 0x000000000000005f) [0x00000043, 0x0000008e) [0x0000001a, 0x00000034) [0x00000010, 0x00000024)
; CHECK-NEXT: 9 0x03c30756e2d45008 [0x0000000000000000, 0x000000000000002d) [0x00000000, 0x00000043) [0x00000000, 0x0000001a) [0x00000000, 0x00000010)
; 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: .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 [0x0000000000000024, 0x0000000000000048) [0x00000043, 0x0000008e) [0x0000001a, 0x00000034) [0x00000010, 0x00000024)
; CHECK-NEXT: 13 0x3875c0e21cda63fc [0x0000000000000000, 0x0000000000000024) [0x00000000, 0x00000043) [0x00000000, 0x0000001a) [0x00000000, 0x00000010)
; 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)

; 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
92 changes: 0 additions & 92 deletions llvm/test/tools/llvm-dwp/X86/cu_tu_units_manual_v5.s

This file was deleted.

10 changes: 3 additions & 7 deletions llvm/test/tools/llvm-dwp/X86/debug_macro_v5.s
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

# RUN: llvm-mc -triple x86_64-unknown-linux --filetype=obj --split-dwarf-file=%t.dwo -dwarf-version=5 %s -o %t.o
# RUN: llvm-dwp %t.dwo -o %t.dwp 2>&1
# RUN: llvm-dwarfdump -debug-macro -debug-cu-index %t.dwp | FileCheck -check-prefix=CHECK %s
# RUN: llvm-dwarfdump -debug-macro -debug-cu-index -manaully-generate-unit-index %t.dwp | FileCheck -check-prefix=CHECK2 %s
# RUN: llvm-dwarfdump -debug-macro -debug-cu-index %t.dwp | FileCheck %s

# CHECK-DAG: .debug_macro.dwo contents:
# CHECK: macro header: version = 0x0005, flags = 0x00, format = DWARF32
Expand All @@ -13,11 +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 [0x0000000000000000, 0x0000000000000019) [0x00000000, 0x00000008) [0x00000000, 0x0000000c) [0x00000000, 0x0000000b)

# CHECK2: Index Signature INFO ABBREV STR_OFFSETS MACRO
# CHECK2: 1 0x0000000000000000 [0x0000000000000000, 0x0000000000000019) [0x00000000, 0x00000008) [0x00000000, 0x0000000c) [0x00000000, 0x0000000b)
# CHECK: Index Signature INFO ABBREV STR_OFFSETS MACRO
# CHECK: 1 0x0000000000000000 [0x00000000, 0x00000019) [0x00000000, 0x00000008) [0x00000000, 0x0000000c) [0x00000000, 0x0000000b)

.section .debug_info.dwo,"e",@progbits
.long .Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit
Expand Down
4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-dwp/X86/info-v5.s
Original file line number Diff line number Diff line change
Expand Up @@ -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]] [0x0000000000000000, 0x0000000000000054) [0x00000000, 0x0000002a)
# CHECK: Index Signature INFO ABBREV
# CHECK: 1 [[DWOID]] [0x00000000, 0x00000054) [0x00000000, 0x0000002a)

.section .debug_info.dwo,"e",@progbits
.long .Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/tools/llvm-dwp/X86/loclists.s
Original file line number Diff line number Diff line change
Expand Up @@ -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 {{.*}} [0x0000000000000018, 0x000000000000002d) [0x00000000, 0x00000004) [0x00000000, 0x0000001d)
# CHECK: Index Signature INFO ABBREV LOCLISTS
# CHECK: 1 {{.*}} [0x00000018, 0x0000002d) [0x00000000, 0x00000004) [0x00000000, 0x0000001d)

# CHECK-DAG: .debug_tu_index contents:
# CHECK: Index Signature INFO ABBREV LOCLISTS
# CHECK: 2 {{.*}} [0x0000000000000000, 0x0000000000000018) [0x00000000, 0x00000004) [0x00000000, 0x0000001d)
# CHECK: Index Signature INFO ABBREV LOCLISTS
# CHECK: 2 {{.*}} [0x00000000, 0x00000018) [0x00000000, 0x00000004) [0x00000000, 0x0000001d)

.section .debug_info.dwo,"e",@progbits
.long .Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit
Expand Down
20 changes: 10 additions & 10 deletions llvm/test/tools/llvm-dwp/X86/merge.test
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@ CHECK-LABEL: Abbrev table for offset:
CHECK: 0x0000[[BAOFF:.*]]

CHECK: .debug_info.dwo contents:
CHECK: 0x[[#%.8x,COFF:]]:
CHECK: [[COFF:0x[0-9a-f]*]]:
CHECK-LABEL: Compile Unit: length = {{.*}}, version = 0x0004, abbr_offset =
CHECK: 0x[[CAOFF]], addr_size = 0x08 (next unit at 0x[[#%.8x,AOFF:]])
CHECK: 0x[[CAOFF]], addr_size = 0x08 (next unit at [[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 0x[[#%.8x,BOFF:]])
CHECK: 0x[[AAOFF]], addr_size = 0x08 (next unit at [[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 0x[[#%.8x,XOFF:]])
CHECK: 0x[[BAOFF]], addr_size = 0x08 (next unit at [[XOFF:.*]])
CHECK: DW_AT_GNU_dwo_id {{.*}} ([[DWOB:.*]])

CHECK-LABEL: .debug_cu_index
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)
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)
8 changes: 4 additions & 4 deletions llvm/test/tools/llvm-dwp/X86/rnglists.s
Original file line number Diff line number Diff line change
Expand Up @@ -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 {{.*}} [0x0000000000000018, 0x000000000000002d) [0x00000000, 0x00000004) [0x00000000, 0x00000017)
# CHECK: Index Signature INFO ABBREV RNGLISTS
# CHECK: 1 {{.*}} [0x00000018, 0x0000002d) [0x00000000, 0x00000004) [0x00000000, 0x00000017)

# CHECK-DAG: .debug_tu_index contents:
# CHECK: Index Signature INFO ABBREV RNGLISTS
# CHECK: 2 {{.*}} [0x0000000000000000, 0x0000000000000018) [0x00000000, 0x00000004) [0x00000000, 0x00000017)
# CHECK: Index Signature INFO ABBREV RNGLISTS
# CHECK: 2 {{.*}} [0x00000000, 0x00000018) [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
Expand Down
32 changes: 16 additions & 16 deletions llvm/test/tools/llvm-dwp/X86/simple.test
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ CHECK: DW_TAG_subprogram
CHECK: DW_TAG_formal_parameter

CHECK: .debug_info.dwo contents:
CHECK: 0x[[#%.8x,AOFF:]]:
CHECK: [[AOFF:0x[0-9a-f]*]]:
CHECK-LABEL: Compile Unit: length = {{.*}}, version = 0x0004, abbr_offset =
CHECK: 0x[[AAOFF]], addr_size = 0x08 (next unit at 0x[[#%.8x,BOFF:]])
CHECK: 0x[[AAOFF]], addr_size = 0x08 (next unit at [[BOFF:.*]])
CHECK: DW_TAG_compile_unit
CHECK: DW_AT_name {{.*}} "a.cpp"
CHECK: DW_AT_GNU_dwo_id {{.*}} ([[DWOA:.*]])
Expand All @@ -40,9 +40,9 @@ CHECK: DW_TAG_structure_type
NOTYP: DW_AT_name {{.*}} "foo"
TYPES: DW_AT_signature {{.*}} ([[FOOSIG:.*]])

CHECK: 0x[[#BOFF]]:
CHECK: [[BOFF]]:
CHECK-LABEL: Compile Unit: length = {{.*}}, version = 0x0004, abbr_offset =
CHECK: 0x[[BAOFF]], addr_size = 0x08 (next unit at 0x[[#%.8x,XOFF:]])
CHECK: 0x[[BAOFF]], addr_size = 0x08 (next unit at [[XOFF:.*]])
CHECK: DW_AT_name {{.*}} "b.cpp"
CHECK: DW_AT_GNU_dwo_id {{.*}} ([[DWOB:.*]])
CHECK: DW_TAG_structure_type
Expand All @@ -54,32 +54,32 @@ CHECK: DW_TAG_formal_parameter

NOTYP-NOT: .debug_types.dwo contents:
TYPES-LABEL: .debug_types.dwo contents:
TYPES: 0x[[#%.8x,FOOUOFF:]]:
TYPES: [[FOOUOFF:0x[0-9a-f]*]]:
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 0x[[#%.8x,BARUOFF:]])
TYPES: 0x[[AAOFF]], addr_size = 0x08, name = 'foo', type_signature = [[FOOSIG]], type_offset = 0x[[FOOOFF:.*]] (next unit at [[BARUOFF:.*]])
TYPES: DW_TAG_type_unit
TYPES: [[FOOOFF]]: DW_TAG_structure_type
TYPES: DW_AT_name {{.*}} "foo"
TYPES: 0x[[#BARUOFF]]:
TYPES: [[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 0x[[#%.8x,XUOFF:]])
TYPES: 0x[[BAOFF]], addr_size = 0x08, name = 'bar', type_signature = [[BARSIG]], type_offset = 0x001e (next unit at [[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]] [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)
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)

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]] [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)
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)

CHECK-LABEL: .debug_str.dwo contents:
CHECK: "clang version
Expand Down
6 changes: 3 additions & 3 deletions llvm/test/tools/llvm-dwp/X86/tu_units_v5.s
Original file line number Diff line number Diff line change
Expand Up @@ -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]] [0x0000000000000000, 0x000000000000001b) [0x00000000, 0x00000010)
# CHECK: 4 [[TUID2]] [0x000000000000001b, 0x0000000000000036) [0x00000000, 0x00000010)
# CHECK: Index Signature INFO ABBREV
# CHECK: 1 [[TUID1]] [0x00000000, 0x0000001b) [0x00000000, 0x00000010)
# CHECK: 4 [[TUID2]] [0x0000001b, 0x00000036) [0x00000000, 0x00000010)

.section .debug_info.dwo,"e",@progbits
.long .Ldebug_info_dwo_end0-.Ldebug_info_dwo_start0 # Length of Unit
Expand Down
27 changes: 2 additions & 25 deletions llvm/test/tools/llvm-dwp/X86/type_dedup.test
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
RUN: llvm-dwp %p/../Inputs/type_dedup/a.dwo %p/../Inputs/type_dedup/b.dwo -o %t
RUN: llvm-dwarfdump -v %t | FileCheck -check-prefix=CHECK %s
RUN: llvm-dwarfdump -v -manaully-generate-unit-index %t | FileCheck -check-prefix=CHECK2 %s
RUN: llvm-dwarfdump -v %t | FileCheck %s
RUN: llvm-dwp %p/../Inputs/type_dedup/b.dwo -o %tb.dwp
RUN: llvm-dwp %p/../Inputs/type_dedup/a.dwo %tb.dwp -o %t
RUN: llvm-dwarfdump -v %t | FileCheck -check-prefix=CHECK %s
RUN: llvm-dwarfdump -v -manaully-generate-unit-index %t | FileCheck -check-prefix=CHECK2 %s
RUN: llvm-dwarfdump -v %t | FileCheck %s

a.cpp:
struct common { };
Expand Down Expand Up @@ -38,24 +36,3 @@ CHECK: DW_TAG_type_unit
CHECK: 0x00000066: DW_TAG_structure_type
CHECK: DW_AT_name {{.*}} "bdistinct"
CHECK-NOT: Type Unit

CHECK2-LABEL: .debug_types.dwo contents:
CHECK2: [[COMMONUOFF:0x[0-9a-f]*]]:
CHECK2-LABEL: Type Unit: length = 0x00000020, format = DWARF32, version = 0x0004, abbr_offset =
CHECK2: 0x0000, addr_size = 0x08, name = 'common', type_signature = [[COMMONSIG:0x[0-9a-f]*]], type_offset = 0x[[COMMONOFF:.*]] (next unit at [[AUOFF:.*]])
CHECK2: DW_TAG_type_unit
CHECK2: [[COMMONOFF]]: DW_TAG_structure_type
CHECK2: DW_AT_name {{.*}} "common"
CHECK2: [[AUOFF]]:
CHECK2-LABEL: Type Unit: length = 0x00000020, format = DWARF32, version = 0x0004, abbr_offset =
CHECK2: 0x0000, addr_size = 0x08, name = 'adistinct', type_signature = [[ASIG:0x[0-9a-f]*]], type_offset = 0x[[AOFF:.*]] (next unit at [[BUOFF:.*]])
CHECK2: DW_TAG_type_unit
CHECK2: 0x00000042: DW_TAG_structure_type
CHECK2: DW_AT_name {{.*}} "adistinct"
CHECK2: [[BUOFF]]:
CHECK2-LABEL: Type Unit: length = 0x00000020, format = DWARF32, version = 0x0004, abbr_offset =
CHECK2: 0x{{.*}}, addr_size = 0x08, name = 'bdistinct', type_signature = [[BSIG:0x[0-9a-f]*]], type_offset = 0x[[BOFF:.*]] (next unit at [[XUOFF:.*]])
CHECK2: DW_TAG_type_unit
CHECK2: 0x00000066: DW_TAG_structure_type
CHECK2: DW_AT_name {{.*}} "bdistinct"
CHECK2-NOT: Type Unit
4 changes: 2 additions & 2 deletions llvm/test/tools/llvm-dwp/X86/unknown-section-id.s
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
# CHECK: Index Signature INFO ABBREV
# CHECK-NOT: Unknown
# CHECK: -----
# CHECK-NEXT: 1 0x1100002222222222 [0x0000000000000000, 0x0000000000000014) [0x00000000, 0x00000009)
# CHECK-NEXT: 1 0x1100002222222222 [0x00000000, 0x00000014) [0x00000000, 0x00000009)
# CHECK-NOT: [

# CHECK: .debug_tu_index contents:
# CHECK-NEXT: version = 2, units = 1, slots = 2
# CHECK: Index Signature TYPES ABBREV
# CHECK-NOT: Unknown
# CHECK: -----
# CHECK-NEXT: 2 0x1100003333333333 [0x0000000000000000, 0x0000000000000019) [0x00000009, 0x00000014)
# CHECK-NEXT: 2 0x1100003333333333 [0x00000000, 0x00000019) [0x00000009, 0x00000014)
# CHECK-NOT: [

.section .debug_abbrev.dwo, "e", @progbits
Expand Down
8 changes: 0 additions & 8 deletions llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,6 @@ static cl::opt<bool>
cl::desc("Show the sizes of all debug sections, "
"expressed in bytes."),
cat(DwarfDumpCategory));
static cl::opt<bool> ManuallyGenerateUnitIndex(
"manaully-generate-unit-index",
cl::desc("if the input is dwp file, parse .debug_info "
"section and use it to populate "
"DW_SECT_INFO contributions in cu-index. "
"For DWARF5 it also populated TU Index."),
cl::init(false), cl::Hidden, cl::cat(DwarfDumpCategory));
static cl::opt<bool>
ShowSources("show-sources",
cl::desc("Show the sources across all compilation units."),
Expand Down Expand Up @@ -642,7 +635,6 @@ static bool handleBuffer(StringRef Filename, MemoryBufferRef Buffer,
std::unique_ptr<DWARFContext> DICtx = DWARFContext::create(
*Obj, DWARFContext::ProcessDebugRelocations::Process, nullptr, "",
RecoverableErrorHandler);
DICtx->setParseCUTUIndexManually(ManuallyGenerateUnitIndex);
if (!HandleObj(*Obj, *DICtx, Filename, OS))
Result = false;
}
Expand Down