virtual ~DIContext();
/// getDWARFContext - get a context for binary DWARF data.
- static DIContext *getDWARFContext(object::ObjectFile *);
+ static DIContext *getDWARFContext(object::ObjectFile &);
virtual void dump(raw_ostream &OS, DIDumpType DumpType = DIDT_All) = 0;
DIContext::~DIContext() {}
-DIContext *DIContext::getDWARFContext(object::ObjectFile *Obj) {
+DIContext *DIContext::getDWARFContext(object::ObjectFile &Obj) {
return new DWARFContextInMemory(Obj);
}
return true;
}
-DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile *Obj)
- : IsLittleEndian(Obj->isLittleEndian()),
- AddressSize(Obj->getBytesInAddress()) {
- for (const SectionRef &Section : Obj->sections()) {
+DWARFContextInMemory::DWARFContextInMemory(object::ObjectFile &Obj)
+ : IsLittleEndian(Obj.isLittleEndian()),
+ AddressSize(Obj.getBytesInAddress()) {
+ for (const SectionRef &Section : Obj.sections()) {
StringRef name;
Section.getName(name);
StringRef data;
}
section_iterator RelocatedSection = Section.getRelocatedSection();
- if (RelocatedSection == Obj->section_end())
+ if (RelocatedSection == Obj.section_end())
continue;
StringRef RelSecName;
Reloc.getType(Type);
uint64_t SymAddr = 0;
// ELF relocations may need the symbol address
- if (Obj->isELF()) {
+ if (Obj.isELF()) {
object::symbol_iterator Sym = Reloc.getSymbol();
Sym->getAddress(SymAddr);
}
- object::RelocVisitor V(Obj->getFileFormatName());
+ object::RelocVisitor V(Obj.getFileFormatName());
// The section address is always 0 for debug sections.
object::RelocToApply R(V.visit(Type, Reloc, 0, SymAddr));
if (V.error()) {
SmallVector<SmallString<32>, 4> UncompressedSections;
public:
- DWARFContextInMemory(object::ObjectFile *);
+ DWARFContextInMemory(object::ObjectFile &);
bool isLittleEndian() const override { return IsLittleEndian; }
uint8_t getAddressSize() const override { return AddressSize; }
const Section &getInfoSection() override { return InfoSection; }
DWARFUnit::DWOHolder::DWOHolder(object::ObjectFile *DWOFile)
: DWOFile(DWOFile),
- DWOContext(cast<DWARFContext>(DIContext::getDWARFContext(DWOFile))),
+ DWOContext(cast<DWARFContext>(DIContext::getDWARFContext(*DWOFile))),
DWOU(nullptr) {
if (DWOContext->getNumDWOCompileUnits() > 0)
DWOU = DWOContext->getDWOCompileUnitAtIndex(0);
}
std::unique_ptr<ObjectFile> Obj = std::move(ObjOrErr.get());
- std::unique_ptr<DIContext> DICtx(DIContext::getDWARFContext(Obj.get()));
+ std::unique_ptr<DIContext> DICtx(DIContext::getDWARFContext(*Obj));
outs() << Filename
<< ":\tfile format " << Obj->getFileFormatName() << "\n\n";
}
// Setup the DIContext
- diContext.reset(DIContext::getDWARFContext(DbgObj));
+ diContext.reset(DIContext::getDWARFContext(*DbgObj));
}
for (unsigned SectIdx = 0; SectIdx != Sections.size(); SectIdx++) {
Dyld.resolveRelocations();
std::unique_ptr<DIContext> Context(
- DIContext::getDWARFContext(LoadedObject->getObjectFile()));
+ DIContext::getDWARFContext(*LoadedObject->getObjectFile()));
// Use symbol info to iterate functions in the object.
for (object::symbol_iterator I = LoadedObject->begin_symbols(),
Modules.insert(make_pair(ModuleName, (ModuleInfo *)nullptr));
return nullptr;
}
- DIContext *Context = DIContext::getDWARFContext(DbgObj);
+ DIContext *Context = DIContext::getDWARFContext(*DbgObj);
assert(Context);
ModuleInfo *Info = new ModuleInfo(Obj, Context);
Modules.insert(make_pair(ModuleName, Info));