llvm-objdump: Indent unwind info contents.

Unwind info contents were indented at the same level as function table
contents. That's a bit confusing because the unwind info is pointed by
function table. In other places we usually increment indentation depth
by one when dereferncing a pointer.

This patch also removes extraneous newlines between function tables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202879 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rui Ueyama
2014-03-04 19:23:56 +00:00
parent 1d8f551946
commit afee151fe8
2 changed files with 91 additions and 91 deletions

View File

@ -9,99 +9,99 @@ OBJ: Function Table:
OBJ-NEXT: Start Address: func OBJ-NEXT: Start Address: func
OBJ-NEXT: End Address: func + 0x001b OBJ-NEXT: End Address: func + 0x001b
OBJ-NEXT: Unwind Info Address: .xdata OBJ-NEXT: Unwind Info Address: .xdata
OBJ-NEXT: Version: 1 OBJ-NEXT: Version: 1
OBJ-NEXT: Flags: 1 UNW_ExceptionHandler OBJ-NEXT: Flags: 1 UNW_ExceptionHandler
OBJ-NEXT: Size of prolog: 18 OBJ-NEXT: Size of prolog: 18
OBJ-NEXT: Number of Codes: 8 OBJ-NEXT: Number of Codes: 8
OBJ-NEXT: Frame register: RBX OBJ-NEXT: Frame register: RBX
OBJ-NEXT: Frame offset: 0 OBJ-NEXT: Frame offset: 0
OBJ-NEXT: Unwind Codes: OBJ-NEXT: Unwind Codes:
OBJ-NEXT: 0x12: UOP_SetFPReg OBJ-NEXT: 0x12: UOP_SetFPReg
OBJ-NEXT: 0x0f: UOP_PushNonVol RBX OBJ-NEXT: 0x0f: UOP_PushNonVol RBX
OBJ-NEXT: 0x0e: UOP_SaveXMM128 XMM8 [0x0000] OBJ-NEXT: 0x0e: UOP_SaveXMM128 XMM8 [0x0000]
OBJ-NEXT: 0x09: UOP_SaveNonVol RSI [0x0010] OBJ-NEXT: 0x09: UOP_SaveNonVol RSI [0x0010]
OBJ-NEXT: 0x04: UOP_AllocSmall 24 OBJ-NEXT: 0x04: UOP_AllocSmall 24
OBJ-NEXT: 0x00: UOP_PushMachFrame w/o error code OBJ-NEXT: 0x00: UOP_PushMachFrame w/o error code
OBJ: Function Table: OBJ: Function Table:
OBJ-NEXT: Start Address: func + 0x0012 OBJ-NEXT: Start Address: func + 0x0012
OBJ-NEXT: End Address: func + 0x0012 OBJ-NEXT: End Address: func + 0x0012
OBJ-NEXT: Unwind Info Address: .xdata + 0x001c OBJ-NEXT: Unwind Info Address: .xdata + 0x001c
OBJ-NEXT: Version: 1 OBJ-NEXT: Version: 1
OBJ-NEXT: Flags: 4 UNW_ChainInfo OBJ-NEXT: Flags: 4 UNW_ChainInfo
OBJ-NEXT: Size of prolog: 0 OBJ-NEXT: Size of prolog: 0
OBJ-NEXT: Number of Codes: 0 OBJ-NEXT: Number of Codes: 0
OBJ-NEXT: No frame pointer used OBJ-NEXT: No frame pointer used
OBJ: Function Table: OBJ: Function Table:
OBJ-NEXT: Start Address: smallFunc OBJ-NEXT: Start Address: smallFunc
OBJ-NEXT: End Address: smallFunc + 0x0001 OBJ-NEXT: End Address: smallFunc + 0x0001
OBJ-NEXT: Unwind Info Address: .xdata + 0x002c OBJ-NEXT: Unwind Info Address: .xdata + 0x002c
OBJ-NEXT: Version: 1 OBJ-NEXT: Version: 1
OBJ-NEXT: Flags: 0 OBJ-NEXT: Flags: 0
OBJ-NEXT: Size of prolog: 0 OBJ-NEXT: Size of prolog: 0
OBJ-NEXT: Number of Codes: 0 OBJ-NEXT: Number of Codes: 0
OBJ-NEXT: No frame pointer used OBJ-NEXT: No frame pointer used
OBJ: Function Table: OBJ: Function Table:
OBJ-NEXT: Start Address: allocFunc OBJ-NEXT: Start Address: allocFunc
OBJ-NEXT: End Address: allocFunc + 0x001d OBJ-NEXT: End Address: allocFunc + 0x001d
OBJ-NEXT: Unwind Info Address: .xdata + 0x0034 OBJ-NEXT: Unwind Info Address: .xdata + 0x0034
OBJ-NEXT: Version: 1 OBJ-NEXT: Version: 1
OBJ-NEXT: Flags: 0 OBJ-NEXT: Flags: 0
OBJ-NEXT: Size of prolog: 14 OBJ-NEXT: Size of prolog: 14
OBJ-NEXT: Number of Codes: 6 OBJ-NEXT: Number of Codes: 6
OBJ-NEXT: No frame pointer used OBJ-NEXT: No frame pointer used
OBJ-NEXT: Unwind Codes: OBJ-NEXT: Unwind Codes:
OBJ-NEXT: 0x0e: UOP_AllocLarge 8454128 OBJ-NEXT: 0x0e: UOP_AllocLarge 8454128
OBJ-NEXT: 0x07: UOP_AllocLarge 8190 OBJ-NEXT: 0x07: UOP_AllocLarge 8190
OBJ-NEXT: 0x00: UOP_PushMachFrame w/o error code OBJ-NEXT: 0x00: UOP_PushMachFrame w/o error code
EXE: Function Table: EXE: Function Table:
EXE: Start Address: 0x1000 EXE-NEXT: Start Address: 0x1000
EXE: End Address: 0x101b EXE-NEXT: End Address: 0x101b
EXE: Unwind Info Address: 0x2000 EXE-NEXT: Unwind Info Address: 0x2000
EXE: Version: 1 EXE-NEXT: Version: 1
EXE: Flags: 1 UNW_ExceptionHandler EXE-NEXT: Flags: 1 UNW_ExceptionHandler
EXE: Size of prolog: 18 EXE-NEXT: Size of prolog: 18
EXE: Number of Codes: 8 EXE-NEXT: Number of Codes: 8
EXE: Frame register: RBX EXE-NEXT: Frame register: RBX
EXE: Frame offset: 0 EXE-NEXT: Frame offset: 0
EXE: Unwind Codes: EXE-NEXT: Unwind Codes:
EXE: 0x12: UOP_SetFPReg EXE-NEXT: 0x12: UOP_SetFPReg
EXE: 0x0f: UOP_PushNonVol RBX EXE-NEXT: 0x0f: UOP_PushNonVol RBX
EXE: 0x0e: UOP_SaveXMM128 XMM8 [0x0000] EXE-NEXT: 0x0e: UOP_SaveXMM128 XMM8 [0x0000]
EXE: 0x09: UOP_SaveNonVol RSI [0x0010] EXE-NEXT: 0x09: UOP_SaveNonVol RSI [0x0010]
EXE: 0x04: UOP_AllocSmall 24 EXE-NEXT: 0x04: UOP_AllocSmall 24
EXE: 0x00: UOP_PushMachFrame w/o error code EXE-NEXT: 0x00: UOP_PushMachFrame w/o error code
EXE: Function Table: EXE: Function Table:
EXE: Start Address: 0x1012 EXE-NEXT: Start Address: 0x1012
EXE: End Address: 0x1012 EXE-NEXT: End Address: 0x1012
EXE: Unwind Info Address: 0x201c EXE-NEXT: Unwind Info Address: 0x201c
EXE: Version: 1 EXE-NEXT: Version: 1
EXE: Flags: 4 UNW_ChainInfo EXE-NEXT: Flags: 4 UNW_ChainInfo
EXE: Size of prolog: 0 EXE-NEXT: Size of prolog: 0
EXE: Number of Codes: 0 EXE-NEXT: Number of Codes: 0
EXE: No frame pointer used EXE-NEXT: No frame pointer used
EXE: Function Table: EXE: Function Table:
EXE: Start Address: 0x101b EXE-NEXT: Start Address: 0x101b
EXE: End Address: 0x101c EXE-NEXT: End Address: 0x101c
EXE: Unwind Info Address: 0x202c EXE-NEXT: Unwind Info Address: 0x202c
EXE: Version: 1 EXE-NEXT: Version: 1
EXE: Flags: 0 EXE-NEXT: Flags: 0
EXE: Size of prolog: 0 EXE-NEXT: Size of prolog: 0
EXE: Number of Codes: 0 EXE-NEXT: Number of Codes: 0
EXE: No frame pointer used EXE-NEXT: No frame pointer used
EXE: Function Table: EXE: Function Table:
EXE: Start Address: 0x101c EXE-NEXT: Start Address: 0x101c
EXE: End Address: 0x1039 EXE-NEXT: End Address: 0x1039
EXE: Unwind Info Address: 0x2034 EXE-NEXT: Unwind Info Address: 0x2034
EXE: Version: 1 EXE-NEXT: Version: 1
EXE: Flags: 0 EXE-NEXT: Flags: 0
EXE: Size of prolog: 14 EXE-NEXT: Size of prolog: 14
EXE: Number of Codes: 6 EXE-NEXT: Number of Codes: 6
EXE: No frame pointer used EXE-NEXT: No frame pointer used
EXE: Unwind Codes: EXE-NEXT: Unwind Codes:
EXE: 0x0e: UOP_AllocLarge 8454128 EXE-NEXT: 0x0e: UOP_AllocLarge 8454128
EXE: 0x07: UOP_AllocLarge 8190 EXE-NEXT: 0x07: UOP_AllocLarge 8190
EXE: 0x00: UOP_PushMachFrame w/o error code EXE-NEXT: 0x00: UOP_PushMachFrame w/o error code

View File

@ -94,7 +94,7 @@ static unsigned getNumUsedSlots(const UnwindCode &UnwindCode) {
// slots is provided. // slots is provided.
static void printUnwindCode(ArrayRef<UnwindCode> UCs) { static void printUnwindCode(ArrayRef<UnwindCode> UCs) {
assert(UCs.size() >= getNumUsedSlots(UCs[0])); assert(UCs.size() >= getNumUsedSlots(UCs[0]));
outs() << format(" 0x%02x: ", unsigned(UCs[0].u.CodeOffset)) outs() << format(" 0x%02x: ", unsigned(UCs[0].u.CodeOffset))
<< getUnwindCodeTypeName(UCs[0].getUnwindOp()); << getUnwindCodeTypeName(UCs[0].getUnwindOp());
switch (UCs[0].getUnwindOp()) { switch (UCs[0].getUnwindOp()) {
case UOP_PushNonVol: case UOP_PushNonVol:
@ -415,8 +415,8 @@ static void printWin64EHUnwindInfo(const Win64EH::UnwindInfo *UI) {
// The casts to int are required in order to output the value as number. // 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 // Without the casts the value would be interpreted as char data (which
// results in garbage output). // results in garbage output).
outs() << " Version: " << static_cast<int>(UI->getVersion()) << "\n"; outs() << " Version: " << static_cast<int>(UI->getVersion()) << "\n";
outs() << " Flags: " << static_cast<int>(UI->getFlags()); outs() << " Flags: " << static_cast<int>(UI->getFlags());
if (UI->getFlags()) { if (UI->getFlags()) {
if (UI->getFlags() & UNW_ExceptionHandler) if (UI->getFlags() & UNW_ExceptionHandler)
outs() << " UNW_ExceptionHandler"; outs() << " UNW_ExceptionHandler";
@ -426,15 +426,15 @@ static void printWin64EHUnwindInfo(const Win64EH::UnwindInfo *UI) {
outs() << " UNW_ChainInfo"; outs() << " UNW_ChainInfo";
} }
outs() << "\n"; outs() << "\n";
outs() << " Size of prolog: " << static_cast<int>(UI->PrologSize) << "\n"; outs() << " Size of prolog: " << static_cast<int>(UI->PrologSize) << "\n";
outs() << " Number of Codes: " << static_cast<int>(UI->NumCodes) << "\n"; outs() << " Number of Codes: " << static_cast<int>(UI->NumCodes) << "\n";
// Maybe this should move to output of UOP_SetFPReg? // Maybe this should move to output of UOP_SetFPReg?
if (UI->getFrameRegister()) { if (UI->getFrameRegister()) {
outs() << " Frame register: " outs() << " Frame register: "
<< getUnwindRegisterName(UI->getFrameRegister()) << "\n"; << getUnwindRegisterName(UI->getFrameRegister()) << "\n";
outs() << " Frame offset: " << 16 * UI->getFrameOffset() << "\n"; outs() << " Frame offset: " << 16 * UI->getFrameOffset() << "\n";
} else { } else {
outs() << " No frame pointer used\n"; outs() << " No frame pointer used\n";
} }
if (UI->getFlags() & (UNW_ExceptionHandler | UNW_TerminateHandler)) { if (UI->getFlags() & (UNW_ExceptionHandler | UNW_TerminateHandler)) {
// FIXME: Output exception handler data // FIXME: Output exception handler data
@ -443,11 +443,11 @@ static void printWin64EHUnwindInfo(const Win64EH::UnwindInfo *UI) {
} }
if (UI->NumCodes) if (UI->NumCodes)
outs() << " Unwind Codes:\n"; outs() << " Unwind Codes:\n";
printAllUnwindCodes(ArrayRef<UnwindCode>(&UI->UnwindCodes[0], UI->NumCodes)); printAllUnwindCodes(ArrayRef<UnwindCode>(&UI->UnwindCodes[0], UI->NumCodes));
outs() << "\n\n"; outs() << "\n";
outs().flush(); outs().flush();
} }
@ -460,7 +460,7 @@ static void printRuntimeFunction(const COFFObjectFile *Obj,
outs() << "Function Table:\n" outs() << "Function Table:\n"
<< format(" Start Address: 0x%04x\n", RF.StartAddress) << format(" Start Address: 0x%04x\n", RF.StartAddress)
<< format(" End Address: 0x%04x\n", RF.EndAddress) << format(" End Address: 0x%04x\n", RF.EndAddress)
<< format(" Unwind Info Address: 0x%04x\n\n", RF.UnwindInfoOffset); << format(" Unwind Info Address: 0x%04x\n", RF.UnwindInfoOffset);
uintptr_t addr; uintptr_t addr;
if (Obj->getRvaPtr(RF.UnwindInfoOffset, addr)) if (Obj->getRvaPtr(RF.UnwindInfoOffset, addr))
return; return;