mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-19 04:32:19 +00:00
[DebugInfo] Pass DWARFSection down to DWARFUnit constructor (NFC).
Keep the actual section contents and the relocation map together. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219261 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
52688c3aff
commit
8d74900819
@ -16,11 +16,11 @@ namespace llvm {
|
|||||||
|
|
||||||
class DWARFCompileUnit : public DWARFUnit {
|
class DWARFCompileUnit : public DWARFUnit {
|
||||||
public:
|
public:
|
||||||
DWARFCompileUnit(DWARFContext& Context, const DWARFDebugAbbrev *DA,
|
DWARFCompileUnit(DWARFContext &Context, const DWARFSection &Section,
|
||||||
StringRef IS, StringRef RS, StringRef SS, StringRef SOS,
|
const DWARFDebugAbbrev *DA, StringRef RS, StringRef SS,
|
||||||
StringRef AOS, const RelocAddrMap *M, bool LE,
|
StringRef SOS, StringRef AOS, bool LE,
|
||||||
const DWARFUnitSectionBase &UnitSection)
|
const DWARFUnitSectionBase &UnitSection)
|
||||||
: DWARFUnit(Context, DA, IS, RS, SS, SOS, AOS, M, LE, UnitSection) {}
|
: DWARFUnit(Context, Section, DA, RS, SS, SOS, AOS, LE, UnitSection) {}
|
||||||
void dump(raw_ostream &OS);
|
void dump(raw_ostream &OS);
|
||||||
// VTable anchor.
|
// VTable anchor.
|
||||||
~DWARFCompileUnit() override;
|
~DWARFCompileUnit() override;
|
||||||
|
@ -19,11 +19,11 @@ private:
|
|||||||
uint64_t TypeHash;
|
uint64_t TypeHash;
|
||||||
uint32_t TypeOffset;
|
uint32_t TypeOffset;
|
||||||
public:
|
public:
|
||||||
DWARFTypeUnit(DWARFContext &Context, const DWARFDebugAbbrev *DA,
|
DWARFTypeUnit(DWARFContext &Context, const DWARFSection &Section,
|
||||||
StringRef IS, StringRef RS, StringRef SS, StringRef SOS,
|
const DWARFDebugAbbrev *DA, StringRef RS, StringRef SS,
|
||||||
StringRef AOS, const RelocAddrMap *M, bool LE,
|
StringRef SOS, StringRef AOS, bool LE,
|
||||||
const DWARFUnitSectionBase &UnitSection)
|
const DWARFUnitSectionBase &UnitSection)
|
||||||
: DWARFUnit(Context, DA, IS, RS, SS, SOS, AOS, M, LE, UnitSection) {}
|
: DWARFUnit(Context, Section, DA, RS, SS, SOS, AOS, LE, UnitSection) {}
|
||||||
uint32_t getHeaderSize() const override {
|
uint32_t getHeaderSize() const override {
|
||||||
return DWARFUnit::getHeaderSize() + 12;
|
return DWARFUnit::getHeaderSize() + 12;
|
||||||
}
|
}
|
||||||
|
@ -30,13 +30,13 @@ void DWARFUnitSectionBase::parseDWO(DWARFContext &C,
|
|||||||
C.getAddrSection(), C.isLittleEndian());
|
C.getAddrSection(), C.isLittleEndian());
|
||||||
}
|
}
|
||||||
|
|
||||||
DWARFUnit::DWARFUnit(DWARFContext &DC, const DWARFDebugAbbrev *DA,
|
DWARFUnit::DWARFUnit(DWARFContext &DC, const DWARFSection &Section,
|
||||||
StringRef IS, StringRef RS, StringRef SS, StringRef SOS,
|
const DWARFDebugAbbrev *DA, StringRef RS, StringRef SS,
|
||||||
StringRef AOS, const RelocAddrMap *M, bool LE,
|
StringRef SOS, StringRef AOS, bool LE,
|
||||||
const DWARFUnitSectionBase& UnitSection)
|
const DWARFUnitSectionBase &UnitSection)
|
||||||
: Context(DC), Abbrev(DA), InfoSection(IS), RangeSection(RS),
|
: Context(DC), InfoSection(Section), Abbrev(DA), RangeSection(RS),
|
||||||
StringSection(SS), StringOffsetSection(SOS), AddrOffsetSection(AOS),
|
StringSection(SS), StringOffsetSection(SOS), AddrOffsetSection(AOS),
|
||||||
RelocMap(M), isLittleEndian(LE), UnitSection(UnitSection) {
|
isLittleEndian(LE), UnitSection(UnitSection) {
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,9 +88,8 @@ private:
|
|||||||
DataExtractor Data(Section.Data, 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, Section, DA, RS, SS, SOS,
|
||||||
llvm::make_unique<UnitType>(Context, DA, Section.Data, RS, SS, SOS,
|
AOS, LE, *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));
|
||||||
@ -102,16 +101,16 @@ private:
|
|||||||
|
|
||||||
class DWARFUnit {
|
class DWARFUnit {
|
||||||
DWARFContext &Context;
|
DWARFContext &Context;
|
||||||
|
// Section containing this DWARFUnit.
|
||||||
|
const DWARFSection &InfoSection;
|
||||||
|
|
||||||
const DWARFDebugAbbrev *Abbrev;
|
const DWARFDebugAbbrev *Abbrev;
|
||||||
StringRef InfoSection;
|
|
||||||
StringRef RangeSection;
|
StringRef RangeSection;
|
||||||
uint32_t RangeSectionBase;
|
uint32_t RangeSectionBase;
|
||||||
StringRef StringSection;
|
StringRef StringSection;
|
||||||
StringRef StringOffsetSection;
|
StringRef StringOffsetSection;
|
||||||
StringRef AddrOffsetSection;
|
StringRef AddrOffsetSection;
|
||||||
uint32_t AddrOffsetSectionBase;
|
uint32_t AddrOffsetSectionBase;
|
||||||
const RelocAddrMap *RelocMap;
|
|
||||||
bool isLittleEndian;
|
bool isLittleEndian;
|
||||||
const DWARFUnitSectionBase &UnitSection;
|
const DWARFUnitSectionBase &UnitSection;
|
||||||
|
|
||||||
@ -140,9 +139,10 @@ protected:
|
|||||||
virtual uint32_t getHeaderSize() const { return 11; }
|
virtual uint32_t getHeaderSize() const { return 11; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DWARFUnit(DWARFContext& Context, const DWARFDebugAbbrev *DA, StringRef IS,
|
DWARFUnit(DWARFContext &Context, const DWARFSection &Section,
|
||||||
StringRef RS, StringRef SS, StringRef SOS, StringRef AOS,
|
const DWARFDebugAbbrev *DA, StringRef RS, StringRef SS,
|
||||||
const RelocAddrMap *M, bool LE, const DWARFUnitSectionBase &UnitSection);
|
StringRef SOS, StringRef AOS, bool LE,
|
||||||
|
const DWARFUnitSectionBase &UnitSection);
|
||||||
|
|
||||||
virtual ~DWARFUnit();
|
virtual ~DWARFUnit();
|
||||||
|
|
||||||
@ -164,13 +164,13 @@ public:
|
|||||||
bool getStringOffsetSectionItem(uint32_t Index, uint32_t &Result) const;
|
bool getStringOffsetSectionItem(uint32_t Index, uint32_t &Result) const;
|
||||||
|
|
||||||
DataExtractor getDebugInfoExtractor() const {
|
DataExtractor getDebugInfoExtractor() const {
|
||||||
return DataExtractor(InfoSection, isLittleEndian, AddrSize);
|
return DataExtractor(InfoSection.Data, isLittleEndian, AddrSize);
|
||||||
}
|
}
|
||||||
DataExtractor getStringExtractor() const {
|
DataExtractor getStringExtractor() const {
|
||||||
return DataExtractor(StringSection, false, 0);
|
return DataExtractor(StringSection, false, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
const RelocAddrMap *getRelocMap() const { return RelocMap; }
|
const RelocAddrMap *getRelocMap() const { return &InfoSection.Relocs; }
|
||||||
|
|
||||||
bool extract(DataExtractor debug_info, uint32_t* offset_ptr);
|
bool extract(DataExtractor debug_info, uint32_t* offset_ptr);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user