1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

DebugInfo/DWARF: Normalize DWARFObject members on the DWARF spec section names

Some of these names were abbreviated, some were not, some pluralised,
some not. Made the API difficult to use - since it's an exact 1:1
mapping to the DWARF sections - use those names (changing underscore
separation for camel casing).

llvm-svn: 368189
This commit is contained in:
David Blaikie 2019-08-07 17:18:11 +00:00
parent 76ba8d7866
commit e27c0e3409
9 changed files with 131 additions and 131 deletions

View File

@ -301,10 +301,10 @@ public:
std::function<void(Error)> RecoverableErrorCallback);
DataExtractor getStringExtractor() const {
return DataExtractor(DObj->getStringSection(), false, 0);
return DataExtractor(DObj->getStrSection(), false, 0);
}
DataExtractor getLineStringExtractor() const {
return DataExtractor(DObj->getLineStringSection(), false, 0);
return DataExtractor(DObj->getLineStrSection(), false, 0);
}
/// Wraps the returned DIEs for a given address.

View File

@ -39,20 +39,20 @@ public:
virtual StringRef getAbbrevSection() const { return ""; }
virtual const DWARFSection &getLocSection() const { return Dummy; }
virtual const DWARFSection &getLoclistsSection() const { return Dummy; }
virtual StringRef getARangeSection() const { return ""; }
virtual const DWARFSection &getDebugFrameSection() const { return Dummy; }
virtual StringRef getArangesSection() const { return ""; }
virtual const DWARFSection &getFrameSection() const { return Dummy; }
virtual const DWARFSection &getEHFrameSection() const { return Dummy; }
virtual const DWARFSection &getLineSection() const { return Dummy; }
virtual StringRef getLineStringSection() const { return ""; }
virtual StringRef getStringSection() const { return ""; }
virtual const DWARFSection &getRangeSection() const { return Dummy; }
virtual StringRef getLineStrSection() const { return ""; }
virtual StringRef getStrSection() const { return ""; }
virtual const DWARFSection &getRangesSection() const { return Dummy; }
virtual const DWARFSection &getRnglistsSection() const { return Dummy; }
virtual StringRef getMacinfoSection() const { return ""; }
virtual const DWARFSection &getPubNamesSection() const { return Dummy; }
virtual const DWARFSection &getPubTypesSection() const { return Dummy; }
virtual const DWARFSection &getGnuPubNamesSection() const { return Dummy; }
virtual const DWARFSection &getGnuPubTypesSection() const { return Dummy; }
virtual const DWARFSection &getStringOffsetSection() const { return Dummy; }
virtual const DWARFSection &getPubnamesSection() const { return Dummy; }
virtual const DWARFSection &getPubtypesSection() const { return Dummy; }
virtual const DWARFSection &getGnuPubnamesSection() const { return Dummy; }
virtual const DWARFSection &getGnuPubtypesSection() const { return Dummy; }
virtual const DWARFSection &getStrOffsetsSection() const { return Dummy; }
virtual void
forEachInfoDWOSections(function_ref<void(const DWARFSection &)> F) const {}
virtual void
@ -60,11 +60,11 @@ public:
virtual StringRef getAbbrevDWOSection() const { return ""; }
virtual const DWARFSection &getLineDWOSection() const { return Dummy; }
virtual const DWARFSection &getLocDWOSection() const { return Dummy; }
virtual StringRef getStringDWOSection() const { return ""; }
virtual const DWARFSection &getStringOffsetDWOSection() const {
virtual StringRef getStrDWOSection() const { return ""; }
virtual const DWARFSection &getStrOffsetsDWOSection() const {
return Dummy;
}
virtual const DWARFSection &getRangeDWOSection() const { return Dummy; }
virtual const DWARFSection &getRangesDWOSection() const { return Dummy; }
virtual const DWARFSection &getRnglistsDWOSection() const { return Dummy; }
virtual const DWARFSection &getAddrSection() const { return Dummy; }
virtual const DWARFSection &getAppleNamesSection() const { return Dummy; }
@ -72,7 +72,7 @@ public:
virtual const DWARFSection &getAppleNamespacesSection() const {
return Dummy;
}
virtual const DWARFSection &getDebugNamesSection() const { return Dummy; }
virtual const DWARFSection &getNamesSection() const { return Dummy; }
virtual const DWARFSection &getAppleObjCSection() const { return Dummy; }
virtual StringRef getCUIndexSection() const { return ""; }
virtual StringRef getGdbIndexSection() const { return ""; }

View File

@ -394,7 +394,7 @@ void DWARFContext::dump(
}
if (const auto *Off = shouldDump(Explicit, ".debug_frame", DIDT_ID_DebugFrame,
DObj->getDebugFrameSection().Data))
DObj->getFrameSection().Data))
getDebugFrame()->dump(OS, getRegisterInfo(), *Off);
if (const auto *Off = shouldDump(Explicit, ".eh_frame", DIDT_ID_DebugFrame,
@ -409,9 +409,9 @@ void DWARFContext::dump(
}
if (shouldDump(Explicit, ".debug_aranges", DIDT_ID_DebugAranges,
DObj->getARangeSection())) {
DObj->getArangesSection())) {
uint64_t offset = 0;
DataExtractor arangesData(DObj->getARangeSection(), isLittleEndian(), 0);
DataExtractor arangesData(DObj->getArangesSection(), isLittleEndian(), 0);
DWARFDebugArangeSet set;
while (set.extract(arangesData, &offset))
set.dump(OS);
@ -467,8 +467,8 @@ void DWARFContext::dump(
}
if (shouldDump(Explicit, ".debug_str", DIDT_ID_DebugStr,
DObj->getStringSection())) {
DataExtractor strData(DObj->getStringSection(), isLittleEndian(), 0);
DObj->getStrSection())) {
DataExtractor strData(DObj->getStrSection(), isLittleEndian(), 0);
uint64_t offset = 0;
uint64_t strOffset = 0;
while (const char *s = strData.getCStr(&offset)) {
@ -477,8 +477,8 @@ void DWARFContext::dump(
}
}
if (shouldDump(ExplicitDWO, ".debug_str.dwo", DIDT_ID_DebugStr,
DObj->getStringDWOSection())) {
DataExtractor strDWOData(DObj->getStringDWOSection(), isLittleEndian(), 0);
DObj->getStrDWOSection())) {
DataExtractor strDWOData(DObj->getStrDWOSection(), isLittleEndian(), 0);
uint64_t offset = 0;
uint64_t strDWOOffset = 0;
while (const char *s = strDWOData.getCStr(&offset)) {
@ -487,8 +487,8 @@ void DWARFContext::dump(
}
}
if (shouldDump(Explicit, ".debug_line_str", DIDT_ID_DebugLineStr,
DObj->getLineStringSection())) {
DataExtractor strData(DObj->getLineStringSection(), isLittleEndian(), 0);
DObj->getLineStrSection())) {
DataExtractor strData(DObj->getLineStrSection(), isLittleEndian(), 0);
uint64_t offset = 0;
uint64_t strOffset = 0;
while (const char *s = strData.getCStr(&offset)) {
@ -507,9 +507,9 @@ void DWARFContext::dump(
}
if (shouldDump(Explicit, ".debug_ranges", DIDT_ID_DebugRanges,
DObj->getRangeSection().Data)) {
DObj->getRangesSection().Data)) {
uint8_t savedAddressByteSize = getCUAddrSize();
DWARFDataExtractor rangesData(*DObj, DObj->getRangeSection(),
DWARFDataExtractor rangesData(*DObj, DObj->getRangesSection(),
isLittleEndian(), savedAddressByteSize);
uint64_t offset = 0;
DWARFDebugRangeList rangeList;
@ -545,38 +545,38 @@ void DWARFContext::dump(
}
if (shouldDump(Explicit, ".debug_pubnames", DIDT_ID_DebugPubnames,
DObj->getPubNamesSection().Data))
DWARFDebugPubTable(*DObj, DObj->getPubNamesSection(), isLittleEndian(), false)
DObj->getPubnamesSection().Data))
DWARFDebugPubTable(*DObj, DObj->getPubnamesSection(), isLittleEndian(), false)
.dump(OS);
if (shouldDump(Explicit, ".debug_pubtypes", DIDT_ID_DebugPubtypes,
DObj->getPubTypesSection().Data))
DWARFDebugPubTable(*DObj, DObj->getPubTypesSection(), isLittleEndian(), false)
DObj->getPubtypesSection().Data))
DWARFDebugPubTable(*DObj, DObj->getPubtypesSection(), isLittleEndian(), false)
.dump(OS);
if (shouldDump(Explicit, ".debug_gnu_pubnames", DIDT_ID_DebugGnuPubnames,
DObj->getGnuPubNamesSection().Data))
DWARFDebugPubTable(*DObj, DObj->getGnuPubNamesSection(), isLittleEndian(),
DObj->getGnuPubnamesSection().Data))
DWARFDebugPubTable(*DObj, DObj->getGnuPubnamesSection(), isLittleEndian(),
true /* GnuStyle */)
.dump(OS);
if (shouldDump(Explicit, ".debug_gnu_pubtypes", DIDT_ID_DebugGnuPubtypes,
DObj->getGnuPubTypesSection().Data))
DWARFDebugPubTable(*DObj, DObj->getGnuPubTypesSection(), isLittleEndian(),
DObj->getGnuPubtypesSection().Data))
DWARFDebugPubTable(*DObj, DObj->getGnuPubtypesSection(), isLittleEndian(),
true /* GnuStyle */)
.dump(OS);
if (shouldDump(Explicit, ".debug_str_offsets", DIDT_ID_DebugStrOffsets,
DObj->getStringOffsetSection().Data))
DObj->getStrOffsetsSection().Data))
dumpStringOffsetsSection(OS, "debug_str_offsets", *DObj,
DObj->getStringOffsetSection(),
DObj->getStringSection(), normal_units(),
DObj->getStrOffsetsSection(),
DObj->getStrSection(), normal_units(),
isLittleEndian(), getMaxVersion());
if (shouldDump(ExplicitDWO, ".debug_str_offsets.dwo", DIDT_ID_DebugStrOffsets,
DObj->getStringOffsetDWOSection().Data))
DObj->getStrOffsetsDWOSection().Data))
dumpStringOffsetsSection(OS, "debug_str_offsets.dwo", *DObj,
DObj->getStringOffsetDWOSection(),
DObj->getStringDWOSection(), dwo_units(),
DObj->getStrOffsetsDWOSection(),
DObj->getStrDWOSection(), dwo_units(),
isLittleEndian(), getMaxDWOVersion());
if (shouldDump(Explicit, ".gdb_index", DIDT_ID_GdbIndex,
@ -600,7 +600,7 @@ void DWARFContext::dump(
DObj->getAppleObjCSection().Data))
getAppleObjC().dump(OS);
if (shouldDump(Explicit, ".debug_names", DIDT_ID_DebugNames,
DObj->getDebugNamesSection().Data))
DObj->getNamesSection().Data))
getDebugNames().dump(OS);
}
@ -759,7 +759,7 @@ const DWARFDebugFrame *DWARFContext::getDebugFrame() {
// provides this information). This problem is fixed in DWARFv4
// See this dwarf-discuss discussion for more details:
// http://lists.dwarfstd.org/htdig.cgi/dwarf-discuss-dwarfstd.org/2011-December/001173.html
DWARFDataExtractor debugFrameData(*DObj, DObj->getDebugFrameSection(),
DWARFDataExtractor debugFrameData(*DObj, DObj->getFrameSection(),
isLittleEndian(), DObj->getAddressSize());
DebugFrame.reset(new DWARFDebugFrame(getArch(), false /* IsEH */));
DebugFrame->parse(debugFrameData);
@ -802,29 +802,29 @@ static T &getAccelTable(std::unique_ptr<T> &Cache, const DWARFObject &Obj,
}
const DWARFDebugNames &DWARFContext::getDebugNames() {
return getAccelTable(Names, *DObj, DObj->getDebugNamesSection(),
DObj->getStringSection(), isLittleEndian());
return getAccelTable(Names, *DObj, DObj->getNamesSection(),
DObj->getStrSection(), isLittleEndian());
}
const AppleAcceleratorTable &DWARFContext::getAppleNames() {
return getAccelTable(AppleNames, *DObj, DObj->getAppleNamesSection(),
DObj->getStringSection(), isLittleEndian());
DObj->getStrSection(), isLittleEndian());
}
const AppleAcceleratorTable &DWARFContext::getAppleTypes() {
return getAccelTable(AppleTypes, *DObj, DObj->getAppleTypesSection(),
DObj->getStringSection(), isLittleEndian());
DObj->getStrSection(), isLittleEndian());
}
const AppleAcceleratorTable &DWARFContext::getAppleNamespaces() {
return getAccelTable(AppleNamespaces, *DObj,
DObj->getAppleNamespacesSection(),
DObj->getStringSection(), isLittleEndian());
DObj->getStrSection(), isLittleEndian());
}
const AppleAcceleratorTable &DWARFContext::getAppleObjC() {
return getAccelTable(AppleObjC, *DObj, DObj->getAppleObjCSection(),
DObj->getStringSection(), isLittleEndian());
DObj->getStrSection(), isLittleEndian());
}
const DWARFDebugLine::LineTable *
@ -1372,50 +1372,50 @@ class DWARFObjInMemory final : public DWARFObject {
InfoSectionMap TypesDWOSections;
DWARFSectionMap LocSection;
DWARFSectionMap LocListsSection;
DWARFSectionMap LoclistsSection;
DWARFSectionMap LineSection;
DWARFSectionMap RangeSection;
DWARFSectionMap RangesSection;
DWARFSectionMap RnglistsSection;
DWARFSectionMap StringOffsetSection;
DWARFSectionMap StrOffsetsSection;
DWARFSectionMap LineDWOSection;
DWARFSectionMap DebugFrameSection;
DWARFSectionMap FrameSection;
DWARFSectionMap EHFrameSection;
DWARFSectionMap LocDWOSection;
DWARFSectionMap StringOffsetDWOSection;
DWARFSectionMap RangeDWOSection;
DWARFSectionMap StrOffsetsDWOSection;
DWARFSectionMap RangesDWOSection;
DWARFSectionMap RnglistsDWOSection;
DWARFSectionMap AddrSection;
DWARFSectionMap AppleNamesSection;
DWARFSectionMap AppleTypesSection;
DWARFSectionMap AppleNamespacesSection;
DWARFSectionMap AppleObjCSection;
DWARFSectionMap DebugNamesSection;
DWARFSectionMap PubNamesSection;
DWARFSectionMap PubTypesSection;
DWARFSectionMap GnuPubNamesSection;
DWARFSectionMap GnuPubTypesSection;
DWARFSectionMap NamesSection;
DWARFSectionMap PubnamesSection;
DWARFSectionMap PubtypesSection;
DWARFSectionMap GnuPubnamesSection;
DWARFSectionMap GnuPubtypesSection;
DWARFSectionMap *mapNameToDWARFSection(StringRef Name) {
return StringSwitch<DWARFSectionMap *>(Name)
.Case("debug_loc", &LocSection)
.Case("debug_loclists", &LocListsSection)
.Case("debug_loclists", &LoclistsSection)
.Case("debug_line", &LineSection)
.Case("debug_frame", &DebugFrameSection)
.Case("debug_frame", &FrameSection)
.Case("eh_frame", &EHFrameSection)
.Case("debug_str_offsets", &StringOffsetSection)
.Case("debug_ranges", &RangeSection)
.Case("debug_str_offsets", &StrOffsetsSection)
.Case("debug_ranges", &RangesSection)
.Case("debug_rnglists", &RnglistsSection)
.Case("debug_loc.dwo", &LocDWOSection)
.Case("debug_line.dwo", &LineDWOSection)
.Case("debug_names", &DebugNamesSection)
.Case("debug_names", &NamesSection)
.Case("debug_rnglists.dwo", &RnglistsDWOSection)
.Case("debug_str_offsets.dwo", &StringOffsetDWOSection)
.Case("debug_str_offsets.dwo", &StrOffsetsDWOSection)
.Case("debug_addr", &AddrSection)
.Case("apple_names", &AppleNamesSection)
.Case("debug_pubnames", &PubNamesSection)
.Case("debug_pubtypes", &PubTypesSection)
.Case("debug_gnu_pubnames", &GnuPubNamesSection)
.Case("debug_gnu_pubtypes", &GnuPubTypesSection)
.Case("debug_pubnames", &PubnamesSection)
.Case("debug_pubtypes", &PubtypesSection)
.Case("debug_gnu_pubnames", &GnuPubnamesSection)
.Case("debug_gnu_pubtypes", &GnuPubtypesSection)
.Case("apple_types", &AppleTypesSection)
.Case("apple_namespaces", &AppleNamespacesSection)
.Case("apple_namespac", &AppleNamespacesSection)
@ -1424,15 +1424,15 @@ class DWARFObjInMemory final : public DWARFObject {
}
StringRef AbbrevSection;
StringRef ARangeSection;
StringRef StringSection;
StringRef ArangesSection;
StringRef StrSection;
StringRef MacinfoSection;
StringRef AbbrevDWOSection;
StringRef StringDWOSection;
StringRef StrDWOSection;
StringRef CUIndexSection;
StringRef GdbIndexSection;
StringRef TUIndexSection;
StringRef LineStringSection;
StringRef LineStrSection;
// A deque holding section data whose iterators are not invalidated when
// new decompressed sections are inserted at the end.
@ -1443,15 +1443,15 @@ class DWARFObjInMemory final : public DWARFObject {
return &Sec->Data;
return StringSwitch<StringRef *>(Name)
.Case("debug_abbrev", &AbbrevSection)
.Case("debug_aranges", &ARangeSection)
.Case("debug_str", &StringSection)
.Case("debug_aranges", &ArangesSection)
.Case("debug_str", &StrSection)
.Case("debug_macinfo", &MacinfoSection)
.Case("debug_abbrev.dwo", &AbbrevDWOSection)
.Case("debug_str.dwo", &StringDWOSection)
.Case("debug_str.dwo", &StrDWOSection)
.Case("debug_cu_index", &CUIndexSection)
.Case("debug_tu_index", &TUIndexSection)
.Case("gdb_index", &GdbIndexSection)
.Case("debug_line_str", &LineStringSection)
.Case("debug_line_str", &LineStrSection)
// Any more debug info sections go here.
.Default(nullptr);
}
@ -1553,7 +1553,7 @@ public:
*SectionData = Data;
if (Name == "debug_ranges") {
// FIXME: Use the other dwo range section when we emit it.
RangeDWOSection.Data = Data;
RangesDWOSection.Data = Data;
}
} else if (Name == "debug_info") {
// Find debug_info and debug_types data by section rather than name as
@ -1703,12 +1703,12 @@ public:
const DWARFSection &getLocDWOSection() const override {
return LocDWOSection;
}
StringRef getStringDWOSection() const override { return StringDWOSection; }
const DWARFSection &getStringOffsetDWOSection() const override {
return StringOffsetDWOSection;
StringRef getStrDWOSection() const override { return StrDWOSection; }
const DWARFSection &getStrOffsetsDWOSection() const override {
return StrOffsetsDWOSection;
}
const DWARFSection &getRangeDWOSection() const override {
return RangeDWOSection;
const DWARFSection &getRangesDWOSection() const override {
return RangesDWOSection;
}
const DWARFSection &getRnglistsDWOSection() const override {
return RnglistsDWOSection;
@ -1719,10 +1719,10 @@ public:
StringRef getTUIndexSection() const override { return TUIndexSection; }
// DWARF v5
const DWARFSection &getStringOffsetSection() const override {
return StringOffsetSection;
const DWARFSection &getStrOffsetsSection() const override {
return StrOffsetsSection;
}
StringRef getLineStringSection() const override { return LineStringSection; }
StringRef getLineStrSection() const override { return LineStrSection; }
// Sections for DWARF5 split dwarf proposal.
void forEachInfoDWOSections(
@ -1738,28 +1738,28 @@ public:
StringRef getAbbrevSection() const override { return AbbrevSection; }
const DWARFSection &getLocSection() const override { return LocSection; }
const DWARFSection &getLoclistsSection() const override { return LocListsSection; }
StringRef getARangeSection() const override { return ARangeSection; }
const DWARFSection &getDebugFrameSection() const override {
return DebugFrameSection;
const DWARFSection &getLoclistsSection() const override { return LoclistsSection; }
StringRef getArangesSection() const override { return ArangesSection; }
const DWARFSection &getFrameSection() const override {
return FrameSection;
}
const DWARFSection &getEHFrameSection() const override {
return EHFrameSection;
}
const DWARFSection &getLineSection() const override { return LineSection; }
StringRef getStringSection() const override { return StringSection; }
const DWARFSection &getRangeSection() const override { return RangeSection; }
StringRef getStrSection() const override { return StrSection; }
const DWARFSection &getRangesSection() const override { return RangesSection; }
const DWARFSection &getRnglistsSection() const override {
return RnglistsSection;
}
StringRef getMacinfoSection() const override { return MacinfoSection; }
const DWARFSection &getPubNamesSection() const override { return PubNamesSection; }
const DWARFSection &getPubTypesSection() const override { return PubTypesSection; }
const DWARFSection &getGnuPubNamesSection() const override {
return GnuPubNamesSection;
const DWARFSection &getPubnamesSection() const override { return PubnamesSection; }
const DWARFSection &getPubtypesSection() const override { return PubtypesSection; }
const DWARFSection &getGnuPubnamesSection() const override {
return GnuPubnamesSection;
}
const DWARFSection &getGnuPubTypesSection() const override {
return GnuPubTypesSection;
const DWARFSection &getGnuPubtypesSection() const override {
return GnuPubtypesSection;
}
const DWARFSection &getAppleNamesSection() const override {
return AppleNamesSection;
@ -1773,8 +1773,8 @@ public:
const DWARFSection &getAppleObjCSection() const override {
return AppleObjCSection;
}
const DWARFSection &getDebugNamesSection() const override {
return DebugNamesSection;
const DWARFSection &getNamesSection() const override {
return NamesSection;
}
StringRef getFileName() const override { return FileName; }

View File

@ -43,7 +43,7 @@ void DWARFDebugAranges::generate(DWARFContext *CTX) {
return;
// Extract aranges from .debug_aranges section.
DataExtractor ArangesData(CTX->getDWARFObj().getARangeSection(),
DataExtractor ArangesData(CTX->getDWARFObj().getArangesSection(),
CTX->isLittleEndian(), 0);
extract(ArangesData);

View File

@ -37,9 +37,9 @@ void DWARFUnitVector::addUnitsForSection(DWARFContext &C,
const DWARFSection &Section,
DWARFSectionKind SectionKind) {
const DWARFObject &D = C.getDWARFObj();
addUnitsImpl(C, D, Section, C.getDebugAbbrev(), &D.getRangeSection(),
&D.getLocSection(), D.getStringSection(),
D.getStringOffsetSection(), &D.getAddrSection(),
addUnitsImpl(C, D, Section, C.getDebugAbbrev(), &D.getRangesSection(),
&D.getLocSection(), D.getStrSection(),
D.getStrOffsetsSection(), &D.getAddrSection(),
D.getLineSection(), D.isLittleEndian(), false, false,
SectionKind);
}
@ -49,9 +49,9 @@ void DWARFUnitVector::addUnitsForDWOSection(DWARFContext &C,
DWARFSectionKind SectionKind,
bool Lazy) {
const DWARFObject &D = C.getDWARFObj();
addUnitsImpl(C, D, DWOSection, C.getDebugAbbrevDWO(), &D.getRangeDWOSection(),
&D.getLocDWOSection(), D.getStringDWOSection(),
D.getStringOffsetDWOSection(), &D.getAddrSection(),
addUnitsImpl(C, D, DWOSection, C.getDebugAbbrevDWO(), &D.getRangesDWOSection(),
&D.getLocDWOSection(), D.getStrDWOSection(),
D.getStrOffsetsDWOSection(), &D.getAddrSection(),
D.getLineDWOSection(), C.isLittleEndian(), true, Lazy,
SectionKind);
}

View File

@ -295,9 +295,9 @@ unsigned DWARFVerifier::verifyUnitSection(const DWARFSection &S,
case dwarf::DW_UT_type:
case dwarf::DW_UT_split_type: {
Unit = TypeUnitVector.addUnit(llvm::make_unique<DWARFTypeUnit>(
DCtx, S, Header, DCtx.getDebugAbbrev(), &DObj.getRangeSection(),
&DObj.getLocSection(), DObj.getStringSection(),
DObj.getStringOffsetSection(), &DObj.getAppleObjCSection(),
DCtx, S, Header, DCtx.getDebugAbbrev(), &DObj.getRangesSection(),
&DObj.getLocSection(), DObj.getStrSection(),
DObj.getStrOffsetsSection(), &DObj.getAppleObjCSection(),
DObj.getLineSection(), DCtx.isLittleEndian(), false,
TypeUnitVector));
break;
@ -309,9 +309,9 @@ unsigned DWARFVerifier::verifyUnitSection(const DWARFSection &S,
// UnitType = 0 means that we are verifying a compile unit in DWARF v4.
case 0: {
Unit = CompileUnitVector.addUnit(llvm::make_unique<DWARFCompileUnit>(
DCtx, S, Header, DCtx.getDebugAbbrev(), &DObj.getRangeSection(),
&DObj.getLocSection(), DObj.getStringSection(),
DObj.getStringOffsetSection(), &DObj.getAppleObjCSection(),
DCtx, S, Header, DCtx.getDebugAbbrev(), &DObj.getRangesSection(),
&DObj.getLocSection(), DObj.getStrSection(),
DObj.getStrOffsetsSection(), &DObj.getAppleObjCSection(),
DObj.getLineSection(), DCtx.isLittleEndian(), false,
CompileUnitVector));
break;
@ -449,7 +449,7 @@ unsigned DWARFVerifier::verifyDebugInfoAttribute(const DWARFDie &Die,
case DW_AT_ranges:
// Make sure the offset in the DW_AT_ranges attribute is valid.
if (auto SectionOffset = AttrValue.Value.getAsSectionOffset()) {
if (*SectionOffset >= DObj.getRangeSection().Data.size())
if (*SectionOffset >= DObj.getRangesSection().Data.size())
ReportError("DW_AT_ranges offset is beyond .debug_ranges bounds:");
break;
}
@ -578,7 +578,7 @@ unsigned DWARFVerifier::verifyDebugInfoForm(const DWARFDie &Die,
case DW_FORM_strp: {
auto SecOffset = AttrValue.Value.getAsSectionOffset();
assert(SecOffset); // DW_FORM_strp is a section offset.
if (SecOffset && *SecOffset >= DObj.getStringSection().size()) {
if (SecOffset && *SecOffset >= DObj.getStrSection().size()) {
++NumErrors;
error() << "DW_FORM_strp offset beyond .debug_str bounds:\n";
dump(Die) << '\n';
@ -605,7 +605,7 @@ unsigned DWARFVerifier::verifyDebugInfoForm(const DWARFDie &Die,
// Use a 64-bit type to calculate the offset to guard against overflow.
uint64_t Offset =
(uint64_t)DieCU->getStringOffsetsBase() + Index * ItemSize;
if (DObj.getStringOffsetSection().Data.size() < Offset + ItemSize) {
if (DObj.getStrOffsetsSection().Data.size() < Offset + ItemSize) {
++NumErrors;
error() << FormEncodingString(Form) << " uses index "
<< format("%" PRIu64, Index) << ", which is too large:\n";
@ -614,7 +614,7 @@ unsigned DWARFVerifier::verifyDebugInfoForm(const DWARFDie &Die,
}
// Check that the string offset is valid.
uint64_t StringOffset = *DieCU->getStringOffsetSectionItem(Index);
if (StringOffset >= DObj.getStringSection().size()) {
if (StringOffset >= DObj.getStrSection().size()) {
++NumErrors;
error() << FormEncodingString(Form) << " uses index "
<< format("%" PRIu64, Index)
@ -1456,7 +1456,7 @@ unsigned DWARFVerifier::verifyDebugNames(const DWARFSection &AccelSection,
bool DWARFVerifier::handleAccelTables() {
const DWARFObject &D = DCtx.getDWARFObj();
DataExtractor StrData(D.getStringSection(), DCtx.isLittleEndian(), 0);
DataExtractor StrData(D.getStrSection(), DCtx.isLittleEndian(), 0);
unsigned NumErrors = 0;
if (!D.getAppleNamesSection().Data.empty())
NumErrors += verifyAppleAccelTable(&D.getAppleNamesSection(), &StrData,
@ -1471,8 +1471,8 @@ bool DWARFVerifier::handleAccelTables() {
NumErrors += verifyAppleAccelTable(&D.getAppleObjCSection(), &StrData,
".apple_objc");
if (!D.getDebugNamesSection().Data.empty())
NumErrors += verifyDebugNames(D.getDebugNamesSection(), StrData);
if (!D.getNamesSection().Data.empty())
NumErrors += verifyDebugNames(D.getNamesSection(), StrData);
return NumErrors == 0;
}

View File

@ -1698,7 +1698,7 @@ void DwarfLinker::patchRangesForUnit(const CompileUnit &Unit,
const auto &FunctionRanges = Unit.getFunctionRanges();
unsigned AddressSize = Unit.getOrigUnit().getAddressByteSize();
DWARFDataExtractor RangeExtractor(OrigDwarf.getDWARFObj(),
OrigDwarf.getDWARFObj().getRangeSection(),
OrigDwarf.getDWARFObj().getRangesSection(),
OrigDwarf.isLittleEndian(), AddressSize);
auto InvalidRange = FunctionRanges.end(), CurrRange = InvalidRange;
DWARFUnit &OrigUnit = Unit.getOrigUnit();
@ -2003,7 +2003,7 @@ void DwarfLinker::patchFrameInfoForObject(const DebugMapObject &DMO,
RangesTy &Ranges,
DWARFContext &OrigDwarf,
unsigned AddrSize) {
StringRef FrameData = OrigDwarf.getDWARFObj().getDebugFrameSection().Data;
StringRef FrameData = OrigDwarf.getDWARFObj().getFrameSection().Data;
if (FrameData.empty())
return;
@ -2432,7 +2432,7 @@ void DwarfLinker::updateAccelKind(DWARFContext &Dwarf) {
}
if (!AtLeastOneDwarfAccelTable &&
!DwarfObj.getDebugNamesSection().Data.empty()) {
!DwarfObj.getNamesSection().Data.empty()) {
AtLeastOneDwarfAccelTable = true;
}
}

View File

@ -48,7 +48,7 @@ void dumpDebugAbbrev(DWARFContext &DCtx, DWARFYAML::Data &Y) {
}
void dumpDebugStrings(DWARFContext &DCtx, DWARFYAML::Data &Y) {
StringRef RemainingTable = DCtx.getDWARFObj().getStringSection();
StringRef RemainingTable = DCtx.getDWARFObj().getStrSection();
while (RemainingTable.size() > 0) {
auto SymbolPair = RemainingTable.split('\0');
RemainingTable = SymbolPair.second;
@ -57,7 +57,7 @@ void dumpDebugStrings(DWARFContext &DCtx, DWARFYAML::Data &Y) {
}
void dumpDebugARanges(DWARFContext &DCtx, DWARFYAML::Data &Y) {
DataExtractor ArangesData(DCtx.getDWARFObj().getARangeSection(),
DataExtractor ArangesData(DCtx.getDWARFObj().getArangesSection(),
DCtx.isLittleEndian(), 0);
uint64_t Offset = 0;
DWARFDebugArangeSet Set;
@ -101,16 +101,16 @@ void dumpPubSection(DWARFContext &DCtx, DWARFYAML::PubSection &Y,
void dumpDebugPubSections(DWARFContext &DCtx, DWARFYAML::Data &Y) {
const DWARFObject &D = DCtx.getDWARFObj();
Y.PubNames.IsGNUStyle = false;
dumpPubSection(DCtx, Y.PubNames, D.getPubNamesSection());
dumpPubSection(DCtx, Y.PubNames, D.getPubnamesSection());
Y.PubTypes.IsGNUStyle = false;
dumpPubSection(DCtx, Y.PubTypes, D.getPubTypesSection());
dumpPubSection(DCtx, Y.PubTypes, D.getPubtypesSection());
Y.GNUPubNames.IsGNUStyle = true;
dumpPubSection(DCtx, Y.GNUPubNames, D.getGnuPubNamesSection());
dumpPubSection(DCtx, Y.GNUPubNames, D.getGnuPubnamesSection());
Y.GNUPubTypes.IsGNUStyle = true;
dumpPubSection(DCtx, Y.GNUPubTypes, D.getGnuPubTypesSection());
dumpPubSection(DCtx, Y.GNUPubTypes, D.getGnuPubtypesSection());
}
void dumpDebugInfo(DWARFContext &DCtx, DWARFYAML::Data &Y) {

View File

@ -1096,7 +1096,7 @@ TEST(DWARFDebugInfo, TestEmptyStringOffsets) {
ASSERT_TRUE((bool)Obj);
std::unique_ptr<DWARFContext> DwarfContext = DWARFContext::create(**Obj);
EXPECT_TRUE(
DwarfContext->getDWARFObj().getStringOffsetSection().Data.empty());
DwarfContext->getDWARFObj().getStrOffsetsSection().Data.empty());
}
TEST(DWARFDebugInfo, TestRelations) {