summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-objdump/llvm-objdump.cpp
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2016-05-05 17:43:35 +0000
committerKevin Enderby <enderby@apple.com>2016-05-05 17:43:35 +0000
commitb34e3a1877fb095b0386c7e3675aca66ff26edeb (patch)
tree8b7feb2abd31e5cae269ee6525fa3613d142a804 /llvm/tools/llvm-objdump/llvm-objdump.cpp
parent226a734f1a21db545d24135d6714bda31a08d78b (diff)
downloadbcm5719-llvm-b34e3a1877fb095b0386c7e3675aca66ff26edeb.tar.gz
bcm5719-llvm-b34e3a1877fb095b0386c7e3675aca66ff26edeb.zip
Clean up the specific error message for a malformed Mach-O files with bad segment
load commands. The existing test case in test/Object/macho-invalid.test for macho-invalid-too-small-segment-load-command has a cmdsize of 55, while being too small also it is not a multiple of 4. So when that check is added this test case will produce a different error. So I constructed a new test case that will trigger the intended error. I also changed the error message to be consistent with the other malformed Mach-O file error messages which prints the load command index. I also removed both object_error::macho_load_segment_too_small and object_error::macho_load_segment_too_many_sections from Object/Error.h as they are not needed and can just use object_error::parse_failed and let the error message string distinguish the specific error. llvm-svn: 268652
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
-rw-r--r--llvm/tools/llvm-objdump/llvm-objdump.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index 1eb9f61c6ac..bd065986cb3 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -277,7 +277,7 @@ LLVM_ATTRIBUTE_NORETURN void llvm::report_error(StringRef File,
raw_string_ostream OS(Buf);
logAllUnhandledErrors(std::move(E), OS, "");
OS.flush();
- errs() << ToolName << ": " << Buf;
+ errs() << ToolName << ": '" << File << "': " << Buf;
exit(1);
}
@@ -1679,7 +1679,7 @@ static void DumpInput(StringRef file) {
// Attempt to open the binary.
Expected<OwningBinary<Binary>> BinaryOrErr = createBinary(file);
if (!BinaryOrErr)
- report_error(file, errorToErrorCode(BinaryOrErr.takeError()));
+ report_error(file, BinaryOrErr.takeError());
Binary &Binary = *BinaryOrErr.get().getBinary();
if (Archive *a = dyn_cast<Archive>(&Binary))
OpenPOWER on IntegriCloud