#
7bd8d994 |
| 02-May-2016 |
Kevin Enderby <enderby@apple.com> |
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
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.
llvm-svn: 268298
show more ...
|
#
81e8b7d9 |
| 20-Apr-2016 |
Kevin Enderby <enderby@apple.com> |
Thread Expected<...> up from libObject’s getName() 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
Thread Expected<...> up from libObject’s getName() 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 string index is past the end of the string table. The existing test case in test/Object/macho-invalid.test for macho-invalid-symbol-name-past-eof now reports the error with the message indicating that a symbol at a specific index has a bad sting index and that bad string 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. There is some code for this that could be factored into a routine but I would like to leave that for the code owners post-commit to do as they want for handling an llvm::Error. An example of how this could be done is shown in the diff in lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h which had a Check() routine already for std::error_code so I added one like it for llvm::Error .
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.
Note there fixes needed to lld that goes along with this that I will commit right after this. So expect lld not to built after this commit and before the next one.
llvm-svn: 266919
show more ...
|
#
3fcdf6ae |
| 06-Apr-2016 |
Kevin Enderby <enderby@apple.com> |
Thread Expected<...> up from createMachOObjectFile() to allow llvm-objdump to produce a real error message
Produce the first specific error message for a malformed Mach-O file describing the problem
Thread Expected<...> up from createMachOObjectFile() to allow llvm-objdump to produce a real error message
Produce the first specific error message for a malformed Mach-O file describing the problem instead of the generic message for object_error::parse_failed of "Invalid data was encountered while parsing the file”. Many more good error messages will follow after this first one.
This is built on Lang Hames’ great work of adding the ’Error' class for structured error handling and threading Error through MachOObjectFile construction. And making createMachOObjectFile return Expected<...> .
So to to get the error to the llvm-obdump tool, I changed the stack of these methods to also return Expected<...> :
object::ObjectFile::createObjectFile() object::SymbolicFile::createSymbolicFile() object::createBinary()
Then finally in ParseInputMachO() in MachODump.cpp the error can be reported and the specific error message can be printed in llvm-objdump and can be seen in the existing test case for the existing malformed binary but with the updated error message.
Converting these interfaces to Expected<> from ErrorOr<> does involve touching a number of places. To contain the changes for now use of errorToErrorCode() and errorOrToExpected() are used where the callers are yet to be converted.
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(ObjOrErr.takeError()) so the buggy code will not crash since needed to deal with the Error.
Note there is one fix also needed to lld/COFF/InputFiles.cpp that goes along with this that I will commit right after this. So expect lld not to built after this commit and before the next one.
llvm-svn: 265606
show more ...
|
Revision tags: llvmorg-3.8.0, llvmorg-3.8.0-rc3, llvmorg-3.8.0-rc2, llvmorg-3.8.0-rc1, llvmorg-3.7.1, llvmorg-3.7.1-rc2, llvmorg-3.7.1-rc1 |
|
#
7a96942a |
| 05-Nov-2015 |
Kevin Enderby <enderby@apple.com> |
Reapply r250906 with many suggested updates from Rafael Espindola. The needed lld matching changes to be submitted immediately next, but this revision will cause lld failures with this alone which is
Reapply r250906 with many suggested updates from Rafael Espindola. The needed lld matching changes to be submitted immediately next, but this revision will cause lld failures with this alone which is expected.
This removes the eating of the error in Archive::Child::getSize() when the characters in the size field in the archive header for the member is not a number. To do this we have all of the needed methods return ErrorOr to push them up until we get out of lib. Then the tools and can handle the error in whatever way is appropriate for that tool.
So the solution is to plumb all the ErrorOr stuff through everything that touches archives. This include its iterators as one can create an Archive object but the first or any other Child object may fail to be created due to a bad size field in its header.
Thanks to Lang Hames on the changes making child_iterator contain an ErrorOr<Child> instead of a Child and the needed changes to ErrorOr.h to add operator overloading for * and -> .
We don’t want to use llvm_unreachable() as it calls abort() and is produces a “crash” and using report_fatal_error() to move the error checking will cause the program to stop, neither of which are really correct in library code. There are still some uses of these that should be cleaned up in this library code for other than the size field.
The test cases use archives with text files so one can see the non-digit character, in this case a ‘%’, in the size field.
These changes will require corresponding changes to the lld project. That will be committed immediately after this change. But this revision will cause lld failures with this alone which is expected.
llvm-svn: 252192
show more ...
|
#
da9dd050 |
| 21-Oct-2015 |
Kevin Enderby <enderby@apple.com> |
Backing out commit r250906 as it broke lld.
llvm-svn: 250908
|
#
e3bf4fd5 |
| 21-Oct-2015 |
Kevin Enderby <enderby@apple.com> |
This removes the eating of the error in Archive::Child::getSize() when the characters in the size field in the archive header for the member is not a number. To do this we have all of the needed met
This removes the eating of the error in Archive::Child::getSize() when the characters in the size field in the archive header for the member is not a number. To do this we have all of the needed methods return ErrorOr to push them up until we get out of lib. Then the tools and can handle the error in whatever way is appropriate for that tool.
So the solution is to plumb all the ErrorOr stuff through everything that touches archives. This include its iterators as one can create an Archive object but the first or any other Child object may fail to be created due to a bad size field in its header.
Thanks to Lang Hames on the changes making child_iterator contain an ErrorOr<Child> instead of a Child and the needed changes to ErrorOr.h to add operator overloading for * and -> .
We don’t want to use llvm_unreachable() as it calls abort() and is produces a “crash” and using report_fatal_error() to move the error checking will cause the program to stop, neither of which are really correct in library code. There are still some uses of these that should be cleaned up in this library code for other than the size field.
Also corrected the code where the size gets us to the “at the end of the archive” which is OK but past the end of the archive will return object_error::parse_failed now.
The test cases use archives with text files so one can see the non-digit character, in this case a ‘%’, in the size field.
llvm-svn: 250906
show more ...
|
#
0013be16 |
| 21-Sep-2015 |
Craig Topper <craig.topper@gmail.com> |
Use makeArrayRef or None to avoid unnecessarily mentioning the ArrayRef type extra times. NFC
llvm-svn: 248140
|
#
386e2ab1 |
| 15-Sep-2015 |
Davide Italiano <davide@freebsd.org> |
[llvm-cxxdump] Remove duplicate code check.
We already fail with 'No such file or directory' when we try to open the file -- if that doesn't exist. Also add a test to verify this behavior.
llvm-svn
[llvm-cxxdump] Remove duplicate code check.
We already fail with 'No such file or directory' when we try to open the file -- if that doesn't exist. Also add a test to verify this behavior.
llvm-svn: 247744
show more ...
|
Revision tags: llvmorg-3.7.0, llvmorg-3.7.0-rc4, llvmorg-3.7.0-rc3, studio-1.4 |
|
#
d7fafa0f |
| 13-Aug-2015 |
David Majnemer <david.majnemer@gmail.com> |
[llvm-cxxdump] Correctly process relocations when given multiple files
Archive files wouldn't lead to us reprocessing the section relocations for the new object files.
llvm-svn: 244932
|
#
8bab889b |
| 07-Aug-2015 |
Rafael Espindola <rafael.espindola@gmail.com> |
Convert getSymbolSection to return an ErrorOr.
This function can actually fail since the symbol contains an index to the section and that can be invalid.
llvm-svn: 244375
|
Revision tags: llvmorg-3.7.0-rc2 |
|
#
81032949 |
| 17-Jul-2015 |
Davide Italiano <davide@freebsd.org> |
[llvm-cxxdump] Don't rely on global state
Differential Revision: http://reviews.llvm.org/D11227
llvm-svn: 242509
|
Revision tags: llvmorg-3.7.0-rc1 |
|
#
ed067c45 |
| 03-Jul-2015 |
Rafael Espindola <rafael.espindola@gmail.com> |
Return ErrorOr from getSymbolAddress.
It can fail trying to get the section on ELF and COFF. This makes sure the error is handled.
llvm-svn: 241366
|
#
5d0c2ffa |
| 02-Jul-2015 |
Rafael Espindola <rafael.espindola@gmail.com> |
Return ErrorOr from SymbolRef::getName.
This function can really fail since the string table offset can be out of bounds.
Using ErrorOr makes sure the error is checked.
Hopefully a lot of the boil
Return ErrorOr from SymbolRef::getName.
This function can really fail since the string table offset can be out of bounds.
Using ErrorOr makes sure the error is checked.
Hopefully a lot of the boilerplate code in tools/* can go away once we have a diagnostic manager in Object.
llvm-svn: 241297
show more ...
|
#
96d071cd |
| 29-Jun-2015 |
Rafael Espindola <rafael.espindola@gmail.com> |
Don't return error_code from function that never fails.
llvm-svn: 241021
|
#
6bf32210 |
| 24-Jun-2015 |
Rafael Espindola <rafael.espindola@gmail.com> |
Make computeSymbolSizes never fail.
On ELF that was already the case since getting the size of a symbol never fails.
On MachO and COFF we could fail trying to get the section of a symbol. But we do
Make computeSymbolSizes never fail.
On ELF that was already the case since getting the size of a symbol never fails.
On MachO and COFF we could fail trying to get the section of a symbol. But we don't really need the section, just the section number to know if two symbols are in the same section or not.
llvm-svn: 240580
show more ...
|
Revision tags: llvmorg-3.6.2, llvmorg-3.6.2-rc1 |
|
#
a4a4093e |
| 23-Jun-2015 |
Rafael Espindola <rafael.espindola@gmail.com> |
Compute correct symbol sizes for MachO and COFF.
Before this would dump from the symbol start to the end of the section.
llvm-svn: 240367
|
#
5eb02e45 |
| 01-Jun-2015 |
Rafael Espindola <rafael.espindola@gmail.com> |
Simplify another function that doesn't fail.
llvm-svn: 238703
|
Revision tags: llvmorg-3.6.1, llvmorg-3.6.1-rc1 |
|
#
46f2cc9e |
| 15-Apr-2015 |
Richard Trieu <rtrieu@google.com> |
Change range-based for-loop to use const auto&. No functionality change.
llvm-svn: 234974
|
#
6b1aa5f5 |
| 15-Apr-2015 |
Richard Trieu <rtrieu@google.com> |
Change range-based for-loops to be -Wrange-loop-analysis clean. No functionality change.
llvm-svn: 234963
|
#
16132e6f |
| 23-Mar-2015 |
Benjamin Kramer <benny.kra@googlemail.com> |
Purge unused includes throughout libSupport.
NFC.
llvm-svn: 232976
|
Revision tags: llvmorg-3.5.2, llvmorg-3.5.2-rc1 |
|
#
f45bbd0d |
| 15-Mar-2015 |
David Majnemer <david.majnemer@gmail.com> |
llvm-cxxdump: Rename llvm-vtabledump to llvm-cxxdump
llvm-vtabledump has grown enough functionality not related to vtables that it deserves a name which is more descriptive.
llvm-svn: 232301
|