[llvm-objdump] errorToErrorCode+message -> toString

For test/Object/elf-invalid-phdr.test, the intended error message got lost due to errorToErrorCode().

llvm-svn: 359166
This commit is contained in:
Fangrui Song 2019-04-25 04:31:26 +00:00
parent 12450d51a2
commit 3458ff361a
2 changed files with 4 additions and 5 deletions

View File

@ -23,4 +23,4 @@
RUN: not llvm-objdump -private-headers %p/Inputs/invalid-phdr.elf 2>&1 \
RUN: | FileCheck %s
CHECK: LLVM ERROR: Invalid data was encountered while parsing the file
CHECK: LLVM ERROR: program headers longer than binary

View File

@ -131,7 +131,7 @@ static uint64_t getSectionLMA(const ELFFile<ELFT> *Obj,
const object::ELFSectionRef &Sec) {
auto PhdrRangeOrErr = Obj->program_headers();
if (!PhdrRangeOrErr)
report_fatal_error(errorToErrorCode(PhdrRangeOrErr.takeError()).message());
report_fatal_error(toString(PhdrRangeOrErr.takeError()));
// Search for a PT_LOAD segment containing the requested section. Use this
// segment's p_addr to calculate the section's LMA.
@ -178,7 +178,7 @@ void printDynamicSection(const ELFFile<ELFT> *Elf, StringRef Filename) {
outs() << (Data + Dyn.d_un.d_val) << "\n";
continue;
}
warn(errorToErrorCode(StrTabOrErr.takeError()).message());
warn(toString(StrTabOrErr.takeError()));
consumeError(StrTabOrErr.takeError());
}
outs() << format(Fmt, (uint64_t)Dyn.d_un.d_val);
@ -189,8 +189,7 @@ template <class ELFT> void printProgramHeaders(const ELFFile<ELFT> *o) {
outs() << "Program Header:\n";
auto ProgramHeaderOrError = o->program_headers();
if (!ProgramHeaderOrError)
report_fatal_error(
errorToErrorCode(ProgramHeaderOrError.takeError()).message());
report_fatal_error(toString(ProgramHeaderOrError.takeError()));
for (const typename ELFT::Phdr &Phdr : *ProgramHeaderOrError) {
switch (Phdr.p_type) {
case ELF::PT_DYNAMIC: