On Thu, Oct 27, 2011 at 10:39 PM, Talin <span dir="ltr"><<a href="mailto:viridia@gmail.com">viridia@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">On Mon, Oct 24, 2011 at 9:17 AM, Devang Patel <span dir="ltr"><<a href="mailto:dpatel@apple.com" target="_blank">dpatel@apple.com</a>></span> wrote:<br></div></div><div class="gmail_quote">
<div><div></div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><br><div><div>On Oct 23, 2011, at 12:03 AM, Talin wrote:</div><br><blockquote type="cite">Just a follow up on this - I am still having problems, I never did figure out a solution. (I've been running with debug off for the last month so that I could get work done.)<div>
<br></div><div>Here's what I am seeing: I am definitely calling DIBuilder::finalize(). I even put a debug print statement right after it, so that I could be sure that the code was being executed. I also insured that it was getting called before the module was written out, and that no additional debug information gets added after it has been called.</div>
<div><br></div><div>Yet despite this, the second-to-last parameter for DW_TAG_subprogram metadata is in fact null in the module dissassembly.</div><div><br></div><div>So essentially I am completely stumped.</div></blockquote>
<br></div></div><div>If you're using DIBuilder to create your subprogram then you'll see that it puts new node in AllSubprograms.</div><div><br></div><div><div><font face="Monaco" style="font-size:11px"> // Create a named metadata so that we do not lose this mdnode. </font></div>
<div><font face="Monaco" style="font-size:11px"> AllSubprograms.push_back(Node);</font></div><div><br></div></div>And follow AllSubprograms in DIBuilder::finalize()<div><br></div></div></blockquote></div></div><div>I traced through the code in DIBuilder::finalize():</div>
<div><span style="font-family:monospace;white-space:pre-wrap;background-color:rgb(255, 255, 255);font-size:medium"><pre> <b><font color="#A020F0">for</font></b> (<b><font color="#228B22">unsigned</font></b> i = 0, e = SPs.getNumElements(); i != e; ++i) {
DISubprogram SP(SPs.getElement(i));
<b><font color="#A020F0">if</font></b> (NamedMDNode *NMD = getFnSpecificMDNode(M, SP)) {
SmallVector<Value *, 4> Variables;
<b><font color="#A020F0">for</font></b> (<b><font color="#228B22">unsigned</font></b> ii = 0, ee = NMD->getNumOperands(); ii != ee; ++ii)
</pre><div><br></div></span></div><div>It looks as if getFnSpecificMDNode() is always returning NULL in my case - the body of the if statement never gets executed.</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div></div><div></div></div></blockquote></div><div><br></div></blockquote><div>Tracing further, it appears that there are only 4 named MDNodes in the module:</div><div><br></div><div><div>
!<a href="http://llvm.dbg.cu">llvm.dbg.cu</a> = !{!0}</div><div>!tart.module_deps = !{!349}</div><div>!roots.TraceTest = !{!350, !351, !352}</div><div>!tart.xdef.TraceTest = !{!112, !353, !354, !373, !374, !375}</div><div>
<br></div></div><div>In other words, the MDNodes that it is looking for never got created.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div></div>
<font color="#888888">-- <br>-- Talin<br>
</font></blockquote></div><br><br clear="all"><div><br></div>-- <br>-- Talin<br>