mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-04 18:24:38 +00:00
Add a DWARFContext& member in DWARFUnit.
The DWARFContext will be used to pass global 'context' down, like pointers to related debug info sections or command line options. The first use will be for the debug_info dumper to be able to access other debug info section to dump eg. Location Expression inline in the debug_info dump. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217128 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -16,10 +16,10 @@ namespace llvm {
|
|||||||
|
|
||||||
class DWARFCompileUnit : public DWARFUnit {
|
class DWARFCompileUnit : public DWARFUnit {
|
||||||
public:
|
public:
|
||||||
DWARFCompileUnit(const DWARFDebugAbbrev *DA, StringRef IS, StringRef RS,
|
DWARFCompileUnit(DWARFContext& Context, const DWARFDebugAbbrev *DA,
|
||||||
StringRef SS, StringRef SOS, StringRef AOS,
|
StringRef IS, StringRef RS, StringRef SS, StringRef SOS,
|
||||||
const RelocAddrMap *M, bool LE)
|
StringRef AOS, const RelocAddrMap *M, bool LE)
|
||||||
: DWARFUnit(DA, IS, RS, SS, SOS, AOS, M, LE) {}
|
: DWARFUnit(Context, DA, IS, RS, SS, SOS, AOS, M, LE) {}
|
||||||
void dump(raw_ostream &OS);
|
void dump(raw_ostream &OS);
|
||||||
// VTable anchor.
|
// VTable anchor.
|
||||||
~DWARFCompileUnit() override;
|
~DWARFCompileUnit() override;
|
||||||
|
@ -318,7 +318,7 @@ void DWARFContext::parseCompileUnits() {
|
|||||||
const DataExtractor &DIData = DataExtractor(getInfoSection().Data,
|
const DataExtractor &DIData = DataExtractor(getInfoSection().Data,
|
||||||
isLittleEndian(), 0);
|
isLittleEndian(), 0);
|
||||||
while (DIData.isValidOffset(offset)) {
|
while (DIData.isValidOffset(offset)) {
|
||||||
std::unique_ptr<DWARFCompileUnit> CU(new DWARFCompileUnit(
|
std::unique_ptr<DWARFCompileUnit> CU(new DWARFCompileUnit(*this,
|
||||||
getDebugAbbrev(), getInfoSection().Data, getRangeSection(),
|
getDebugAbbrev(), getInfoSection().Data, getRangeSection(),
|
||||||
getStringSection(), StringRef(), getAddrSection(),
|
getStringSection(), StringRef(), getAddrSection(),
|
||||||
&getInfoSection().Relocs, isLittleEndian()));
|
&getInfoSection().Relocs, isLittleEndian()));
|
||||||
@ -338,10 +338,10 @@ void DWARFContext::parseTypeUnits() {
|
|||||||
const DataExtractor &DIData =
|
const DataExtractor &DIData =
|
||||||
DataExtractor(I.second.Data, isLittleEndian(), 0);
|
DataExtractor(I.second.Data, isLittleEndian(), 0);
|
||||||
while (DIData.isValidOffset(offset)) {
|
while (DIData.isValidOffset(offset)) {
|
||||||
std::unique_ptr<DWARFTypeUnit> TU(
|
std::unique_ptr<DWARFTypeUnit> TU(new DWARFTypeUnit(*this,
|
||||||
new DWARFTypeUnit(getDebugAbbrev(), I.second.Data, getRangeSection(),
|
getDebugAbbrev(), I.second.Data, getRangeSection(),
|
||||||
getStringSection(), StringRef(), getAddrSection(),
|
getStringSection(), StringRef(), getAddrSection(),
|
||||||
&I.second.Relocs, isLittleEndian()));
|
&I.second.Relocs, isLittleEndian()));
|
||||||
if (!TU->extract(DIData, &offset))
|
if (!TU->extract(DIData, &offset))
|
||||||
break;
|
break;
|
||||||
TUs.push_back(std::move(TU));
|
TUs.push_back(std::move(TU));
|
||||||
@ -357,7 +357,7 @@ void DWARFContext::parseDWOCompileUnits() {
|
|||||||
const DataExtractor &DIData =
|
const DataExtractor &DIData =
|
||||||
DataExtractor(getInfoDWOSection().Data, isLittleEndian(), 0);
|
DataExtractor(getInfoDWOSection().Data, isLittleEndian(), 0);
|
||||||
while (DIData.isValidOffset(offset)) {
|
while (DIData.isValidOffset(offset)) {
|
||||||
std::unique_ptr<DWARFCompileUnit> DWOCU(new DWARFCompileUnit(
|
std::unique_ptr<DWARFCompileUnit> DWOCU(new DWARFCompileUnit(*this,
|
||||||
getDebugAbbrevDWO(), getInfoDWOSection().Data, getRangeDWOSection(),
|
getDebugAbbrevDWO(), getInfoDWOSection().Data, getRangeDWOSection(),
|
||||||
getStringDWOSection(), getStringOffsetDWOSection(), getAddrSection(),
|
getStringDWOSection(), getStringOffsetDWOSection(), getAddrSection(),
|
||||||
&getInfoDWOSection().Relocs, isLittleEndian()));
|
&getInfoDWOSection().Relocs, isLittleEndian()));
|
||||||
@ -377,7 +377,7 @@ void DWARFContext::parseDWOTypeUnits() {
|
|||||||
const DataExtractor &DIData =
|
const DataExtractor &DIData =
|
||||||
DataExtractor(I.second.Data, isLittleEndian(), 0);
|
DataExtractor(I.second.Data, isLittleEndian(), 0);
|
||||||
while (DIData.isValidOffset(offset)) {
|
while (DIData.isValidOffset(offset)) {
|
||||||
std::unique_ptr<DWARFTypeUnit> TU(new DWARFTypeUnit(
|
std::unique_ptr<DWARFTypeUnit> TU(new DWARFTypeUnit(*this,
|
||||||
getDebugAbbrevDWO(), I.second.Data, getRangeDWOSection(),
|
getDebugAbbrevDWO(), I.second.Data, getRangeDWOSection(),
|
||||||
getStringDWOSection(), getStringOffsetDWOSection(), getAddrSection(),
|
getStringDWOSection(), getStringOffsetDWOSection(), getAddrSection(),
|
||||||
&I.second.Relocs, isLittleEndian()));
|
&I.second.Relocs, isLittleEndian()));
|
||||||
|
@ -19,10 +19,10 @@ private:
|
|||||||
uint64_t TypeHash;
|
uint64_t TypeHash;
|
||||||
uint32_t TypeOffset;
|
uint32_t TypeOffset;
|
||||||
public:
|
public:
|
||||||
DWARFTypeUnit(const DWARFDebugAbbrev *DA, StringRef IS, StringRef RS,
|
DWARFTypeUnit(DWARFContext &Context, const DWARFDebugAbbrev *DA,
|
||||||
StringRef SS, StringRef SOS, StringRef AOS,
|
StringRef IS, StringRef RS, StringRef SS, StringRef SOS,
|
||||||
const RelocAddrMap *M, bool LE)
|
StringRef AOS, const RelocAddrMap *M, bool LE)
|
||||||
: DWARFUnit(DA, IS, RS, SS, SOS, AOS, M, LE) {}
|
: DWARFUnit(Context, DA, IS, RS, SS, SOS, AOS, M, LE) {}
|
||||||
uint32_t getHeaderSize() const override {
|
uint32_t getHeaderSize() const override {
|
||||||
return DWARFUnit::getHeaderSize() + 12;
|
return DWARFUnit::getHeaderSize() + 12;
|
||||||
}
|
}
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
using namespace dwarf;
|
using namespace dwarf;
|
||||||
|
|
||||||
DWARFUnit::DWARFUnit(const DWARFDebugAbbrev *DA, StringRef IS, StringRef RS,
|
DWARFUnit::DWARFUnit(DWARFContext &DC, const DWARFDebugAbbrev *DA,
|
||||||
StringRef SS, StringRef SOS, StringRef AOS,
|
StringRef IS, StringRef RS, StringRef SS, StringRef SOS,
|
||||||
const RelocAddrMap *M, bool LE)
|
StringRef AOS, const RelocAddrMap *M, bool LE)
|
||||||
: Abbrev(DA), InfoSection(IS), RangeSection(RS), StringSection(SS),
|
: Context(DC), Abbrev(DA), InfoSection(IS), RangeSection(RS),
|
||||||
StringOffsetSection(SOS), AddrOffsetSection(AOS), RelocMap(M),
|
StringSection(SS), StringOffsetSection(SOS), AddrOffsetSection(AOS),
|
||||||
isLittleEndian(LE) {
|
RelocMap(M), isLittleEndian(LE) {
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,11 +22,14 @@ namespace object {
|
|||||||
class ObjectFile;
|
class ObjectFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class DWARFContext;
|
||||||
class DWARFDebugAbbrev;
|
class DWARFDebugAbbrev;
|
||||||
class StringRef;
|
class StringRef;
|
||||||
class raw_ostream;
|
class raw_ostream;
|
||||||
|
|
||||||
class DWARFUnit {
|
class DWARFUnit {
|
||||||
|
DWARFContext &Context;
|
||||||
|
|
||||||
const DWARFDebugAbbrev *Abbrev;
|
const DWARFDebugAbbrev *Abbrev;
|
||||||
StringRef InfoSection;
|
StringRef InfoSection;
|
||||||
StringRef RangeSection;
|
StringRef RangeSection;
|
||||||
@ -63,12 +66,14 @@ protected:
|
|||||||
virtual uint32_t getHeaderSize() const { return 11; }
|
virtual uint32_t getHeaderSize() const { return 11; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DWARFUnit(const DWARFDebugAbbrev *DA, StringRef IS, StringRef RS,
|
DWARFUnit(DWARFContext& Context, const DWARFDebugAbbrev *DA, StringRef IS,
|
||||||
StringRef SS, StringRef SOS, StringRef AOS, const RelocAddrMap *M,
|
StringRef RS, StringRef SS, StringRef SOS, StringRef AOS,
|
||||||
bool LE);
|
const RelocAddrMap *M, bool LE);
|
||||||
|
|
||||||
virtual ~DWARFUnit();
|
virtual ~DWARFUnit();
|
||||||
|
|
||||||
|
DWARFContext& getContext() const { return Context; }
|
||||||
|
|
||||||
StringRef getStringSection() const { return StringSection; }
|
StringRef getStringSection() const { return StringSection; }
|
||||||
StringRef getStringOffsetSection() const { return StringOffsetSection; }
|
StringRef getStringOffsetSection() const { return StringOffsetSection; }
|
||||||
void setAddrOffsetSection(StringRef AOS, uint32_t Base) {
|
void setAddrOffsetSection(StringRef AOS, uint32_t Base) {
|
||||||
|
Reference in New Issue
Block a user