Fix MachOObjectFile::getSymbolName() to not call report_fatal_error()
but to return object_error::parse_failed. Then made the code in llvm-nm do for Mach-O files what is done in the darwin native tools which is to print "bad string index" for bad string indexes. Updated the error message in the llvm-objdump test, and added tests to show llvm-nm prints "bad string index" and a test to print the actual bad string index value which in this case is 0xfe000002 when printing the fields as raw hex. llvm-svn: 258520
This commit is contained in:
@@ -332,8 +332,7 @@ ErrorOr<StringRef> MachOObjectFile::getSymbolName(DataRefImpl Symb) const {
|
||||
MachO::nlist_base Entry = getSymbolTableEntryBase(this, Symb);
|
||||
const char *Start = &StringTable.data()[Entry.n_strx];
|
||||
if (Start < getData().begin() || Start >= getData().end())
|
||||
report_fatal_error(
|
||||
"Symbol name entry points before beginning or past end of file.");
|
||||
return object_error::parse_failed;
|
||||
return StringRef(Start);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user