summaryrefslogtreecommitdiff
path: root/tools/llvm-objdump
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2014-03-04 03:08:45 +0000
committerRui Ueyama <ruiu@google.com>2014-03-04 03:08:45 +0000
commitb1347c6e6a8ce4002b8b92805d357b2afae1f8fd (patch)
tree2f20eea90a36b52f40a65d85377a3a3b18f4be86 /tools/llvm-objdump
parent5dee350565bb76fc76b186aa9a3671ed4bea8f0f (diff)
downloadllvm-b1347c6e6a8ce4002b8b92805d357b2afae1f8fd.tar.gz
llvm-b1347c6e6a8ce4002b8b92805d357b2afae1f8fd.tar.bz2
llvm-b1347c6e6a8ce4002b8b92805d357b2afae1f8fd.tar.xz
llvm-objdump: Split printRuntimeFunction to two small functions.
No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202781 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-objdump')
-rw-r--r--tools/llvm-objdump/COFFDump.cpp80
1 files changed, 41 insertions, 39 deletions
diff --git a/tools/llvm-objdump/COFFDump.cpp b/tools/llvm-objdump/COFFDump.cpp
index 74d4e36959..ba5de46b9f 100644
--- a/tools/llvm-objdump/COFFDump.cpp
+++ b/tools/llvm-objdump/COFFDump.cpp
@@ -413,12 +413,51 @@ static bool getPDataSection(const COFFObjectFile *Obj,
return false;
}
+static void printWin64EHUnwindInfo(const Win64EH::UnwindInfo *UI) {
+ // The casts to int are required in order to output the value as number.
+ // Without the casts the value would be interpreted as char data (which
+ // results in garbage output).
+ outs() << " Version: " << static_cast<int>(UI->getVersion()) << "\n";
+ outs() << " Flags: " << static_cast<int>(UI->getFlags());
+ if (UI->getFlags()) {
+ if (UI->getFlags() & UNW_ExceptionHandler)
+ outs() << " UNW_ExceptionHandler";
+ if (UI->getFlags() & UNW_TerminateHandler)
+ outs() << " UNW_TerminateHandler";
+ if (UI->getFlags() & UNW_ChainInfo)
+ outs() << " UNW_ChainInfo";
+ }
+ outs() << "\n";
+ outs() << " Size of prolog: " << static_cast<int>(UI->PrologSize) << "\n";
+ outs() << " Number of Codes: " << static_cast<int>(UI->NumCodes) << "\n";
+ // Maybe this should move to output of UOP_SetFPReg?
+ if (UI->getFrameRegister()) {
+ outs() << " Frame register: "
+ << getUnwindRegisterName(UI->getFrameRegister()) << "\n";
+ outs() << " Frame offset: " << 16 * UI->getFrameOffset() << "\n";
+ } else {
+ outs() << " No frame pointer used\n";
+ }
+ if (UI->getFlags() & (UNW_ExceptionHandler | UNW_TerminateHandler)) {
+ // FIXME: Output exception handler data
+ } else if (UI->getFlags() & UNW_ChainInfo) {
+ // FIXME: Output chained unwind info
+ }
+
+ if (UI->NumCodes)
+ outs() << " Unwind Codes:\n";
+
+ printAllUnwindCodes(ArrayRef<UnwindCode>(&UI->UnwindCodes[0], UI->NumCodes));
+
+ outs() << "\n\n";
+ outs().flush();
+}
+
static void printRuntimeFunction(const COFFObjectFile *Obj,
const RuntimeFunction &RF,
uint64_t SectionOffset,
const std::vector<RelocationRef> &Rels) {
outs() << "Function Table:\n";
-
outs() << " Start Address: ";
printCOFFSymbolAddress(outs(), Rels,
SectionOffset +
@@ -456,44 +495,7 @@ static void printRuntimeFunction(const COFFObjectFile *Obj,
const Win64EH::UnwindInfo *UI = reinterpret_cast<const Win64EH::UnwindInfo *>(
XContents.data() + UnwindInfoOffset);
-
- // The casts to int are required in order to output the value as number.
- // Without the casts the value would be interpreted as char data (which
- // results in garbage output).
- outs() << " Version: " << static_cast<int>(UI->getVersion()) << "\n";
- outs() << " Flags: " << static_cast<int>(UI->getFlags());
- if (UI->getFlags()) {
- if (UI->getFlags() & UNW_ExceptionHandler)
- outs() << " UNW_ExceptionHandler";
- if (UI->getFlags() & UNW_TerminateHandler)
- outs() << " UNW_TerminateHandler";
- if (UI->getFlags() & UNW_ChainInfo)
- outs() << " UNW_ChainInfo";
- }
- outs() << "\n";
- outs() << " Size of prolog: " << static_cast<int>(UI->PrologSize) << "\n";
- outs() << " Number of Codes: " << static_cast<int>(UI->NumCodes) << "\n";
- // Maybe this should move to output of UOP_SetFPReg?
- if (UI->getFrameRegister()) {
- outs() << " Frame register: "
- << getUnwindRegisterName(UI->getFrameRegister()) << "\n";
- outs() << " Frame offset: " << 16 * UI->getFrameOffset() << "\n";
- } else {
- outs() << " No frame pointer used\n";
- }
- if (UI->getFlags() & (UNW_ExceptionHandler | UNW_TerminateHandler)) {
- // FIXME: Output exception handler data
- } else if (UI->getFlags() & UNW_ChainInfo) {
- // FIXME: Output chained unwind info
- }
-
- if (UI->NumCodes)
- outs() << " Unwind Codes:\n";
-
- printAllUnwindCodes(ArrayRef<UnwindCode>(&UI->UnwindCodes[0], UI->NumCodes));
-
- outs() << "\n\n";
- outs().flush();
+ printWin64EHUnwindInfo(UI);
}
void llvm::printCOFFUnwindInfo(const COFFObjectFile *Obj) {