[Lldb-commits] [lldb] a0249fe - [DebugInfo] Rename section identifiers which are deprecated in DWARFv5. NFC.
Igor Kudrin via lldb-commits
lldb-commits at lists.llvm.org
Mon Apr 6 00:04:36 PDT 2020
Author: Igor Kudrin
Date: 2020-04-06T13:28:06+07:00
New Revision: a0249fe91c7ba0dabf0e8789171fb4aea5fca1cb
URL: https://github.com/llvm/llvm-project/commit/a0249fe91c7ba0dabf0e8789171fb4aea5fca1cb
DIFF: https://github.com/llvm/llvm-project/commit/a0249fe91c7ba0dabf0e8789171fb4aea5fca1cb.diff
LOG: [DebugInfo] Rename section identifiers which are deprecated in DWARFv5. NFC.
This is a preparation for an upcoming patch which adds support for
DWARFv5 unit index sections. The patch adds tag "_EXT_" to identifiers
which reference sections that are deprecated in the DWARFv5 standard.
See D75929 for the discussion.
Differential Revision: https://reviews.llvm.org/D77141
Added:
Modified:
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h
llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
llvm/tools/llvm-dwp/llvm-dwp.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
index 941a547ddbf9..874978bf1398 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
@@ -76,7 +76,7 @@ void DWARFDebugInfo::ParseUnitsFor(DIERef::Section section) {
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
index 8447d4fcea4c..b8d16758246f 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -480,7 +480,7 @@ DWARFDataExtractor DWARFUnit::GetLocationData() const {
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
index d6b5e72cf16c..018962c0bd50 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h
@@ -21,12 +21,12 @@ class raw_ostream;
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
index 2150df411f42..bdd2a7240df6 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -763,7 +763,7 @@ const DWARFUnitIndex &DWARFContext::getTUIndex() {
DataExtractor TUIndexData(DObj->getTUIndexSection(), isLittleEndian(), 0);
- TUIndex = std::make_unique<DWARFUnitIndex>(DW_SECT_TYPES);
+ TUIndex = std::make_unique<DWARFUnitIndex>(DW_SECT_EXT_TYPES);
TUIndex->parse(TUIndexData);
return *TUIndex;
}
@@ -959,7 +959,7 @@ void DWARFContext::parseNormalUnits() {
});
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 @@ void DWARFContext::parseDWOUnits(bool Lazy) {
});
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
index 80f09dbd4c18..a42185b8015c 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
@@ -183,7 +183,7 @@ DWARFUnit::DWARFUnit(DWARFContext &DC, const DWARFSection &Section,
// 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 @@ bool DWARFUnitHeader::extract(DWARFContext &Context,
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 @@ const DWARFUnitIndex &llvm::getDWARFUnitIndex(DWARFContext &Context,
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
index bdfdb1889c02..61a8f45bcdbd 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp
@@ -110,13 +110,16 @@ StringRef DWARFUnitIndex::getColumnHeader(DWARFSectionKind DS) {
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
index c96dcebf2494..beca8cc0bc7d 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
@@ -352,7 +352,7 @@ bool DWARFVerifier::handleDebugInfo() {
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
index cd7048bd72f9..571dc6241abf 100644
--- a/llvm/tools/llvm-dwp/llvm-dwp.cpp
+++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp
@@ -259,7 +259,7 @@ static void addAllTypesFromDWP(
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 @@ static void addAllTypes(MCStreamer &Out,
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 @@ static Error handleSection(
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 @@ static Error write(MCStreamer &Out, ArrayRef<std::string> Inputs) {
MCSection *const TUIndexSection = MCOFI.getDwarfTUIndexSection();
const StringMap<std::pair<MCSection *, DWARFSectionKind>> 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<DWARFSectionKind>(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<DWARFSectionKind>(0)}},
@@ -603,7 +603,7 @@ static Error write(MCStreamer &Out, ArrayRef<std::string> Inputs) {
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 @@ static Error write(MCStreamer &Out, ArrayRef<std::string> Inputs) {
if (!CurTypesSection.empty()) {
if (CurTypesSection.size() != 1)
return make_error<DWPError>("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<DWPError>("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 @@ static Error write(MCStreamer &Out, ArrayRef<std::string> Inputs) {
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;
More information about the lldb-commits
mailing list