<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 18, 2015 at 10:40 AM, Robinson, Paul <span dir="ltr"><<a href="mailto:Paul_Robinson@playstation.sony.com" target="_blank">Paul_Robinson@playstation.sony.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">With my copy of Clang, the two parameters have entirely different types.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">DWARF is describing the mapping of source to object. The two parameters have different types. They have separate locations. When you're stopped at a place where
the parameters are in-scope, the location tells you where to find them. There's no ABI knowledge inherent in any of this.</span></p></div></div></blockquote><div><br>Sorry, I'm clearly doing a bad job of explaining the issues here.<br><br>When you have this code (foo, bar, and func) and this code:<br><br>foo f;<br>bar b;<br>int main() {<br>}<br><br>and you break in main and tell your debugger "print func(f, b)" the debugger needs to know how to setup the call - where to put the parameters. The debug info does not tell the debugger this directly, the debugger uses the debug info and the ABI information to establish this.<br><br>The location information of the parameters inside func is insufficient/irrelevant, because it doesn't necessarily describe the locations of the parameters during the call itself - LLVM's describes the location after these parameters have been moved into allocas in the prologue. The types don't directly describe this (because in part it depends on where they appear in the function parameter list - whether it's a register, a stack slot, etc) and don't describe their triviality directly (they merely describe their member functions and the debugger is left to figure out that that means the parameter has to be indirected)<br><br>Note that the foo parameter, owing to its non-trivial copy ctor doesn't get passed in registers, instead a pointer (to an unnamed local copy in the callee- invoking the copy ctor and all (by the debugger)) is passed instead. But for 'bar' the int member is passed directly in a register.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">--paulr<u></u><u></u></span></p>
<p class="MsoNormal"><a name="14f41e66066f943a__MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></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""> David Blaikie [mailto:<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>]
<br>
<b>Sent:</b> Tuesday, August 18, 2015 10:36 AM<span class=""><br>
<b>To:</b> Robinson, Paul<br>
<b>Cc:</b> <a href="mailto:reviews%2BD7895%2Bpublic%2B7827be49c0b04087@reviews.llvm.org" target="_blank">reviews+D7895+public+7827be49c0b04087@reviews.llvm.org</a>; Romanova, Katya; Eric Christopher; Frédéric Riss; Duncan P. N. Exon Smith; llvm-commits<br>
<b>Subject:</b> Re: [PATCH] D7895: Anonymous namespaces are missing import DW_TAG_imported_module.<u></u><u></u></span></span></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Tue, Aug 18, 2015 at 10:28 AM, Robinson, Paul <<a href="mailto:Paul_Robinson@playstation.sony.com" target="_blank">Paul_Robinson@playstation.sony.com</a>> wrote:<u></u><u></u></p><div><div class="h5">
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Sorry I wasn't clear - I was referring to the ABI lowering of C++ by value parameters. <br>
<br>
struct foo { foo(const foo&); int i; };<br>
struct bar { int i; };<br>
void func(foo, bar) { }<br>
<br>
foo and bar are passed quite differently in the ABI<u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">And the formal parameters are described quite differently in the DWARF,
</span><u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><br>
What differences are you referring to? They're described quite the same. The only difference in the two parameters is their DW_AT_location, and you can't rely on that for the calling convention - it just describes where to find the variable once you're past
the prologue. In LLVM, that's often /just/ the alloca we copy the value into, not the register the parameter was passed in.<br>
<br>
<br>
<u></u><u></u></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"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">meaning the debugger doesn't need special knowledge of the ABI to interpret the DWARF correctly.
I still don't see how this is relevant to the discussion at hand.</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">--paulr</span><u></u><u></u></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div></div></div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div>
</div>
</div>
</blockquote></div><br></div></div>