forked from OSchip/llvm-project
[DebugInfo] Pass DWARFSection into DWARFUnitSection constructor (NFC).
llvm-svn: 219259
This commit is contained in:
parent
fcfbcc6d10
commit
8cd4c9d947
|
@ -314,7 +314,7 @@ DWARFContext::getLineTableForUnit(DWARFUnit *cu) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DWARFContext::parseCompileUnits() {
|
void DWARFContext::parseCompileUnits() {
|
||||||
CUs.parse(*this, getInfoSection().Data, getInfoSection().Relocs);
|
CUs.parse(*this, getInfoSection());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DWARFContext::parseTypeUnits() {
|
void DWARFContext::parseTypeUnits() {
|
||||||
|
@ -322,12 +322,12 @@ void DWARFContext::parseTypeUnits() {
|
||||||
return;
|
return;
|
||||||
for (const auto &I : getTypesSections()) {
|
for (const auto &I : getTypesSections()) {
|
||||||
TUs.push_back(DWARFUnitSection<DWARFTypeUnit>());
|
TUs.push_back(DWARFUnitSection<DWARFTypeUnit>());
|
||||||
TUs.back().parse(*this, I.second.Data, I.second.Relocs);
|
TUs.back().parse(*this, I.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DWARFContext::parseDWOCompileUnits() {
|
void DWARFContext::parseDWOCompileUnits() {
|
||||||
DWOCUs.parseDWO(*this, getInfoDWOSection().Data, getInfoDWOSection().Relocs);
|
DWOCUs.parseDWO(*this, getInfoDWOSection());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DWARFContext::parseDWOTypeUnits() {
|
void DWARFContext::parseDWOTypeUnits() {
|
||||||
|
@ -335,7 +335,7 @@ void DWARFContext::parseDWOTypeUnits() {
|
||||||
return;
|
return;
|
||||||
for (const auto &I : getTypesDWOSections()) {
|
for (const auto &I : getTypesDWOSections()) {
|
||||||
DWOTUs.push_back(DWARFUnitSection<DWARFTypeUnit>());
|
DWOTUs.push_back(DWARFUnitSection<DWARFTypeUnit>());
|
||||||
DWOTUs.back().parseDWO(*this, I.second.Data, I.second.Relocs);
|
DWOTUs.back().parseDWO(*this, I.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,19 +17,17 @@
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
using namespace dwarf;
|
using namespace dwarf;
|
||||||
|
|
||||||
|
void DWARFUnitSectionBase::parse(DWARFContext &C, const DWARFSection &Section) {
|
||||||
void DWARFUnitSectionBase::parse(DWARFContext &C, StringRef SectionData,
|
parseImpl(C, Section, C.getDebugAbbrev(), C.getRangeSection(),
|
||||||
const RelocAddrMap &Map) {
|
C.getStringSection(), StringRef(), C.getAddrSection(),
|
||||||
parseImpl(C, C.getDebugAbbrev(), SectionData, C.getRangeSection(),
|
|
||||||
C.getStringSection(), StringRef(), C.getAddrSection(), Map,
|
|
||||||
C.isLittleEndian());
|
C.isLittleEndian());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DWARFUnitSectionBase::parseDWO(DWARFContext &C, StringRef SectionData,
|
void DWARFUnitSectionBase::parseDWO(DWARFContext &C,
|
||||||
const RelocAddrMap &Map) {
|
const DWARFSection &DWOSection) {
|
||||||
parseImpl(C, C.getDebugAbbrevDWO(), SectionData, C.getRangeDWOSection(),
|
parseImpl(C, DWOSection, C.getDebugAbbrevDWO(), C.getRangeDWOSection(),
|
||||||
C.getStringDWOSection(), C.getStringOffsetDWOSection(),
|
C.getStringDWOSection(), C.getStringOffsetDWOSection(),
|
||||||
C.getAddrSection(), Map, C.isLittleEndian());
|
C.getAddrSection(), C.isLittleEndian());
|
||||||
}
|
}
|
||||||
|
|
||||||
DWARFUnit::DWARFUnit(DWARFContext &DC, const DWARFDebugAbbrev *DA,
|
DWARFUnit::DWARFUnit(DWARFContext &DC, const DWARFDebugAbbrev *DA,
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "DWARFDebugInfoEntry.h"
|
#include "DWARFDebugInfoEntry.h"
|
||||||
#include "DWARFDebugRangeList.h"
|
#include "DWARFDebugRangeList.h"
|
||||||
#include "DWARFRelocMap.h"
|
#include "DWARFRelocMap.h"
|
||||||
|
#include "DWARFSection.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
@ -24,9 +25,9 @@ class ObjectFile;
|
||||||
|
|
||||||
class DWARFContext;
|
class DWARFContext;
|
||||||
class DWARFDebugAbbrev;
|
class DWARFDebugAbbrev;
|
||||||
|
class DWARFUnit;
|
||||||
class StringRef;
|
class StringRef;
|
||||||
class raw_ostream;
|
class raw_ostream;
|
||||||
class DWARFUnit;
|
|
||||||
|
|
||||||
/// Base class for all DWARFUnitSection classes. This provides the
|
/// Base class for all DWARFUnitSection classes. This provides the
|
||||||
/// functionality common to all unit types.
|
/// functionality common to all unit types.
|
||||||
|
@ -36,14 +37,13 @@ public:
|
||||||
/// same section this Unit originated from.
|
/// same section this Unit originated from.
|
||||||
virtual DWARFUnit *getUnitForOffset(uint32_t Offset) const = 0;
|
virtual DWARFUnit *getUnitForOffset(uint32_t Offset) const = 0;
|
||||||
|
|
||||||
void parse(DWARFContext &C, StringRef SectionData, const RelocAddrMap &Map);
|
void parse(DWARFContext &C, const DWARFSection &Section);
|
||||||
void parseDWO(DWARFContext &C, StringRef SectionData, const RelocAddrMap &Map);
|
void parseDWO(DWARFContext &C, const DWARFSection &DWOSection);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void parseImpl(DWARFContext &Context, const DWARFDebugAbbrev *DA,
|
virtual void parseImpl(DWARFContext &Context, const DWARFSection &Section,
|
||||||
StringRef Section, StringRef RS, StringRef SS,
|
const DWARFDebugAbbrev *DA, StringRef RS, StringRef SS,
|
||||||
StringRef SOS, StringRef AOS, const RelocAddrMap &M,
|
StringRef SOS, StringRef AOS, bool isLittleEndian) = 0;
|
||||||
bool isLittleEndian) = 0;
|
|
||||||
|
|
||||||
~DWARFUnitSectionBase() {}
|
~DWARFUnitSectionBase() {}
|
||||||
};
|
};
|
||||||
|
@ -79,18 +79,18 @@ public:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void parseImpl(DWARFContext &Context, const DWARFDebugAbbrev *DA,
|
void parseImpl(DWARFContext &Context, const DWARFSection &Section,
|
||||||
StringRef Section, StringRef RS, StringRef SS, StringRef SOS,
|
const DWARFDebugAbbrev *DA, StringRef RS, StringRef SS,
|
||||||
StringRef AOS, const RelocAddrMap &M, bool LE) override {
|
StringRef SOS, StringRef AOS, bool LE) override {
|
||||||
if (Parsed)
|
if (Parsed)
|
||||||
return;
|
return;
|
||||||
DataExtractor Data(Section, LE, 0);
|
DataExtractor Data(Section.Data, LE, 0);
|
||||||
uint32_t Offset = 0;
|
uint32_t Offset = 0;
|
||||||
while (Data.isValidOffset(Offset)) {
|
while (Data.isValidOffset(Offset)) {
|
||||||
auto U =
|
auto U =
|
||||||
llvm::make_unique<UnitType>(Context, DA, Section, RS, SS, SOS, AOS,
|
llvm::make_unique<UnitType>(Context, DA, Section.Data, RS, SS, SOS,
|
||||||
&M, Data.isLittleEndian(), *this);
|
AOS, &Section.Relocs, LE, *this);
|
||||||
if (!U->extract(Data, &Offset))
|
if (!U->extract(Data, &Offset))
|
||||||
break;
|
break;
|
||||||
this->push_back(std::move(U));
|
this->push_back(std::move(U));
|
||||||
|
|
Loading…
Reference in New Issue