<div dir="ltr">This is so much nicer!<div><br></div><div>-- Sean Silva</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 29, 2014 at 5:19 PM, Nick Kledzik <span dir="ltr"><<a href="mailto:kledzik@apple.com" target="_blank">kledzik@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: kledzik<br>
Date: Mon Sep 29 19:19:58 2014<br>
New Revision: 218649<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=218649&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=218649&view=rev</a><br>
Log:<br>
[llvm-objdump] switch some uses of format() to format_hex() and left_justify()<br>
<br>
Modified:<br>
llvm/trunk/tools/llvm-objdump/MachODump.cpp<br>
<br>
Modified: llvm/trunk/tools/llvm-objdump/MachODump.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MachODump.cpp?rev=218649&r1=218648&r2=218649&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MachODump.cpp?rev=218649&r1=218648&r2=218649&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/llvm-objdump/MachODump.cpp (original)<br>
+++ llvm/trunk/tools/llvm-objdump/MachODump.cpp Mon Sep 29 19:19:58 2014<br>
@@ -2829,8 +2829,8 @@ void llvm::printMachOBindTable(const obj<br>
// Build table of sections so names can used in final output.<br>
SegInfo sectionTable(Obj);<br>
<br>
- outs() << "segment section address type "<br>
- "addend dylib symbol\n";<br>
+ outs() << "segment section address type "<br>
+ "addend dylib symbol\n";<br>
for (const llvm::object::MachOBindEntry &Entry : Obj->bindTable()) {<br>
uint32_t SegIndex = Entry.segmentIndex();<br>
uint64_t OffsetInSeg = Entry.segmentOffset();<br>
@@ -2840,18 +2840,17 @@ void llvm::printMachOBindTable(const obj<br>
<br>
// Table lines look like:<br>
// __DATA __got 0x00012010 pointer 0 libSystem ___stack_chk_guard<br>
- outs() << format("%-8s %-18s 0x%08" PRIX64 " %-8s %-8" PRId64 " %-20s",<br>
- SegmentName.str().c_str(),<br>
- SectionName.str().c_str(),<br>
- Address,<br>
- Entry.typeName().str().c_str(),<br>
- Entry.addend(),<br>
- ordinalName(Obj, Entry.ordinal()).str().c_str())<br>
- << Entry.symbolName();<br>
+ StringRef Attr;<br>
if (Entry.flags() & MachO::BIND_SYMBOL_FLAGS_WEAK_IMPORT)<br>
- outs() << " (weak_import)\n";<br>
- else<br>
- outs() << "\n";<br>
+ Attr = " (weak_import)";<br>
+ outs() << left_justify(SegmentName, 8) << " "<br>
+ << left_justify(SectionName, 18) << " "<br>
+ << format_hex(Address, 10, true) << " "<br>
+ << left_justify(Entry.typeName(), 8) << " "<br>
+ << format_decimal(Entry.addend(), 8) << " "<br>
+ << left_justify(ordinalName(Obj, Entry.ordinal()), 16) << " "<br>
+ << Entry.symbolName()<br>
+ << Attr << "\n";<br>
}<br>
}<br>
<br>
@@ -2863,8 +2862,8 @@ void llvm::printMachOLazyBindTable(const<br>
// Build table of sections so names can used in final output.<br>
SegInfo sectionTable(Obj);<br>
<br>
- outs() << "segment section address "<br>
- "dylib symbol\n";<br>
+ outs() << "segment section address "<br>
+ "dylib symbol\n";<br>
for (const llvm::object::MachOBindEntry &Entry : Obj->lazyBindTable()) {<br>
uint32_t SegIndex = Entry.segmentIndex();<br>
uint64_t OffsetInSeg = Entry.segmentOffset();<br>
@@ -2874,11 +2873,10 @@ void llvm::printMachOLazyBindTable(const<br>
<br>
// Table lines look like:<br>
// __DATA __got 0x00012010 libSystem ___stack_chk_guard<br>
- outs() << format("%-8s %-18s 0x%08" PRIX64 " %-20s",<br>
- SegmentName.str().c_str(),<br>
- SectionName.str().c_str(),<br>
- Address,<br>
- ordinalName(Obj, Entry.ordinal()).str().c_str())<br>
+ outs() << left_justify(SegmentName, 8) << " "<br>
+ << left_justify(SectionName, 18) << " "<br>
+ << format_hex(Address, 10, true) << " "<br>
+ << left_justify(ordinalName(Obj, Entry.ordinal()), 16) << " "<br>
<< Entry.symbolName() << "\n";<br>
}<br>
}<br>
@@ -2892,12 +2890,12 @@ void llvm::printMachOWeakBindTable(const<br>
// Build table of sections so names can used in final output.<br>
SegInfo sectionTable(Obj);<br>
<br>
- outs() << "segment section address "<br>
- "type addend symbol\n";<br>
+ outs() << "segment section address "<br>
+ "type addend symbol\n";<br>
for (const llvm::object::MachOBindEntry &Entry : Obj->weakBindTable()) {<br>
// Strong symbols don't have a location to update.<br>
if (Entry.flags() & MachO::BIND_SYMBOL_FLAGS_NON_WEAK_DEFINITION) {<br>
- outs() << " strong "<br>
+ outs() << " strong "<br>
<< Entry.symbolName() << "\n";<br>
continue;<br>
}<br>
@@ -2909,12 +2907,11 @@ void llvm::printMachOWeakBindTable(const<br>
<br>
// Table lines look like:<br>
// __DATA __data 0x00001000 pointer 0 _foo<br>
- outs() << format("%-8s %-18s 0x%08" PRIX64 " %-8s %-8" PRId64 " ",<br>
- SegmentName.str().c_str(),<br>
- SectionName.str().c_str(),<br>
- Address,<br>
- Entry.typeName().str().c_str(),<br>
- Entry.addend())<br>
+ outs() << left_justify(SegmentName, 8) << " "<br>
+ << left_justify(SectionName, 18) << " "<br>
+ << format_hex(Address, 10, true) << " "<br>
+ << left_justify(Entry.typeName(), 8) << " "<br>
+ << format_decimal(Entry.addend(), 8) << " "<br>
<< Entry.symbolName() << "\n";<br>
}<br>
}<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>