1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00

[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
This commit is contained in:
Igor Kudrin 2020-03-20 17:28:59 +07:00
parent ac084dff67
commit 124fb70313
6 changed files with 26 additions and 22 deletions

View File

@ -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,
};

View File

@ -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);
});
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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;
}

View File

@ -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;