<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 11, 2014 at 11:59 AM, Kevin Enderby <span dir="ltr"><<a href="mailto:enderby@apple.com" target="_blank">enderby@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span class=""><div>On Sep 11, 2014, at 12:11 AM, Steve King <<a href="mailto:steve@metrokings.com" target="_blank">steve@metrokings.com</a>> wrote:</div><br><blockquote type="cite"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">On Wed, Sep 10, 2014 at 8:29 PM, Sean Silva <</span><a href="mailto:chisophugis@gmail.com" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">chisophugis@gmail.com</a><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">> wrote:</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br>Right, you mean like otool's -d (" Display the contents of the<br>(__DATA,__data) section") or -t ("Display  the contents of the<br>(__TEXT,__text) section.  With the -v flag, this disassembles the text.")?<br>;)<br><br></blockquote><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">I've never used otools, but presumably Kevin has some idea here.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"></blockquote><div><br></div></span><div>I’ll try to explain my ideas.  I think what we are talking about is how detailed the disassembly is, that is not printing just the raw bytes of a section and no disassembly.  That is we are not talking about otool(1)’s printing of the text section without the -v flag.</div><div><br></div><div>Disassembly for otool(1) requires -v to get the disassembly of sections with instructions in them.  In this mode (without -V) it will disassembly the instructions but will not try to symbolicate the operands.  For example:</div><div><br></div><div>% otool -tv hello.o</div><div>…</div><div>0000000000000026<span style="white-space:pre-wrap">      </span>callq<span style="white-space:pre-wrap">   </span>0x2b</div><div><br></div><div>With -V then it will attempt to symbolicate the operands (using all the information it has, relocation entries, symbol tables, etc):</div><div><br></div><div>% otool -tV hello.o</div><div>…</div><div>0000000000000026<span style="white-space:pre-wrap">    </span>callq<span style="white-space:pre-wrap">   </span>_printf</div><div><br></div><div>my goal is by default this:</div><div><br></div><div>% llvm-objdump -m -d hello.o</div><div><br></div><div>will do the same as otool(1)’s -tV and produce the best disassembly (or maybe even better).</div><div><br></div><div>But I do want have the option of getting just the disassembly without symbolicating operands.  So I’m thinking that these would would produce the same results:</div><div><br></div><div>% llvm-objdump -m -d hello.o -bare</div><div>% otool -tv hello.o</div><div><br></div><div>with both producing disassembly but not symbolicating operands.  But I’m open to other ways to get this functionality.  One note if your carefully reading non-symbolic operand to the callq instruction above, I want to see the the target address, in this case 0x2b, not the displacement.</div></div></div></blockquote><div><br></div><div>So what is your use case? Are you shipping this tool to users? If you're explicitly trying to replicate otool's behavior, it seems much better to just make a separate tool, or look at argv[0].</div><div><br></div><div>-- Sean Silva</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><span class=""><div><br></div><blockquote type="cite"><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">What is your goal?<br></blockquote><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">A symbolizing disassembler with at least the possibility to tune</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">output to match existing norms per host platform.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">From what I can gather, it seems like you just want to<br>make llvm-objdump's default behavior match GNU objdump, which doesn't seem<br>like a very good direction (how deep is the rabbit hole? why GNU objdump and<br>not tool or the windows one?).<br></blockquote><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">What I personally need is a just symbolizing disassembler.  What my</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">colleagues will expect is a fair approximation of GNU objdump because</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">that's what they already know.  Kevin piped up early that he wanted</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">otools style output, so we ended up at the goal above.</span></blockquote></span></div><br><div>Yep my goal would be the best symbolic disassembly by default.  With switches to turn off the symbolic operands for test cases or the power user who is likely the guy hunting down bugs and needs to see the operands raw.  Basically it would be nice to have a less verbose option for those that need these things.</div><div><br></div><div>For example, the code I added for the Mach-O printing of private headers has a boolean verbose and will do this today.  The call right now is passing in true for verbose but if there was a -bare or some other option I’d wire it up to that parameter.  I don’t really care what we call it and I can live with what ever develops over time.  If nothing does I’ll eventually create a Mach-O specific option to wire this up.</div><div><br></div><div>My thoughts,</div><div>Kev</div></div></blockquote></div><br></div></div>