summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-nm/llvm-nm.cpp
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2016-01-22 18:47:14 +0000
committerKevin Enderby <enderby@apple.com>2016-01-22 18:47:14 +0000
commitf681ec5db15fc039d3c94ac03032f7b87788160d (patch)
tree428d3a39f901f7513cf8badb4b2a4e32cee936ba /llvm/tools/llvm-nm/llvm-nm.cpp
parentae108c47043a93b0cb3c775ebe79588324c305d6 (diff)
downloadbcm5719-llvm-f681ec5db15fc039d3c94ac03032f7b87788160d.tar.gz
bcm5719-llvm-f681ec5db15fc039d3c94ac03032f7b87788160d.zip
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
Diffstat (limited to 'llvm/tools/llvm-nm/llvm-nm.cpp')
-rw-r--r--llvm/tools/llvm-nm/llvm-nm.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/tools/llvm-nm/llvm-nm.cpp b/llvm/tools/llvm-nm/llvm-nm.cpp
index b70a79c334c..20f080986da 100644
--- a/llvm/tools/llvm-nm/llvm-nm.cpp
+++ b/llvm/tools/llvm-nm/llvm-nm.cpp
@@ -960,8 +960,11 @@ static void dumpSymbolNamesFromObject(SymbolicFile &Obj, bool printName,
S.Address = *AddressOrErr;
}
S.TypeChar = getNMTypeChar(Obj, Sym);
- if (error(Sym.printName(OS)))
- break;
+ std::error_code EC = Sym.printName(OS);
+ if (EC && MachO)
+ OS << "bad string index";
+ else
+ error(EC);
OS << '\0';
S.Sym = Sym;
SymbolList.push_back(S);
OpenPOWER on IntegriCloud