llvm-project/llvm/test/tools/llvm-objdump
Kevin Enderby 22fc007809 Add a checkSymbolTable() method to the MachOObjectFile class.
The philosophy of the error checking in libObject for Mach-O files
is that the constructor will check the load commands so for their
tables the offsets and sizes are properly contained in the file.
But there is no checking of the entries of any of the tables.

For the contents of the tables themselves the methods accessing
the contents of the entries return errors as needed.  In some
cases this however makes it difficult or cumbersome to produce
a good error message which would include the tool name, file name,
archive member, and name of the architecture of a slice of a universal file
the error occurred in.

So idea is that there will be a method to check a table which can
be called up front before using it allowing a good error message
to be produced before a table is used.  And if only verification of
the Mach-O file and its tables are wanted a new possible method
checkAllTables() could be added to call all of the methods to
check all the tables at some time when such methods exist.

The checkSymbolTable() is the first of such methods to check
one of the Mach-O file tables.  This method initially will used in
llvm-objdump’s DisassembleMachO() routine before it gets the
section and symbol information.  As if there are problems with
the symbol table currently the error is first encountered by the
bool operator() in the SymbolSorter() struct which passed to
std::sort().  In this case there is no context as to the file name
the symbol which results a poor error message:

LLVM ERROR: truncated or malformed object (bad string index: 22 for symbol at index 1)

with the added call to the checkSymbolTable() method the
error message includes the tool name and file name:

llvm-objdump: 'macho-invalid-symbol-strx': truncated or malformed object (bad string table index: 22 past the end of string table, for symbol at index 1)
llvm-svn: 286887
2016-11-14 20:57:04 +00:00
..
AArch64 Add support for the ARM_THREAD_STATE64 and 2016-11-03 20:51:28 +00:00
ARM For llvm-objdump for Mach-O files add printing of 2016-10-21 18:22:35 +00:00
Hexagon DebugInfo: New metadata representation for global variables. 2016-09-13 01:12:59 +00:00
Inputs Fix test failure in r281232 2016-09-12 17:40:10 +00:00
X86 Add a checkSymbolTable() method to the MachOObjectFile class. 2016-11-14 20:57:04 +00:00
coff-file.test
coff-import-library.test llvm-objdump: add coff import library symbol listing support 2016-08-18 16:39:19 +00:00
coff-large-bss.test
coff-many-relocs.test
coff-non-null-terminated-file.test
coff-private-headers.test [llvm-objdump] Add support for dumping the PE TLS directory 2016-03-15 06:14:01 +00:00
common-symbol-elf.test
eh_frame-arm64.test [DebugInfo] Dump CIE augmentation data as a list of hex bytes 2016-03-01 18:38:05 +00:00
eh_frame-mipsel.test [DebugInfo] Dump CIE augmentation data as a list of hex bytes 2016-03-01 18:38:05 +00:00
eh_frame_zero_cie.test [DebugInfo] Support zero-length CIE in the _eh_frame parser 2016-01-27 14:05:35 +00:00
hex-relocation-addr.test
invalid-input.test
macho-LLVM-bundle.test Add the printing the Mach-O (__LLVM,__bundle) xar archive file section "verbosely" 2016-05-23 21:34:12 +00:00
macho-bad-ordinal.test
macho-bind.test
macho-bind2.test
macho-compact-unwind-i386.test
macho-compact-unwind-x86_64.test
macho-exports-trie.test
macho-lazy-bind.test
macho-objc-meta-data.test Add a test case for the crash fixed with r267037. David Blaikie said it would be nice to have! 2016-04-27 20:37:06 +00:00
macho-rebase.test
macho-sections.test Fix bugs in llvm-objdump printing the last word for -section in non i386 and x86 files. 2016-04-27 23:43:00 +00:00
macho-unwind-info-arm64.test
macho-unwind-info-no-relocs.test
macho-unwind-info-x86_64.test
macho-weak-bind.test
malformed-archives.test llvm-objdump: Make some error messages more consistent 2016-10-26 22:37:52 +00:00
malformed-macho.test Thread Expected<...> up from createMachOObjectFile() to allow llvm-objdump to produce a real error message 2016-04-06 22:14:09 +00:00
proc-specific-section-elf.test
section-filter.test
win64-unwind-data.test