summaryrefslogtreecommitdiff
path: root/tools/llvm-dwarfdump
diff options
context:
space:
mode:
authorEli Bendersky <eliben@google.com>2013-01-25 20:53:41 +0000
committerEli Bendersky <eliben@google.com>2013-01-25 20:53:41 +0000
commita965baca3c7ce1ced00446cff1c6395d03dfed52 (patch)
tree0a99095a38ce45c153857b6f080c5b4f34de5c9d /tools/llvm-dwarfdump
parenta506b00d142b04ddaba776d4a8bd5d85b87aeea8 (diff)
downloadllvm-a965baca3c7ce1ced00446cff1c6395d03dfed52.tar.gz
llvm-a965baca3c7ce1ced00446cff1c6395d03dfed52.tar.bz2
llvm-a965baca3c7ce1ced00446cff1c6395d03dfed52.tar.xz
When encountering an unknown file format, ObjectFile::createObjectFile should
politely report it instead of running into llvm_unreachable. Also patch llvm-dwarfdump to actually check whether the file it's attempting to dump is a valid object file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173489 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-dwarfdump')
-rw-r--r--tools/llvm-dwarfdump/llvm-dwarfdump.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
index 0687500583..6041510e03 100644
--- a/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
+++ b/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
@@ -86,6 +86,11 @@ static void DumpInput(const StringRef &Filename) {
}
OwningPtr<ObjectFile> Obj(ObjectFile::createObjectFile(Buff.take()));
+ if (!Obj) {
+ errs() << Filename << ": Unknown object file format\n";
+ return;
+ }
+
OwningPtr<DIContext> DICtx(DIContext::getDWARFContext(Obj.get()));
if (Address == -1ULL) {