General clean up of Mach-O error handling in llvm-objdump.
authorKevin Enderby <enderby@apple.com>
Tue, 15 Nov 2016 23:07:41 +0000 (23:07 +0000)
committerKevin Enderby <enderby@apple.com>
Tue, 15 Nov 2016 23:07:41 +0000 (23:07 +0000)
commit844c4ac55ac997ed36120771cbf87658d5eac31f
tree7eebefc14ebb80adcc2e4ab5642a369d9ea3f718
parent07529a313a10cc77d9736e1c5102c05e62a0594b
General clean up of Mach-O error handling in llvm-objdump.

To get a good error message for all files that could contain Mach-O
files the code in llvm-objdump needs to use the archive member name
and name of the architecture of a slice of a universal file in those cases
where the error come from a Mach-O file in an archive or a universal file.

Most of this is fixed by moving the call to checkSymbolTable() into
ProcessMachO() and calling it when the operation needs the symbol
table.  And then calling the form of report_error() that has the
ArchiveName and ArchitectureName arguments.  One other place
needed to call this form of report_error() also with these arguments.

Also changed the code in MachODump.cpp to not use report_fatal_error()
and use report_error() instead to make the code smaller and cleaner.  All
cases of this are for errors with the symbol table which should now never
be tripped since checkSymbolTable() should be called first to get a good
error message in these cases.

llvm-svn: 287050
llvm/test/tools/llvm-objdump/X86/Inputs/macho-invalid-symbol-indr-archive-universal [new file with mode: 0644]
llvm/test/tools/llvm-objdump/X86/Inputs/macho-invalid-symbol-nsect-archive [new file with mode: 0644]
llvm/test/tools/llvm-objdump/X86/Inputs/macho-invalid-symbol-strx-universal [new file with mode: 0644]
llvm/test/tools/llvm-objdump/X86/malformed-machos.test
llvm/tools/llvm-objdump/MachODump.cpp