<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 11, 2014 at 1:30 PM, 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span class=""><div>On Sep 11, 2014, at 1:09 PM, Sean Silva <<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a>> wrote:</div><br><blockquote type="cite"><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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span><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?</div></div></div></div></blockquote><div><br></div></span>My use case for -v without -V is for developers like myself that have to debug broken binaries. Â The use case for using a target address not a displacement is one can actually follow the flow control if the disassembly without knowing how each instruction works and doing the math to see where branches and calls go.</div></div></blockquote><div><br></div><div>Sorry, what I mean was: what is your use case that is motivating you to ship this tool to users? Did you literally get a user request "I want llvm-objdump"? </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div><span class=""><br><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> Are you shipping this tool to users?</div></div></div></div></blockquote><div><br></div></span>Yes otool(1) has always been shipped to users with the developer tools. Â The hope is to ship llvm-objdump to users at some point too.</div></div></blockquote><div><br></div><div>Shipping llvm-objdump to users puts it under a much stronger compatibility contract than any of the other tools (except obviously the clang driver). That along I think is enough to motivate splitting it out into a separate tool.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div><span class=""><br><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> 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></div></div></blockquote><div><br></div></span>With the -m (or -macho) option for llvm-objdump to "Use MachO specific object file parser” I’m hoping to replicate otool(1)’s behavior but in the clang tree so all can use and improve it.</div></div></blockquote><div><br></div><div>I think it would make more sense to make a separate tool that does exactly what you want, so that you don't have to bother users with -m or anything. What code, if any, are you sharing with the rest of llvm-objdump?<br></div><div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><span class=""><div><br><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>-- Sean Silva</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div><span><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>
</blockquote></div><br></span></div></blockquote></div><br></div></div>