diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp @@ -76,7 +76,7 @@ if (m_context.isDwo()) index = &llvm::getDWARFUnitIndex(m_context.GetAsLLVM(), section == DIERef::Section::DebugTypes - ? llvm::DW_SECT_TYPES + ? llvm::DW_SECT_EXT_TYPES : llvm::DW_SECT_INFO); lldb::offset_t offset = 0; while (data.ValidOffset(offset)) { diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -480,7 +480,7 @@ const DWARFDataExtractor &data = GetVersion() >= 5 ? Ctx.getOrLoadLocListsData() : Ctx.getOrLoadLocData(); if (const llvm::DWARFUnitIndex::Entry *entry = m_header.GetIndexEntry()) { - if (const auto *contribution = entry->getContribution(llvm::DW_SECT_LOC)) + if (const auto *contribution = entry->getContribution(llvm::DW_SECT_EXT_LOC)) return DWARFDataExtractor(data, contribution->Offset, contribution->Length); return DWARFDataExtractor(); diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h --- a/llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h +++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h @@ -21,12 +21,12 @@ enum DWARFSectionKind { DW_SECT_INFO = 1, - DW_SECT_TYPES, + DW_SECT_EXT_TYPES, DW_SECT_ABBREV, DW_SECT_LINE, - DW_SECT_LOC, + DW_SECT_EXT_LOC, DW_SECT_STR_OFFSETS, - DW_SECT_MACINFO, + DW_SECT_EXT_MACINFO, DW_SECT_MACRO, }; diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp --- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp @@ -763,7 +763,7 @@ DataExtractor TUIndexData(DObj->getTUIndexSection(), isLittleEndian(), 0); - TUIndex = std::make_unique(DW_SECT_TYPES); + TUIndex = std::make_unique(DW_SECT_EXT_TYPES); TUIndex->parse(TUIndexData); return *TUIndex; } @@ -959,7 +959,7 @@ }); NormalUnits.finishedInfoUnits(); DObj->forEachTypesSections([&](const DWARFSection &S) { - NormalUnits.addUnitsForSection(*this, S, DW_SECT_TYPES); + NormalUnits.addUnitsForSection(*this, S, DW_SECT_EXT_TYPES); }); } @@ -971,7 +971,7 @@ }); DWOUnits.finishedInfoUnits(); DObj->forEachTypesDWOSections([&](const DWARFSection &S) { - DWOUnits.addUnitsForDWOSection(*this, S, DW_SECT_TYPES, Lazy); + DWOUnits.addUnitsForDWOSection(*this, S, DW_SECT_EXT_TYPES, Lazy); }); } diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp --- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp @@ -183,7 +183,7 @@ // data based on the index entries. StringRef Data = LocSection->Data; if (auto *IndexEntry = Header.getIndexEntry()) - if (const auto *C = IndexEntry->getContribution(DW_SECT_LOC)) + if (const auto *C = IndexEntry->getContribution(DW_SECT_EXT_LOC)) Data = Data.substr(C->Offset, C->Length); DWARFDataExtractor DWARFData = @@ -276,7 +276,7 @@ FormParams.AddrSize = debug_info.getU8(offset_ptr, &Err); // Fake a unit type based on the section type. This isn't perfect, // but distinguishing compile and type units is generally enough. - if (SectionKind == DW_SECT_TYPES) + if (SectionKind == DW_SECT_EXT_TYPES) UnitType = DW_UT_type; else UnitType = DW_UT_compile; @@ -759,7 +759,7 @@ DWARFSectionKind Kind) { if (Kind == DW_SECT_INFO) return Context.getCUIndex(); - assert(Kind == DW_SECT_TYPES); + assert(Kind == DW_SECT_EXT_TYPES); return Context.getTUIndex(); } diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp --- a/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp @@ -110,13 +110,16 @@ return #DS; switch (DS) { CASE(INFO); - CASE(TYPES); CASE(ABBREV); CASE(LINE); - CASE(LOC); CASE(STR_OFFSETS); - CASE(MACINFO); CASE(MACRO); + case DW_SECT_EXT_TYPES: + return "TYPES"; + case DW_SECT_EXT_LOC: + return "LOC"; + case DW_SECT_EXT_MACINFO: + return "MACINFO"; } return StringRef(); } diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp --- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp @@ -352,7 +352,7 @@ OS << "Verifying .debug_types Unit Header Chain...\n"; DObj.forEachTypesSections([&](const DWARFSection &S) { - NumErrors += verifyUnitSection(S, DW_SECT_TYPES); + NumErrors += verifyUnitSection(S, DW_SECT_EXT_TYPES); }); return NumErrors == 0; } diff --git a/llvm/tools/llvm-dwp/llvm-dwp.cpp b/llvm/tools/llvm-dwp/llvm-dwp.cpp --- a/llvm/tools/llvm-dwp/llvm-dwp.cpp +++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp @@ -259,7 +259,7 @@ C.Length = I->Length; ++I; } - unsigned TypesIndex = getContributionIndex(DW_SECT_TYPES); + unsigned TypesIndex = getContributionIndex(DW_SECT_EXT_TYPES); auto &C = Entry.Contributions[TypesIndex]; Out.emitBytes(Types.substr( C.Offset - TUEntry.Contributions[TypesIndex].Offset, C.Length)); @@ -281,7 +281,7 @@ UnitIndexEntry Entry = CUEntry; // Zero out the debug_info contribution Entry.Contributions[0] = {}; - auto &C = Entry.Contributions[getContributionIndex(DW_SECT_TYPES)]; + auto &C = Entry.Contributions[getContributionIndex(DW_SECT_EXT_TYPES)]; C.Offset = TypesOffset; auto PrevOffset = Offset; // Length of the unit, including the 4 byte length field. @@ -452,7 +452,7 @@ if (DWARFSectionKind Kind = SectionPair->second.second) { auto Index = getContributionIndex(Kind); - if (Kind != DW_SECT_TYPES) { + if (Kind != DW_SECT_EXT_TYPES) { CurEntry.Contributions[Index].Offset = ContributionOffsets[Index]; ContributionOffsets[Index] += (CurEntry.Contributions[Index].Length = Contents.size()); @@ -536,10 +536,10 @@ MCSection *const TUIndexSection = MCOFI.getDwarfTUIndexSection(); const StringMap> KnownSections = { {"debug_info.dwo", {MCOFI.getDwarfInfoDWOSection(), DW_SECT_INFO}}, - {"debug_types.dwo", {MCOFI.getDwarfTypesDWOSection(), DW_SECT_TYPES}}, + {"debug_types.dwo", {MCOFI.getDwarfTypesDWOSection(), DW_SECT_EXT_TYPES}}, {"debug_str_offsets.dwo", {StrOffsetSection, DW_SECT_STR_OFFSETS}}, {"debug_str.dwo", {StrSection, static_cast(0)}}, - {"debug_loc.dwo", {MCOFI.getDwarfLocDWOSection(), DW_SECT_LOC}}, + {"debug_loc.dwo", {MCOFI.getDwarfLocDWOSection(), DW_SECT_EXT_LOC}}, {"debug_line.dwo", {MCOFI.getDwarfLineDWOSection(), DW_SECT_LINE}}, {"debug_abbrev.dwo", {MCOFI.getDwarfAbbrevDWOSection(), DW_SECT_ABBREV}}, {"debug_cu_index", {CUIndexSection, static_cast(0)}}, @@ -603,7 +603,7 @@ P.first->second.DWOName = ID.DWOName; addAllTypes(Out, TypeIndexEntries, TypesSection, CurTypesSection, CurEntry, - ContributionOffsets[getContributionIndex(DW_SECT_TYPES)]); + ContributionOffsets[getContributionIndex(DW_SECT_EXT_TYPES)]); continue; } @@ -642,13 +642,14 @@ if (!CurTypesSection.empty()) { if (CurTypesSection.size() != 1) return make_error("multiple type unit sections in .dwp file"); - DWARFUnitIndex TUIndex(DW_SECT_TYPES); + DWARFUnitIndex TUIndex(DW_SECT_EXT_TYPES); DataExtractor TUIndexData(CurTUIndexSection, Obj.isLittleEndian(), 0); if (!TUIndex.parse(TUIndexData)) return make_error("failed to parse tu_index"); addAllTypesFromDWP( Out, TypeIndexEntries, TUIndex, TypesSection, CurTypesSection.front(), - CurEntry, ContributionOffsets[getContributionIndex(DW_SECT_TYPES)]); + CurEntry, + ContributionOffsets[getContributionIndex(DW_SECT_EXT_TYPES)]); } } @@ -659,7 +660,7 @@ TypeIndexEntries); // Lie about the type contribution - ContributionOffsets[getContributionIndex(DW_SECT_TYPES)] = 0; + ContributionOffsets[getContributionIndex(DW_SECT_EXT_TYPES)] = 0; // Unlie about the info contribution ContributionOffsets[0] = 1;