[llvm] r202879 - llvm-objdump: Indent unwind info contents.

Rui Ueyama ruiu at google.com
Tue Mar 4 11:23:56 PST 2014


Author: ruiu
Date: Tue Mar  4 13:23:56 2014
New Revision: 202879

URL: http://llvm.org/viewvc/llvm-project?rev=202879&view=rev
Log:
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.

Modified:
    llvm/trunk/test/tools/llvm-objdump/win64-unwind-data.test
    llvm/trunk/tools/llvm-objdump/COFFDump.cpp

Modified: llvm/trunk/test/tools/llvm-objdump/win64-unwind-data.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/win64-unwind-data.test?rev=202879&r1=202878&r2=202879&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objdump/win64-unwind-data.test (original)
+++ llvm/trunk/test/tools/llvm-objdump/win64-unwind-data.test Tue Mar  4 13:23:56 2014
@@ -9,99 +9,99 @@ OBJ:      Function Table:
 OBJ-NEXT:   Start Address: func
 OBJ-NEXT:   End Address: func + 0x001b
 OBJ-NEXT:   Unwind Info Address: .xdata
-OBJ-NEXT:   Version: 1
-OBJ-NEXT:   Flags: 1 UNW_ExceptionHandler
-OBJ-NEXT:   Size of prolog: 18
-OBJ-NEXT:   Number of Codes: 8
-OBJ-NEXT:   Frame register: RBX
-OBJ-NEXT:   Frame offset: 0
-OBJ-NEXT:   Unwind Codes:
-OBJ-NEXT:     0x12: UOP_SetFPReg
-OBJ-NEXT:     0x0f: UOP_PushNonVol RBX
-OBJ-NEXT:     0x0e: UOP_SaveXMM128 XMM8 [0x0000]
-OBJ-NEXT:     0x09: UOP_SaveNonVol RSI [0x0010]
-OBJ-NEXT:     0x04: UOP_AllocSmall 24
-OBJ-NEXT:     0x00: UOP_PushMachFrame w/o error code
+OBJ-NEXT:     Version: 1
+OBJ-NEXT:     Flags: 1 UNW_ExceptionHandler
+OBJ-NEXT:     Size of prolog: 18
+OBJ-NEXT:     Number of Codes: 8
+OBJ-NEXT:     Frame register: RBX
+OBJ-NEXT:     Frame offset: 0
+OBJ-NEXT:     Unwind Codes:
+OBJ-NEXT:       0x12: UOP_SetFPReg
+OBJ-NEXT:       0x0f: UOP_PushNonVol RBX
+OBJ-NEXT:       0x0e: UOP_SaveXMM128 XMM8 [0x0000]
+OBJ-NEXT:       0x09: UOP_SaveNonVol RSI [0x0010]
+OBJ-NEXT:       0x04: UOP_AllocSmall 24
+OBJ-NEXT:       0x00: UOP_PushMachFrame w/o error code
 OBJ:      Function Table:
 OBJ-NEXT:   Start Address: func + 0x0012
 OBJ-NEXT:   End Address: func + 0x0012
 OBJ-NEXT:   Unwind Info Address: .xdata + 0x001c
-OBJ-NEXT:   Version: 1
-OBJ-NEXT:   Flags: 4 UNW_ChainInfo
-OBJ-NEXT:   Size of prolog: 0
-OBJ-NEXT:   Number of Codes: 0
-OBJ-NEXT:   No frame pointer used
+OBJ-NEXT:     Version: 1
+OBJ-NEXT:     Flags: 4 UNW_ChainInfo
+OBJ-NEXT:     Size of prolog: 0
+OBJ-NEXT:     Number of Codes: 0
+OBJ-NEXT:     No frame pointer used
 OBJ:      Function Table:
 OBJ-NEXT:   Start Address: smallFunc
 OBJ-NEXT:   End Address: smallFunc + 0x0001
 OBJ-NEXT:   Unwind Info Address: .xdata + 0x002c
-OBJ-NEXT:   Version: 1
-OBJ-NEXT:   Flags: 0
-OBJ-NEXT:   Size of prolog: 0
-OBJ-NEXT:   Number of Codes: 0
-OBJ-NEXT:   No frame pointer used
+OBJ-NEXT:     Version: 1
+OBJ-NEXT:     Flags: 0
+OBJ-NEXT:     Size of prolog: 0
+OBJ-NEXT:     Number of Codes: 0
+OBJ-NEXT:     No frame pointer used
 OBJ:      Function Table:
 OBJ-NEXT:   Start Address: allocFunc
 OBJ-NEXT:   End Address: allocFunc + 0x001d
 OBJ-NEXT:   Unwind Info Address: .xdata + 0x0034
-OBJ-NEXT:   Version: 1
-OBJ-NEXT:   Flags: 0
-OBJ-NEXT:   Size of prolog: 14
-OBJ-NEXT:   Number of Codes: 6
-OBJ-NEXT:   No frame pointer used
-OBJ-NEXT:   Unwind Codes:
-OBJ-NEXT:     0x0e: UOP_AllocLarge 8454128
-OBJ-NEXT:     0x07: UOP_AllocLarge 8190
-OBJ-NEXT:     0x00: UOP_PushMachFrame w/o error code
+OBJ-NEXT:     Version: 1
+OBJ-NEXT:     Flags: 0
+OBJ-NEXT:     Size of prolog: 14
+OBJ-NEXT:     Number of Codes: 6
+OBJ-NEXT:     No frame pointer used
+OBJ-NEXT:     Unwind Codes:
+OBJ-NEXT:       0x0e: UOP_AllocLarge 8454128
+OBJ-NEXT:       0x07: UOP_AllocLarge 8190
+OBJ-NEXT:       0x00: UOP_PushMachFrame w/o error code
 
-EXE: Function Table:
-EXE:   Start Address: 0x1000
-EXE:   End Address: 0x101b
-EXE:   Unwind Info Address: 0x2000
-EXE:   Version: 1
-EXE:   Flags: 1 UNW_ExceptionHandler
-EXE:   Size of prolog: 18
-EXE:   Number of Codes: 8
-EXE:   Frame register: RBX
-EXE:   Frame offset: 0
-EXE:   Unwind Codes:
-EXE:     0x12: UOP_SetFPReg
-EXE:     0x0f: UOP_PushNonVol RBX
-EXE:     0x0e: UOP_SaveXMM128 XMM8 [0x0000]
-EXE:     0x09: UOP_SaveNonVol RSI [0x0010]
-EXE:     0x04: UOP_AllocSmall 24
-EXE:     0x00: UOP_PushMachFrame w/o error code
+EXE:      Function Table:
+EXE-NEXT:   Start Address: 0x1000
+EXE-NEXT:   End Address: 0x101b
+EXE-NEXT:   Unwind Info Address: 0x2000
+EXE-NEXT:     Version: 1
+EXE-NEXT:     Flags: 1 UNW_ExceptionHandler
+EXE-NEXT:     Size of prolog: 18
+EXE-NEXT:     Number of Codes: 8
+EXE-NEXT:     Frame register: RBX
+EXE-NEXT:     Frame offset: 0
+EXE-NEXT:     Unwind Codes:
+EXE-NEXT:       0x12: UOP_SetFPReg
+EXE-NEXT:       0x0f: UOP_PushNonVol RBX
+EXE-NEXT:       0x0e: UOP_SaveXMM128 XMM8 [0x0000]
+EXE-NEXT:       0x09: UOP_SaveNonVol RSI [0x0010]
+EXE-NEXT:       0x04: UOP_AllocSmall 24
+EXE-NEXT:       0x00: UOP_PushMachFrame w/o error code
 
-EXE: Function Table:
-EXE:   Start Address: 0x1012
-EXE:   End Address: 0x1012
-EXE:   Unwind Info Address: 0x201c
-EXE:   Version: 1
-EXE:   Flags: 4 UNW_ChainInfo
-EXE:   Size of prolog: 0
-EXE:   Number of Codes: 0
-EXE:   No frame pointer used
+EXE:      Function Table:
+EXE-NEXT:   Start Address: 0x1012
+EXE-NEXT:   End Address: 0x1012
+EXE-NEXT:   Unwind Info Address: 0x201c
+EXE-NEXT:     Version: 1
+EXE-NEXT:     Flags: 4 UNW_ChainInfo
+EXE-NEXT:     Size of prolog: 0
+EXE-NEXT:     Number of Codes: 0
+EXE-NEXT:     No frame pointer used
 
-EXE: Function Table:
-EXE:   Start Address: 0x101b
-EXE:   End Address: 0x101c
-EXE:   Unwind Info Address: 0x202c
-EXE:   Version: 1
-EXE:   Flags: 0
-EXE:   Size of prolog: 0
-EXE:   Number of Codes: 0
-EXE:   No frame pointer used
+EXE:      Function Table:
+EXE-NEXT:   Start Address: 0x101b
+EXE-NEXT:   End Address: 0x101c
+EXE-NEXT:   Unwind Info Address: 0x202c
+EXE-NEXT:     Version: 1
+EXE-NEXT:     Flags: 0
+EXE-NEXT:     Size of prolog: 0
+EXE-NEXT:     Number of Codes: 0
+EXE-NEXT:     No frame pointer used
 
-EXE: Function Table:
-EXE:   Start Address: 0x101c
-EXE:   End Address: 0x1039
-EXE:   Unwind Info Address: 0x2034
-EXE:   Version: 1
-EXE:   Flags: 0
-EXE:   Size of prolog: 14
-EXE:   Number of Codes: 6
-EXE:   No frame pointer used
-EXE:   Unwind Codes:
-EXE:     0x0e: UOP_AllocLarge 8454128
-EXE:     0x07: UOP_AllocLarge 8190
-EXE:     0x00: UOP_PushMachFrame w/o error code
+EXE:      Function Table:
+EXE-NEXT:   Start Address: 0x101c
+EXE-NEXT:   End Address: 0x1039
+EXE-NEXT:   Unwind Info Address: 0x2034
+EXE-NEXT:     Version: 1
+EXE-NEXT:     Flags: 0
+EXE-NEXT:     Size of prolog: 14
+EXE-NEXT:     Number of Codes: 6
+EXE-NEXT:     No frame pointer used
+EXE-NEXT:     Unwind Codes:
+EXE-NEXT:       0x0e: UOP_AllocLarge 8454128
+EXE-NEXT:       0x07: UOP_AllocLarge 8190
+EXE-NEXT:       0x00: UOP_PushMachFrame w/o error code

Modified: llvm/trunk/tools/llvm-objdump/COFFDump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/COFFDump.cpp?rev=202879&r1=202878&r2=202879&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/COFFDump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/COFFDump.cpp Tue Mar  4 13:23:56 2014
@@ -94,7 +94,7 @@ static unsigned getNumUsedSlots(const Un
 // slots is provided.
 static void printUnwindCode(ArrayRef<UnwindCode> UCs) {
   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());
   switch (UCs[0].getUnwindOp()) {
   case UOP_PushNonVol:
@@ -415,8 +415,8 @@ static void printWin64EHUnwindInfo(const
   // 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());
+  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";
@@ -426,15 +426,15 @@ static void printWin64EHUnwindInfo(const
       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";
+  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: "
+    outs() << "    Frame register: "
            << getUnwindRegisterName(UI->getFrameRegister()) << "\n";
-    outs() << "  Frame offset: " << 16 * UI->getFrameOffset() << "\n";
+    outs() << "    Frame offset: " << 16 * UI->getFrameOffset() << "\n";
   } else {
-    outs() << "  No frame pointer used\n";
+    outs() << "    No frame pointer used\n";
   }
   if (UI->getFlags() & (UNW_ExceptionHandler | UNW_TerminateHandler)) {
     // FIXME: Output exception handler data
@@ -443,11 +443,11 @@ static void printWin64EHUnwindInfo(const
   }
 
   if (UI->NumCodes)
-    outs() << "  Unwind Codes:\n";
+    outs() << "    Unwind Codes:\n";
 
   printAllUnwindCodes(ArrayRef<UnwindCode>(&UI->UnwindCodes[0], UI->NumCodes));
 
-  outs() << "\n\n";
+  outs() << "\n";
   outs().flush();
 }
 
@@ -460,7 +460,7 @@ static void printRuntimeFunction(const C
   outs() << "Function Table:\n"
          << format("  Start Address: 0x%04x\n", RF.StartAddress)
          << 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;
   if (Obj->getRvaPtr(RF.UnwindInfoOffset, addr))
     return;





More information about the llvm-commits mailing list