<div dir="ltr">Hey Tong,<div><br></div><div>Ah interesting.  The register infos in lldb have a vector of different register numbers (I think we call them "register kinds") based on the type of encoding you're using.  Let's have a look at that to see if we can adjust the code to query for the right register kind.  We'll look at this today!</div>
<div><br></div><div>-Todd</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Aug 12, 2014 at 10:08 AM, Tong Shen <span dir="ltr"><<a href="mailto:endlessroad@google.com" target="_blank">endlessroad@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>Actually there's no patch; just a confirmed bug and a solution.</div><div><br>
</div><div>In eh_frame parsing(DWARFCallFrameInfo.cpp), we just parse the reg_num from dwarf info and use it directly as register number. But DWARF register numbering is slightly different from our internal register numbering.</div>

<div><br></div><div>In DWARF register numbering, i386 register esp=4, ebp=5; but in our register numbering, esp=5, ebp=4. (Other registers in i386, and all registers in x86_64, are consistent)</div><div><br></div><div>So in fact eh_frame parsing for i386 is wrong...</div>

<div><br></div><div>We missed this because:</div><div>1. for leaf function, we use assembly profiler instead of eh_frame;</div><div>2. i386 prologues are usually "push %ebp; mov %ebp, %esp", so esp and ebp are the same. Mistaking esp and ebp actually does not matter, and we can still get correct cfa.</div>

<div><br></div><div>On i386 linux, before fixing this, a C program can only unwind to main(). After fixing this, we can see __libc_start_main() and 2 more frames underneath main().</div><div><br></div><div>I think we should add a DWARFRegisterIdToLLVMRegsiterId or something similar.</div>

<div><br></div><div>Thanks.</div><span class="HOEnZb"><font color="#888888"><div><div><br></div>-- <br><div dir="ltr">Best Regards, Tong Shen</div>
</div></font></span></div>
<br>_______________________________________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@cs.uiuc.edu">lldb-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><table cellspacing="0" cellpadding="0" style="color:rgb(136,136,136);font-family:'Times New Roman'"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small">
<td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Todd Fiala |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td>
<td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tfiala@google.com" style="color:rgb(17,85,204)" target="_blank"><span style="background-color:rgb(255,255,204);color:rgb(34,34,34);background-repeat:initial initial">tfiala@google.com</span></a> |</td>
<td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"><font color="#1155cc"> <a>650-943-3180</a></font></td></tr></tbody></table><br></div>
</div>