From f681ec5db15fc039d3c94ac03032f7b87788160d Mon Sep 17 00:00:00 2001 From: Kevin Enderby Date: Fri, 22 Jan 2016 18:47:14 +0000 Subject: 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. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit llvm-svn: 258520 --- llvm/lib/Object/MachOObjectFile.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'llvm/lib/Object/MachOObjectFile.cpp') diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp index 4ba6523a528..3fb8e537fad 100644 --- a/llvm/lib/Object/MachOObjectFile.cpp +++ b/llvm/lib/Object/MachOObjectFile.cpp @@ -332,8 +332,7 @@ ErrorOr 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); } -- cgit v1.2.3