<< " remaining in buffer";
return ;
}
- printUnwindCode(ArrayRef<UnwindCode>(I, E));
+ printUnwindCode(makeArrayRef(I, E));
I += UsedSlots;
}
}
resolveSectionAndAddress(const COFFObjectFile *Obj, const SymbolRef &Sym,
const coff_section *&ResolvedSection,
uint64_t &ResolvedAddr) {
- if (std::error_code EC = Sym.getAddress(ResolvedAddr))
+ ErrorOr<uint64_t> ResolvedAddrOrErr = Sym.getAddress();
+ if (std::error_code EC = ResolvedAddrOrErr.getError())
return EC;
- section_iterator iter(Obj->section_begin());
- if (std::error_code EC = Sym.getSection(iter))
+ ResolvedAddr = *ResolvedAddrOrErr;
+ ErrorOr<section_iterator> Iter = Sym.getSection();
+ if (std::error_code EC = Iter.getError())
return EC;
- ResolvedSection = Obj->getCOFFSection(*iter);
+ ResolvedSection = Obj->getCOFFSection(**Iter);
return std::error_code();
}
for (std::vector<RelocationRef>::const_iterator I = Rels.begin(),
E = Rels.end();
I != E; ++I) {
- uint64_t Ofs;
- if (std::error_code EC = I->getOffset(Ofs))
- return EC;
+ uint64_t Ofs = I->getOffset();
if (Ofs == Offset) {
Sym = *I->getSymbol();
return std::error_code();
SymbolRef Sym;
if (std::error_code EC = resolveSymbol(Rels, Offset, Sym))
return EC;
- if (std::error_code EC = Sym.getName(Name))
+ ErrorOr<StringRef> NameOrErr = Sym.getName();
+ if (std::error_code EC = NameOrErr.getError())
return EC;
+ Name = *NameOrErr;
return std::error_code();
}
return;
const pe32_header *PE32Header;
- if (error(Obj->getPE32Header(PE32Header)))
- return;
+ error(Obj->getPE32Header(PE32Header));
uint32_t ImageBase = PE32Header->ImageBase;
uintptr_t IntPtr = 0;
- if (error(Obj->getVaPtr(TableVA, IntPtr)))
- return;
+ error(Obj->getVaPtr(TableVA, IntPtr));
const support::ulittle32_t *P = (const support::ulittle32_t *)IntPtr;
outs() << "SEH Table:";
for (int I = 0; I < Count; ++I)
static void printLoadConfiguration(const COFFObjectFile *Obj) {
// Skip if it's not executable.
const pe32_header *PE32Header;
- if (error(Obj->getPE32Header(PE32Header)))
- return;
+ error(Obj->getPE32Header(PE32Header));
if (!PE32Header)
return;
return;
const data_directory *DataDir;
- if (error(Obj->getDataDirectory(COFF::LOAD_CONFIG_TABLE, DataDir)))
- return;
+ error(Obj->getDataDirectory(COFF::LOAD_CONFIG_TABLE, DataDir));
uintptr_t IntPtr = 0;
if (DataDir->RelativeVirtualAddress == 0)
return;
- if (error(Obj->getRvaPtr(DataDir->RelativeVirtualAddress, IntPtr)))
- return;
+ error(Obj->getRvaPtr(DataDir->RelativeVirtualAddress, IntPtr));
auto *LoadConf = reinterpret_cast<const coff_load_configuration32 *>(IntPtr);
outs() << "Load configuration:"
const RuntimeFunction *&RFStart, int &NumRFs) {
for (const SectionRef &Section : Obj->sections()) {
StringRef Name;
- if (error(Section.getName(Name)))
- continue;
+ error(Section.getName(Name));
if (Name != ".pdata")
continue;
std::sort(Rels.begin(), Rels.end(), RelocAddressLess);
ArrayRef<uint8_t> Contents;
- if (error(Obj->getSectionContents(Pdata, Contents)))
- continue;
+ error(Obj->getSectionContents(Pdata, Contents));
if (Contents.empty())
continue;
if (UI->NumCodes)
outs() << " Unwind Codes:\n";
- printAllUnwindCodes(ArrayRef<UnwindCode>(&UI->UnwindCodes[0], UI->NumCodes));
+ printAllUnwindCodes(makeArrayRef(&UI->UnwindCodes[0], UI->NumCodes));
outs() << "\n";
outs().flush();
ArrayRef<uint8_t> XContents;
uint64_t UnwindInfoOffset = 0;
- if (error(getSectionContents(
+ error(getSectionContents(
Obj, Rels, SectionOffset +
/*offsetof(RuntimeFunction, UnwindInfoOffset)*/ 8,
- XContents, UnwindInfoOffset)))
- return;
+ XContents, UnwindInfoOffset));
if (XContents.empty())
return;