summaryrefslogtreecommitdiff
path: root/test/Object/macho-invalid.test
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2016-05-02 20:28:12 +0000
committerKevin Enderby <enderby@apple.com>2016-05-02 20:28:12 +0000
commita486dcaf360f13deb0a5c485a2b4a4e4652392e8 (patch)
tree023b46c9a2c7fcc414f1dceff6a92ef46a210c69 /test/Object/macho-invalid.test
parent6b3315d64b0b05c136590496ac27470a53afe127 (diff)
Thread Expected<...> up from libObject’s getType() for symbols to allow llvm-objdump to produce a good error message.
Produce another specific error message for a malformed Mach-O file when a symbol’s section index is more than the number of sections. The existing test case in test/Object/macho-invalid.test for macho-invalid-section-index-getSectionRawName now reports the error with the message indicating that a symbol at a specific index has a bad section index and that bad section index value. Again converting interfaces to Expected<> from ErrorOr<> does involve touching a number of places. Where the existing code reported the error with a string message or an error code it was converted to do the same. Also there some were bugs in the existing code that did not deal with the old ErrorOr<> return values.  So now with Expected<> since they must be checked and the error handled, I added a TODO and a comment: "// TODO: Actually report errors helpfully" and a call something like consumeError(NameOrErr.takeError()) so the buggy code will not crash since needed to deal with the Error. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268298 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Object/macho-invalid.test')
-rw-r--r--test/Object/macho-invalid.test2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/Object/macho-invalid.test b/test/Object/macho-invalid.test
index 5d83ce762fc..038f5a840f9 100644
--- a/test/Object/macho-invalid.test
+++ b/test/Object/macho-invalid.test
@@ -55,7 +55,7 @@ RUN: | FileCheck -check-prefix INVALID-SECTION-IDX-SYMBOL-SEC-pax %s
INVALID-SECTION-IDX-SYMBOL-SEC-pax: 0000000100000000 0f 42 0010 00000065 __mh_execute_header
RUN: not llvm-objdump -t %p/Inputs/macho-invalid-section-index-getSectionRawName 2>&1 \
RUN: | FileCheck -check-prefix INVALID-SECTION-IDX-SYMBOL-SEC-objdump %s
-INVALID-SECTION-IDX-SYMBOL-SEC-objdump: Invalid data was encountered while parsing the file.
+INVALID-SECTION-IDX-SYMBOL-SEC-objdump: truncated or malformed object (bad section index: 66 for symbol at index 8)
RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-header 2>&1 | FileCheck -check-prefix INVALID-HEADER %s
INVALID-HEADER: The file was not recognized as a valid object file