summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2014-02-28 05:21:29 +0000
committerRui Ueyama <ruiu@google.com>2014-02-28 05:21:29 +0000
commit49c76560f31772bb6518c7e94549e44a19c25a7e (patch)
treef6dae90a0f4d706da3417ba3586e04ffb0020dd2 /tools
parent6738a1ba7a2843ce6602f9be21c819873fd33841 (diff)
downloadllvm-49c76560f31772bb6518c7e94549e44a19c25a7e.tar.gz
llvm-49c76560f31772bb6518c7e94549e44a19c25a7e.tar.bz2
llvm-49c76560f31772bb6518c7e94549e44a19c25a7e.tar.xz
llvm-objdump: Fix crash bug with printing unwind info on stripped file.
The current COFF unwind printer tries to print SEH handler function names, assuming that it can always find function names in string table. It crashes if file being read has no symbol table (i.e. executable). With this patch, llvm-objdump prints SEH handler's RVA if there's no symbol table entry for that RVA. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202466 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/llvm-objdump/COFFDump.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/tools/llvm-objdump/COFFDump.cpp b/tools/llvm-objdump/COFFDump.cpp
index c4bd81aded..0b7f64d39e 100644
--- a/tools/llvm-objdump/COFFDump.cpp
+++ b/tools/llvm-objdump/COFFDump.cpp
@@ -182,10 +182,10 @@ static error_code resolveSymbol(const std::vector<RelocationRef> &Rels,
return EC;
if (Ofs == Offset) {
Sym = *I->getSymbol();
- break;
+ return object_error::success;
}
}
- return object_error::success;
+ return object_error::parse_failed;
}
// Given a vector of relocations for a section and an offset into this section
@@ -225,11 +225,13 @@ static void printCOFFSymbolAddress(llvm::raw_ostream &Out,
const std::vector<RelocationRef> &Rels,
uint64_t Offset, uint32_t Disp) {
StringRef Sym;
- if (error(resolveSymbolName(Rels, Offset, Sym)))
- return;
- Out << Sym;
- if (Disp > 0)
- Out << format(" + 0x%04x", Disp);
+ if (!resolveSymbolName(Rels, Offset, Sym)) {
+ Out << Sym;
+ if (Disp > 0)
+ Out << format(" + 0x%04x", Disp);
+ } else {
+ Out << format("0x%04x", Disp);
+ }
}
static void