<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=utf-8">
<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;}
span.hoenzb
        {mso-style-name:hoenzb;}
span.EmailStyle18
        {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" style="margin-left:.5in">Yes this is exactly the edge case that we were relying on up to now. There are two problems I have with that:<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">a) how do we implement the “defined by the ABI” predicate correctly? Assume that it’s always the subregister at offset 0 and wait until someone complains?<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:4.8pt"><br>
I'd probably be OK with this, open to other opinions, but it seems pretty simply like "we stuffed this number in a big register, but we don't need all the bits in the big register, so take the lowest bits that we specify" - any platform that did anything stranger
 than that... well, we should probably have a talk with/about them anyway, so I wouldn't mind if them running into this feature was what caused us to have that discussion.<br>
<br>
<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">You mean like X86 vector registers?  They're implicitly arrays/structs of values of a smaller size. I don't know that the value of interest always ends up in
 the "low" part, but maybe it does. I really don't have a handle on X86 vector instructions.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">--paulr<o:p></o:p></span></p>
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></a></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<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""> llvm-commits-bounces@cs.uiuc.edu [mailto:llvm-commits-bounces@cs.uiuc.edu]
<b>On Behalf Of </b>David Blaikie<br>
<b>Sent:</b> Tuesday, March 10, 2015 3:36 PM<br>
<b>To:</b> Adrian Prantl<br>
<b>Cc:</b> reviews+D8233+public+f5c9e8745840f37b@reviews.llvm.org; llvm-commits@cs.uiuc.edu<br>
<b>Subject:</b> Re: [PATCH] Fix the remainder of PR22762 (GDB is crashing on DW_OP_piece being used inside of DW_AT_frame_base)<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Tue, Mar 10, 2015 at 3:26 PM, Adrian Prantl <<a href="mailto:aprantl@apple.com" target="_blank">aprantl@apple.com</a>> wrote:<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">On Mar 10, 2015, at 3:14 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Tue, Mar 10, 2015 at 2:50 PM, Adrian Prantl <<a href="mailto:aprantl@apple.com" target="_blank">aprantl@apple.com</a>> wrote:<o:p></o:p></p>
<p class="MsoNormal">Hi echristo, dblaikie,<br>
<br>
<a href="http://llvm.org/bugs/show_bug.cgi?id=22762" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=22762</a><br>
The symptom was that DW_AT_frame_base should never use a DW_OP_(bit)_piece, the bug was that AddMachineRegPiece incorrectly created pieces to describe values that occupy only a subregister. Change this to emit a bit mask instead.<br>
<br>
I'm posting this for review because emitting the bit mask increases the size occupied for DWARF expressions for sub-registers (~5 bytes for a 32-bit subregister). Previously we would (incorrectly!) use DW_OP_piece to describe a value occupying part of a register.
 However, "DW_OP_piece provides a way of describing how large a part of a variable a particular DWARF location description refers to.",<o:p></o:p></p>
<div>
<p class="MsoNormal"><br>
The spec also says "If the piece is located in a register, but does not occupy the entire register, the placement of the piece within that register is defined by the ABI. " - so we can use this in some cases at least. Should we? I assume it just means if we
 say _piece of size 1 in a register of size 4 we get the low byte (whatever definition of 'low' there is)?<br>
 <o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">not the size and offset of an entire variable inside a super-register. The way that most debuggers implement DW_OP_piece this sort of works out for subregisters that are at offset 0, but it causes confusion if the expression needs to be
 composed (such as in DW_AT_frame_base, or if the subregister contains only a part of the variable).<o:p></o:p></p>
</blockquote>
</div>
</div>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Yes this is exactly the edge case that we were relying on up to now. There are two problems I have with that:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">a) how do we implement the “defined by the ABI” predicate correctly? Assume that it’s always the subregister at offset 0 and wait until someone complains?<o:p></o:p></p>
</div>
</div>
</div>
<div>
<p class="MsoNormal"><br>
I'd probably be OK with this, open to other opinions, but it seems pretty simply like "we stuffed this number in a big register, but we don't need all the bits in the big register, so take the lowest bits that we specify" - any platform that did anything stranger
 than that... well, we should probably have a talk with/about them anyway, so I wouldn't mind if them running into this feature was what caused us to have that discussion.<br>
 <o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<div>
<p class="MsoNormal">b) it doesn’t compose well, so we’d need to explicitly forbid it inside of DW_AT_frame_base and inside of a larger piece expression.<o:p></o:p></p>
</div>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><br>
This bit I don't really understand - perhaps you could provide some expression examples?<br>
 <o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal">b) is doable, if ugly, but I’d need some help with a).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="color:#888888"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:#888888">-- adrian<o:p></o:p></span></p>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</div>
</body>
</html>