mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[llvm-readobj] - Remove deprecated unwrapOrError(Expected<T> EO).
This patch changes the code to use a modern unwrapOrError(StringRef Input, Expected<T> EO) version that contains the input source name and removes the deprecated version. Differential revision: https://reviews.llvm.org/D65946 llvm-svn: 368428
This commit is contained in:
parent
c802973c73
commit
da9ac1c3d1
@ -109,9 +109,9 @@ Symbols:
|
||||
## Check that llvm-readobj reports an error if .symtab has an invalid sh_entsize.
|
||||
|
||||
# RUN: yaml2obj %s --docnum=6 -o %t6
|
||||
# RUN: not llvm-readobj --symbols %t6 2>&1 | FileCheck --check-prefix=INVALID-SYM-SIZE %s
|
||||
# RUN: not llvm-readobj --symbols %t6 2>&1 | FileCheck -DFILE=%t6 --check-prefix=INVALID-SYM-SIZE %s
|
||||
|
||||
# INVALID-SYM-SIZE: error: section [index 1] has an invalid sh_entsize: 32
|
||||
# INVALID-SYM-SIZE: error: '[[FILE]]': section [index 1] has an invalid sh_entsize: 32
|
||||
|
||||
--- !ELF
|
||||
FileHeader:
|
||||
@ -150,9 +150,9 @@ DynamicSymbols:
|
||||
## which is greater than number of sections.
|
||||
|
||||
# RUN: yaml2obj %s --docnum=8 -o %t8
|
||||
# RUN: not llvm-readobj --symbols %t8 2>&1 | FileCheck --check-prefix=INVALID-SYMTAB-LINK %s
|
||||
# RUN: not llvm-readobj --symbols %t8 2>&1 | FileCheck -DFILE=%t8 --check-prefix=INVALID-SYMTAB-LINK %s
|
||||
|
||||
# INVALID-SYMTAB-LINK: error: invalid section index: 255
|
||||
# INVALID-SYMTAB-LINK: error: '[[FILE]]': invalid section index: 255
|
||||
|
||||
--- !ELF
|
||||
FileHeader:
|
||||
@ -185,9 +185,9 @@ FileHeader:
|
||||
## that is not a multiple of sh_entsize.
|
||||
|
||||
# RUN: yaml2obj %s --docnum=10 -o %t10
|
||||
# RUN: not llvm-readobj --symbols %t10 2>&1 | FileCheck --check-prefix=INVALID-SYMTAB-SIZE %s
|
||||
# RUN: not llvm-readobj --symbols %t10 2>&1 | FileCheck -DFILE=%t10 --check-prefix=INVALID-SYMTAB-SIZE %s
|
||||
|
||||
# INVALID-SYMTAB-SIZE: error: section [index 1] has an invalid sh_size (1) which is not a multiple of its sh_entsize (24)
|
||||
# INVALID-SYMTAB-SIZE: error: '[[FILE]]': section [index 1] has an invalid sh_size (1) which is not a multiple of its sh_entsize (24)
|
||||
|
||||
--- !ELF
|
||||
FileHeader:
|
||||
@ -224,27 +224,27 @@ Sections:
|
||||
## Check that llvm-readobj reports an error if the e_phentsize field is broken.
|
||||
|
||||
# RUN: not llvm-readobj --program-headers %p/Inputs/invalid-e_shnum.elf 2>&1 | \
|
||||
# RUN: FileCheck --check-prefix=INVALID-PH-ENTSIZE %s
|
||||
# RUN: FileCheck -DFILE=%p/Inputs/invalid-e_shnum.elf --check-prefix=INVALID-PH-ENTSIZE %s
|
||||
|
||||
# INVALID-PH-ENTSIZE: error: invalid e_phentsize: 12336
|
||||
# INVALID-PH-ENTSIZE: error: '[[FILE]]': invalid e_phentsize: 12336
|
||||
|
||||
## Check that llvm-readobj reports an error when we have no SHT_SYMTAB_SHNDX section,
|
||||
## but have a symbol referencing it.
|
||||
|
||||
# RUN: not llvm-readobj --symbols %p/Inputs/invalid-ext-symtab-index.elf-x86-64 2>&1 | \
|
||||
# RUN: FileCheck --check-prefix=INVALID-EXT-SYMTAB-INDEX %s
|
||||
# RUN: FileCheck -DFILE=%p/Inputs/invalid-ext-symtab-index.elf-x86-64 --check-prefix=INVALID-EXT-SYMTAB-INDEX %s
|
||||
|
||||
# INVALID-EXT-SYMTAB-INDEX: error: extended symbol index (0) is past the end of the SHT_SYMTAB_SHNDX section of size 0
|
||||
# INVALID-EXT-SYMTAB-INDEX: error: '[[FILE]]': extended symbol index (0) is past the end of the SHT_SYMTAB_SHNDX section of size 0
|
||||
|
||||
## Check that llvm-readobj reports an error if a relocation section
|
||||
## has a broken sh_offset (past the end of the file).
|
||||
|
||||
# RUN: yaml2obj %s --docnum=12 -o %t12
|
||||
# RUN: yaml2obj %s --docnum=13 -o %t13
|
||||
# RUN: not llvm-readobj -r %t12 2>&1 | FileCheck --check-prefix=INVALID-RELOC-SH-OFFSET %s
|
||||
# RUN: not llvm-readobj -r %t13 2>&1 | FileCheck --check-prefix=INVALID-RELOC-SH-OFFSET %s
|
||||
# RUN: not llvm-readobj -r %t12 2>&1 | FileCheck -DFILE=%t12 --check-prefix=INVALID-RELOC-SH-OFFSET %s
|
||||
# RUN: not llvm-readobj -r %t13 2>&1 | FileCheck -DFILE=%t13 --check-prefix=INVALID-RELOC-SH-OFFSET %s
|
||||
|
||||
# INVALID-RELOC-SH-OFFSET: error: section [index 1] has a sh_offset (0x10000) + sh_size (0x0) that cannot be represented
|
||||
# INVALID-RELOC-SH-OFFSET: error: '[[FILE]]': section [index 1] has a sh_offset (0x10000) + sh_size (0x0) that cannot be represented
|
||||
|
||||
--- !ELF
|
||||
FileHeader:
|
||||
@ -272,9 +272,9 @@ Sections:
|
||||
## so large that sh_offset + sh_size overflows the platform address size type.
|
||||
|
||||
# RUN: yaml2obj %s --docnum=14 -o %t14
|
||||
# RUN: not llvm-readobj --symbols %t14 2>&1 | FileCheck --check-prefix=INVALID-SECTION-SIZE2 %s
|
||||
# RUN: not llvm-readobj --symbols %t14 2>&1 | FileCheck -DFILE=%t14 --check-prefix=INVALID-SECTION-SIZE2 %s
|
||||
|
||||
# INVALID-SECTION-SIZE2: error: section [index 1] has a sh_offset (0xffffffff) + sh_size (0x27) that cannot be represented
|
||||
# INVALID-SECTION-SIZE2: error: '[[FILE]]': section [index 1] has a sh_offset (0xffffffff) + sh_size (0x27) that cannot be represented
|
||||
|
||||
--- !ELF
|
||||
FileHeader:
|
||||
@ -307,9 +307,9 @@ FileHeader:
|
||||
## incorrect (too large) symbol index.
|
||||
|
||||
# RUN: yaml2obj %s --docnum=16 -o %t16
|
||||
# RUN: not llvm-readobj -r %t16 2>&1 | FileCheck --check-prefix=INVALID-REL-SYM %s
|
||||
# RUN: not llvm-readobj -r %t16 2>&1 | FileCheck -DFILE=%t16 --check-prefix=INVALID-REL-SYM %s
|
||||
|
||||
# INVALID-REL-SYM: error: unable to access section [index 2] data at 0x18000180: offset goes past the end of file
|
||||
# INVALID-REL-SYM: error: '[[FILE]]': unable to access section [index 2] data at 0x18000180: offset goes past the end of file
|
||||
|
||||
--- !ELF
|
||||
FileHeader:
|
||||
@ -363,9 +363,9 @@ Sections:
|
||||
|
||||
# RUN: yaml2obj %s --docnum=18 -o %t18
|
||||
# RUN: not llvm-readobj --sections --section-data %t18 2>&1 \
|
||||
# RUN: | FileCheck --check-prefix=BROKEN-SECSHOFFSET %s
|
||||
# RUN: | FileCheck -DFILE=%t18 --check-prefix=BROKEN-SECSHOFFSET %s
|
||||
|
||||
# BROKEN-SECSHOFFSET: error: section [index 1] has a sh_offset (0xffff0000) + sh_size (0x0) that cannot be represented
|
||||
# BROKEN-SECSHOFFSET: error: '[[FILE]]': section [index 1] has a sh_offset (0xffff0000) + sh_size (0x0) that cannot be represented
|
||||
|
||||
--- !ELF
|
||||
FileHeader:
|
||||
@ -382,9 +382,9 @@ Sections:
|
||||
## offset goes past the end of the symbol string table.
|
||||
|
||||
# RUN: yaml2obj %s --docnum=19 -o %t19
|
||||
# RUN: not llvm-readobj --symbols %t19 2>&1 | FileCheck --check-prefix=INVALID-SYM-NAME %s
|
||||
# RUN: not llvm-readobj --symbols %t19 2>&1 | FileCheck -DFILE=%t19 --check-prefix=INVALID-SYM-NAME %s
|
||||
|
||||
# INVALID-SYM-NAME: error: Invalid data was encountered while parsing the file
|
||||
# INVALID-SYM-NAME: error: '[[FILE]]': Invalid data was encountered while parsing the file
|
||||
|
||||
--- !ELF
|
||||
FileHeader:
|
||||
@ -424,9 +424,9 @@ DynamicSymbols:
|
||||
## Check llvm-readobj reports it.
|
||||
|
||||
# RUN: not llvm-readobj -l %p/Inputs/corrupt-invalid-phentsize.elf.x86-64 2>&1 \
|
||||
# RUN: | FileCheck --check-prefix=PHENTSIZE %s
|
||||
# RUN: | FileCheck -DFILE=%p/Inputs/corrupt-invalid-phentsize.elf.x86-64 --check-prefix=PHENTSIZE %s
|
||||
|
||||
# PHENTSIZE: error: invalid e_phentsize: 57
|
||||
# PHENTSIZE: error: '[[FILE]]': invalid e_phentsize: 57
|
||||
|
||||
## The dynamic table contains DT_STRTAB with a value that is not in any loadable segment.
|
||||
## Check llvm-readobj reports it.
|
||||
@ -631,9 +631,9 @@ Symbols:
|
||||
## sh_entsize value (3 instead of 2) when trying to access the entries.
|
||||
|
||||
# RUN: yaml2obj %s --docnum=30 -o %t30
|
||||
# RUN: not llvm-readobj -V %t30 2>&1 | FileCheck --check-prefix=INVALID-VER-SHENTSIZE %s
|
||||
# RUN: not llvm-readobj -V %t30 2>&1 | FileCheck -DFILE=%t30 --check-prefix=INVALID-VER-SHENTSIZE %s
|
||||
|
||||
# INVALID-VER-SHENTSIZE: error: section [index 1] has invalid sh_entsize: expected 2, but got 3
|
||||
# INVALID-VER-SHENTSIZE: error: '[[FILE]]': section [index 1] has invalid sh_entsize: expected 2, but got 3
|
||||
|
||||
--- !ELF
|
||||
FileHeader:
|
||||
|
@ -1,7 +1,7 @@
|
||||
// REQUIRES: x86-registered-target
|
||||
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | not llvm-readobj -r - 2>&1 | FileCheck %s
|
||||
|
||||
// CHECK: error: invalid packed relocation header
|
||||
// CHECK: error: '<stdin>': invalid packed relocation header
|
||||
|
||||
.section .rela.dyn, "a", @0x60000001
|
||||
.ascii "APS9"
|
||||
|
@ -1,7 +1,7 @@
|
||||
// REQUIRES: x86-registered-target
|
||||
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | not llvm-readobj -r - 2>&1 | FileCheck %s
|
||||
|
||||
// CHECK: error: malformed sleb128, extends past end
|
||||
// CHECK: error: '<stdin>': malformed sleb128, extends past end
|
||||
|
||||
.section .rela.dyn, "a", @0x60000001
|
||||
.ascii "APS2"
|
||||
|
@ -1,7 +1,7 @@
|
||||
// REQUIRES: x86-registered-target
|
||||
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | not llvm-readobj -r - 2>&1 | FileCheck %s
|
||||
|
||||
// CHECK: error: malformed sleb128, extends past end
|
||||
// CHECK: error: '<stdin>': malformed sleb128, extends past end
|
||||
|
||||
.section .rela.dyn, "a", @0x60000001
|
||||
.ascii "APS2"
|
||||
|
@ -1,7 +1,7 @@
|
||||
// REQUIRES: x86-registered-target
|
||||
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | not llvm-readobj -r - 2>&1 | FileCheck %s
|
||||
|
||||
// CHECK: error: malformed sleb128, extends past end
|
||||
// CHECK: error: '<stdin>': malformed sleb128, extends past end
|
||||
|
||||
.section .rela.dyn, "a", @0x60000001
|
||||
.ascii "APS2"
|
||||
|
@ -1,7 +1,7 @@
|
||||
// REQUIRES: x86-registered-target
|
||||
// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | not llvm-readobj -r - 2>&1 | FileCheck %s
|
||||
|
||||
// CHECK: error: relocation group unexpectedly large
|
||||
// CHECK: error: '<stdin>': relocation group unexpectedly large
|
||||
|
||||
.section .rela.dyn, "a", @0x60000001
|
||||
.ascii "APS2"
|
||||
|
@ -3,9 +3,9 @@
|
||||
## but no SHT_SYMTAB_SHNDX section is defined.
|
||||
|
||||
# RUN: yaml2obj --docnum=1 %s -o %t1
|
||||
# RUN: not llvm-readobj --symbols 2>&1 %t1 | FileCheck %s --check-prefix=CASE1
|
||||
# RUN: not llvm-readobj --symbols 2>&1 %t1 | FileCheck -DFILE=%t1 %s --check-prefix=CASE1
|
||||
|
||||
# CASE1: error: extended symbol index (1) is past the end of the SHT_SYMTAB_SHNDX section of size 0
|
||||
# CASE1: error: '[[FILE]]': extended symbol index (1) is past the end of the SHT_SYMTAB_SHNDX section of size 0
|
||||
|
||||
--- !ELF
|
||||
FileHeader:
|
||||
@ -71,9 +71,9 @@ Symbols:
|
||||
## which is larger than the total number of sections in the file).
|
||||
|
||||
# RUN: yaml2obj --docnum=3 %s -o %t3
|
||||
# RUN: not llvm-readobj --symbols 2>&1 %t3 | FileCheck %s --check-prefix=CASE3
|
||||
# RUN: not llvm-readobj --symbols 2>&1 %t3 | FileCheck %s -DFILE=%t3 --check-prefix=CASE3
|
||||
|
||||
# CASE3: error: invalid section index: 255
|
||||
# CASE3: error: '[[FILE]]': invalid section index: 255
|
||||
|
||||
--- !ELF
|
||||
FileHeader:
|
||||
|
@ -329,6 +329,7 @@ class PrinterContext {
|
||||
|
||||
ScopedPrinter &SW;
|
||||
const object::ELFFile<ET> *ELF;
|
||||
StringRef FileName;
|
||||
const Elf_Shdr *Symtab;
|
||||
ArrayRef<Elf_Word> ShndxTable;
|
||||
|
||||
@ -352,8 +353,8 @@ class PrinterContext {
|
||||
|
||||
public:
|
||||
PrinterContext(ScopedPrinter &SW, const object::ELFFile<ET> *ELF,
|
||||
const Elf_Shdr *Symtab)
|
||||
: SW(SW), ELF(ELF), Symtab(Symtab) {}
|
||||
StringRef FileName, const Elf_Shdr *Symtab)
|
||||
: SW(SW), ELF(ELF), FileName(FileName), Symtab(Symtab) {}
|
||||
|
||||
void PrintUnwindInformation() const;
|
||||
};
|
||||
@ -372,7 +373,7 @@ PrinterContext<ET>::FunctionAtAddress(unsigned Section,
|
||||
error(StrTableOrErr.takeError());
|
||||
StringRef StrTable = *StrTableOrErr;
|
||||
|
||||
for (const Elf_Sym &Sym : unwrapOrError(ELF->symbols(Symtab)))
|
||||
for (const Elf_Sym &Sym : unwrapOrError(FileName, ELF->symbols(Symtab)))
|
||||
if (Sym.st_shndx == Section && Sym.st_value == Address &&
|
||||
Sym.getType() == ELF::STT_FUNC) {
|
||||
auto NameOrErr = Sym.getName(StrTable);
|
||||
@ -398,7 +399,7 @@ PrinterContext<ET>::FindExceptionTable(unsigned IndexSectionIndex,
|
||||
/// handling table. Use this symbol to recover the actual exception handling
|
||||
/// table.
|
||||
|
||||
for (const Elf_Shdr &Sec : unwrapOrError(ELF->sections())) {
|
||||
for (const Elf_Shdr &Sec : unwrapOrError(FileName, ELF->sections())) {
|
||||
if (Sec.sh_type != ELF::SHT_REL || Sec.sh_info != IndexSectionIndex)
|
||||
continue;
|
||||
|
||||
@ -407,7 +408,7 @@ PrinterContext<ET>::FindExceptionTable(unsigned IndexSectionIndex,
|
||||
error(SymTabOrErr.takeError());
|
||||
const Elf_Shdr *SymTab = *SymTabOrErr;
|
||||
|
||||
for (const Elf_Rel &R : unwrapOrError(ELF->rels(&Sec))) {
|
||||
for (const Elf_Rel &R : unwrapOrError(FileName, ELF->rels(&Sec))) {
|
||||
if (R.r_offset != static_cast<unsigned>(IndexTableOffset))
|
||||
continue;
|
||||
|
||||
@ -417,7 +418,7 @@ PrinterContext<ET>::FindExceptionTable(unsigned IndexSectionIndex,
|
||||
RelA.r_addend = 0;
|
||||
|
||||
const Elf_Sym *Symbol =
|
||||
unwrapOrError(ELF->getRelocationSymbol(&RelA, SymTab));
|
||||
unwrapOrError(FileName, ELF->getRelocationSymbol(&RelA, SymTab));
|
||||
|
||||
auto Ret = ELF->getSection(Symbol, SymTab, ShndxTable);
|
||||
if (!Ret)
|
||||
@ -570,7 +571,7 @@ void PrinterContext<ET>::PrintUnwindInformation() const {
|
||||
DictScope UI(SW, "UnwindInformation");
|
||||
|
||||
int SectionIndex = 0;
|
||||
for (const Elf_Shdr &Sec : unwrapOrError(ELF->sections())) {
|
||||
for (const Elf_Shdr &Sec : unwrapOrError(FileName, ELF->sections())) {
|
||||
if (Sec.sh_type == ELF::SHT_ARM_EXIDX) {
|
||||
DictScope UIT(SW, "UnwindIndexTable");
|
||||
|
||||
|
@ -937,7 +937,8 @@ void COFFDumper::initializeFileAndStringTables(BinaryStreamReader &Reader) {
|
||||
|
||||
void COFFDumper::printCodeViewSymbolSection(StringRef SectionName,
|
||||
const SectionRef &Section) {
|
||||
StringRef SectionContents = unwrapOrError(Section.getContents());
|
||||
StringRef SectionContents =
|
||||
unwrapOrError(Obj->getFileName(), Section.getContents());
|
||||
StringRef Data = SectionContents;
|
||||
|
||||
SmallVector<StringRef, 10> FunctionNames;
|
||||
@ -1226,7 +1227,7 @@ void COFFDumper::mergeCodeViewTypes(MergingTypeTableBuilder &CVIDs,
|
||||
StringRef SectionName;
|
||||
error(S.getName(SectionName));
|
||||
if (SectionName == ".debug$T") {
|
||||
StringRef Data = unwrapOrError(S.getContents());
|
||||
StringRef Data = unwrapOrError(Obj->getFileName(), S.getContents());
|
||||
uint32_t Magic;
|
||||
error(consume(Data, Magic));
|
||||
if (Magic != 4)
|
||||
@ -1262,7 +1263,7 @@ void COFFDumper::printCodeViewTypeSection(StringRef SectionName,
|
||||
ListScope D(W, "CodeViewTypes");
|
||||
W.printNumber("Section", SectionName, Obj->getSectionID(Section));
|
||||
|
||||
StringRef Data = unwrapOrError(Section.getContents());
|
||||
StringRef Data = unwrapOrError(Obj->getFileName(), Section.getContents());
|
||||
if (opts::CodeViewSubsectionBytes)
|
||||
W.printBinaryBlock("Data", Data);
|
||||
|
||||
@ -1322,7 +1323,7 @@ void COFFDumper::printSectionHeaders() {
|
||||
|
||||
if (opts::SectionData &&
|
||||
!(Section->Characteristics & COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA)) {
|
||||
StringRef Data = unwrapOrError(Sec.getContents());
|
||||
StringRef Data = unwrapOrError(Obj->getFileName(), Sec.getContents());
|
||||
W.printBinaryBlock("SectionData", Data);
|
||||
}
|
||||
}
|
||||
@ -1670,7 +1671,8 @@ void COFFDumper::printCOFFDirectives() {
|
||||
if (Name != ".drectve")
|
||||
continue;
|
||||
|
||||
StringRef Contents = unwrapOrError(Section.getContents());
|
||||
StringRef Contents =
|
||||
unwrapOrError(Obj->getFileName(), Section.getContents());
|
||||
W.printString("Directive(s)", Contents);
|
||||
}
|
||||
}
|
||||
@ -1709,11 +1711,11 @@ void COFFDumper::printCOFFResources() {
|
||||
if (!Name.startswith(".rsrc"))
|
||||
continue;
|
||||
|
||||
StringRef Ref = unwrapOrError(S.getContents());
|
||||
StringRef Ref = unwrapOrError(Obj->getFileName(), S.getContents());
|
||||
|
||||
if ((Name == ".rsrc") || (Name == ".rsrc$01")) {
|
||||
ResourceSectionRef RSF(Ref);
|
||||
auto &BaseTable = unwrapOrError(RSF.getBaseTable());
|
||||
auto &BaseTable = unwrapOrError(Obj->getFileName(), RSF.getBaseTable());
|
||||
W.printNumber("Total Number of Resources",
|
||||
countTotalTableEntries(RSF, BaseTable, "Type"));
|
||||
W.printHex("Base Table Address",
|
||||
@ -1741,7 +1743,8 @@ COFFDumper::countTotalTableEntries(ResourceSectionRef RSF,
|
||||
NextLevel = "Language";
|
||||
else
|
||||
NextLevel = "Name";
|
||||
auto &NextTable = unwrapOrError(RSF.getEntrySubDir(Entry));
|
||||
auto &NextTable =
|
||||
unwrapOrError(Obj->getFileName(), RSF.getEntrySubDir(Entry));
|
||||
TotalEntries += countTotalTableEntries(RSF, NextTable, NextLevel);
|
||||
} else {
|
||||
TotalEntries += 1;
|
||||
@ -1767,7 +1770,7 @@ void COFFDumper::printResourceDirectoryTable(
|
||||
raw_svector_ostream OS(IDStr);
|
||||
if (i < Table.NumberOfNameEntries) {
|
||||
ArrayRef<UTF16> RawEntryNameString =
|
||||
unwrapOrError(RSF.getEntryNameString(Entry));
|
||||
unwrapOrError(Obj->getFileName(), RSF.getEntryNameString(Entry));
|
||||
std::vector<UTF16> EndianCorrectedNameString;
|
||||
if (llvm::sys::IsBigEndianHost) {
|
||||
EndianCorrectedNameString.resize(RawEntryNameString.size() + 1);
|
||||
@ -1799,7 +1802,8 @@ void COFFDumper::printResourceDirectoryTable(
|
||||
NextLevel = "Language";
|
||||
else
|
||||
NextLevel = "Name";
|
||||
auto &NextTable = unwrapOrError(RSF.getEntrySubDir(Entry));
|
||||
auto &NextTable =
|
||||
unwrapOrError(Obj->getFileName(), RSF.getEntrySubDir(Entry));
|
||||
printResourceDirectoryTable(RSF, NextTable, NextLevel);
|
||||
} else {
|
||||
W.printHex("Entry Offset", Entry.Offset.value());
|
||||
@ -1837,7 +1841,8 @@ void COFFDumper::printStackMap() const {
|
||||
if (StackMapSection == object::SectionRef())
|
||||
return;
|
||||
|
||||
StringRef StackMapContents = unwrapOrError(StackMapSection.getContents());
|
||||
StringRef StackMapContents =
|
||||
unwrapOrError(Obj->getFileName(), StackMapSection.getContents());
|
||||
ArrayRef<uint8_t> StackMapContentsArray =
|
||||
arrayRefFromStringRef(StackMapContents);
|
||||
|
||||
@ -1863,7 +1868,8 @@ void COFFDumper::printAddrsig() {
|
||||
if (AddrsigSection == object::SectionRef())
|
||||
return;
|
||||
|
||||
StringRef AddrsigContents = unwrapOrError(AddrsigSection.getContents());
|
||||
StringRef AddrsigContents =
|
||||
unwrapOrError(Obj->getFileName(), AddrsigSection.getContents());
|
||||
ArrayRef<uint8_t> AddrsigContentsArray(AddrsigContents.bytes_begin(),
|
||||
AddrsigContents.size());
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -484,7 +484,8 @@ void MachODumper::printSectionHeaders(const MachOObjectFile *Obj) {
|
||||
}
|
||||
|
||||
if (opts::SectionData && !Section.isBSS())
|
||||
W.printBinaryBlock("SectionData", unwrapOrError(Section.getContents()));
|
||||
W.printBinaryBlock("SectionData", unwrapOrError(Obj->getFileName(),
|
||||
Section.getContents()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -653,7 +654,8 @@ void MachODumper::printStackMap() const {
|
||||
if (StackMapSection == object::SectionRef())
|
||||
return;
|
||||
|
||||
StringRef StackMapContents = unwrapOrError(StackMapSection.getContents());
|
||||
StringRef StackMapContents =
|
||||
unwrapOrError(Obj->getFileName(), StackMapSection.getContents());
|
||||
ArrayRef<uint8_t> StackMapContentsArray =
|
||||
arrayRefFromStringRef(StackMapContents);
|
||||
|
||||
|
@ -84,7 +84,8 @@ void ObjDumper::printSectionsAsString(const object::ObjectFile *Obj,
|
||||
First = false;
|
||||
W.startLine() << "String dump of section '" << SectionName << "':\n";
|
||||
|
||||
StringRef SectionContent = unwrapOrError(Section.getContents());
|
||||
StringRef SectionContent =
|
||||
unwrapOrError(Obj->getFileName(), Section.getContents());
|
||||
|
||||
const uint8_t *SecContent = SectionContent.bytes_begin();
|
||||
const uint8_t *CurrentWord = SecContent;
|
||||
@ -117,7 +118,8 @@ void ObjDumper::printSectionsAsHex(const object::ObjectFile *Obj,
|
||||
First = false;
|
||||
W.startLine() << "Hex dump of section '" << SectionName << "':\n";
|
||||
|
||||
StringRef SectionContent = unwrapOrError(Section.getContents());
|
||||
StringRef SectionContent =
|
||||
unwrapOrError(Obj->getFileName(), Section.getContents());
|
||||
const uint8_t *SecContent = SectionContent.bytes_begin();
|
||||
const uint8_t *SecEnd = SecContent + SectionContent.size();
|
||||
|
||||
|
@ -33,17 +33,6 @@ namespace llvm {
|
||||
return std::move(*E);
|
||||
}
|
||||
|
||||
// TODO: This one is deprecated. Use one with a Input name below.
|
||||
template <class T> T unwrapOrError(Expected<T> EO) {
|
||||
if (EO)
|
||||
return *EO;
|
||||
std::string Buf;
|
||||
raw_string_ostream OS(Buf);
|
||||
logAllUnhandledErrors(EO.takeError(), OS);
|
||||
OS.flush();
|
||||
reportError(Buf);
|
||||
}
|
||||
|
||||
template <class T> T unwrapOrError(StringRef Input, Expected<T> EO) {
|
||||
if (EO)
|
||||
return *EO;
|
||||
|
Loading…
x
Reference in New Issue
Block a user