<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">OK.  It seems like whatever generated that sh_entsize value for i386 is wrong, but I suppose it’s best to handle it as you have anyway.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">The only problem I see with your patch is that according to the ELF spec zero is a valid value for sh_addralign, and if you pass that to llvm::RoundUpToAlignment
 it will get a divide-by-zero error.  If you check for zero and substitute 1 in that case it should be good to commit.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">-Andy<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Michael Sartain [mailto:mikesart@gmail.com]
<br>
<b>Sent:</b> Friday, August 16, 2013 4:35 PM<br>
<b>To:</b> Kaylor, Andrew<br>
<b>Cc:</b> Greg Clayton; lldb-dev@cs.uiuc.edu<br>
<b>Subject:</b> Re: lldb test failures on 32bit<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">> As for your patch, am I correct in thinking that I should ignore the history in that review? <o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Yeah, sorry. I need to clear arc out.<br>
<br>
> Can you explain the change to me?  What values were you seeing for sh_entsize and sh_addralign?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">On x64, both were 16. On i386, entsize was 4, addralign was 16. The size of the .plt entries are 16 in each case.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thanks!<br>
<br>
On Friday, August 16, 2013, Kaylor, Andrew wrote:<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi Mike,</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">A variation of reloc-fix-32.patch was committed today by Richard Mitton.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I need to do something with stack-fix-32.patch.  If I’m reading the documentation correctly, it appears
 that stack frames really do need to be 8-byte aligned in Darwin even for 32-bit code.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Unfortunately, we’re using the same ABI plugin for 32-bit x86 code on Darwin and Linux and at the
 level where this check is performed we don’t know which we’re looking at.  As far as I know, there really isn’t a significant difference between the two scenarios, so I don’t think we’d want a totally separate ABI plug-in.  I just need to see if there’s an
 easy way to give it a little target information when it’s created so it can handle the special cases.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">As for your patch, am I correct in thinking that I should ignore the history in that review?  Can
 you explain the change to me?  What values were you seeing for sh_entsize and sh_addralign?</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">-Andy</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Michael Sartain [mailto:<a href="javascript:_e(%7b%7d,%20'cvml',%20'mikesart@gmail.com');" target="_blank">mikesart@gmail.com</a>]
<br>
<b>Sent:</b> Thursday, August 15, 2013 1:07 PM<br>
<b>To:</b> Greg Clayton; Kaylor, Andrew<br>
<b>Cc:</b> <a href="javascript:_e(%7b%7d,%20'cvml',%20'lldb-dev@cs.uiuc.edu');" target="_blank">
lldb-dev@cs.uiuc.edu</a><br>
<b>Subject:</b> Re: [lldb-dev] lldb test failures on 32bit</span><o:p></o:p></p>
<p> <o:p></o:p></p>
<div>
<div>
<p>I realized Andrew's reloc-fix-32.patch & stack-fix-32.patch weren't checked in and I didn't have them. Applying both of those with my patch below allows me to step over the 32-bit printf() calls now.<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>Are those patches what you hope to check in at some point Andrew?<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>And please let me know if it's ok to check this in:<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p><a href="http://llvm-reviews.chandlerc.com/D1189" target="_blank">http://llvm-reviews.chandlerc.com/D1189</a><o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>Thanks!<o:p></o:p></p>
</div>
<div>
<p> -Mike<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<p>On Thu, Aug 15, 2013 at 10:39 AM, Michael Sartain <<a href="mailto:mikesart@gmail.com">mikesart@gmail.com</a>> wrote:<o:p></o:p></p>
<div>
<div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<div>
<p>On Tue, Aug 13, 2013 at 6:22 PM, Michael Sartain <<a href="mailto:mikesart@gmail.com">mikesart@gmail.com</a>> wrote:<o:p></o:p></p>
</div>
<div>
<div>
<div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<div>
<p>Unwind info does exist for addresses in main(), and all of this works as expected in x64.<o:p></o:p></p>
</div>
<div>
<div>
<div>
<div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>I'll start debugging where this is failing...<o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<div>
<p> <o:p></o:p></p>
</div>
</div>
<div>
<p>For x86 elf files, the plt_entsize wasn't being rounded to the proper alignment - this was causing the .plt symbols to be incorrect, along with unwind info, etc. This patch fixes that:<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p><a href="http://llvm-reviews.chandlerc.com/D1189" target="_blank">http://llvm-reviews.chandlerc.com/D1189</a><o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>The next problem is we're using the x64 register set, but then calling into the i386 ABI. Ie, this call:<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<div>
<p> 246|     addr_t pc;<o:p></o:p></p>
</div>
<div>
<p> 247+>    if (!ReadGPRValue (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC, pc))<o:p></o:p></p>
</div>
<div>
<p> 248|     {<o:p></o:p></p>
</div>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<p>Winds up here:<o:p></o:p></p>
</div>
<div>
<p> <o:p></o:p></p>
</div>
<div>
<div>
<p>1092|     ExecutionContext exe_ctx(m_thread.shared_from_this());<o:p></o:p></p>
</div>
<div>
<p>1093|     Process *process = exe_ctx.GetProcessPtr();<o:p></o:p></p>
</div>
<div>
<p>1094|     if (have_unwindplan_regloc == false)<o:p></o:p></p>
</div>
<div>
<p>1095|     {<o:p></o:p></p>
</div>
<div>
<p>1096|         // If a volatile register is being requested, we don't want to forward the next frame's register contents<o:p></o:p></p>
</div>
<div>
<p>1097|         // up the stack -- the register is not retrievable at this frame.<o:p></o:p></p>
</div>
<div>
<p>1098|         ABI *abi = process ? process->GetABI().get() : NULL;<o:p></o:p></p>
</div>
<div>
<p>1099|         if (abi)<o:p></o:p></p>
</div>
<div>
<p>1100|         {<o:p></o:p></p>
</div>
<div>
<p>1101+>            const RegisterInfo *reg_info = GetRegisterInfoAtIndex(lldb_regnum);<o:p></o:p></p>
</div>
<div>
<p>1102|             if (reg_info && abi->RegisterIsVolatile (reg_info))<o:p></o:p></p>
</div>
<div>
<p>1103|             {<o:p></o:p></p>
</div>
<div>
<p>1104|                 UnwindLogMsg ("did not supply reg location for %d (%s) because it is volatile",<o:p></o:p></p>
</div>
<div>
<p>1105|                     lldb_regnum, reg_info->name ? reg_info->name : "??");<o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>