On Tue, Sep 7, 2010 at 1:56 AM, Renato Golin <span dir="ltr"><<a href="mailto:rengolin@systemcall.org">rengolin@systemcall.org</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 class="im">On 6 September 2010 01:05, Talin <<a href="mailto:viridia@gmail.com">viridia@gmail.com</a>> wrote:<br>
> DISubprogram CodeGenerator::genDISubprogram(const FunctionDefn * fn,<br>
</div>(...)<br>
>         false /* isDefinition */,<br>
(...)<br>
<br>
Hi Talin,<br>
<br>
The only difference from what I'm doing is that I only export debug<br>
symbols in definitions, not declarations. I may be doing wrong,<br>
though, for multi-file compilation (haven't tested thoroughly).<br>
<div class="im"><br>
<br>
<br>
> DICompositeType CodeGenerator::genDIFunctionType(const FunctionType * type)<br>
</div>(...)<br>
<div class="im">>   for (ParameterList::const_iterator it = params.begin(); it !=<br>
> params.end(); ++it) {<br>
>     const ParameterDefn * param = *it;<br>
>     args.push_back(genDIParameterType(param->type()));<br>
>   }<br>
<br>
</div>Don't do that. I know it looks right, but it's broken in DIFactory.<br>
<div class="im"><br>
<br>
>   DICompositeType fnType = dbgFactory_.CreateCompositeType(<br>
>       dwarf::DW_TAG_subroutine_type,<br>
>       dbgCompileUnit_,<br>
<br>
</div>I use the file here, not the compile unit... But again, I could be wrong.<br>
<br>
Hope that puts you in the right direction.<br></blockquote><div><br></div><div>OK I made 3 changes:</div><div>-- changed isDefinition to true. (I'm also only generating debug info for definitions.)</div><div>-- commented out the code that pushes parameter types to the arg list. (Still push the return type however.)</div>

<div>-- changed the call that creates the subroutine type to use DIFile rather than DICompileUnit as the context param.</div><div><br></div><div>It still segfaults however. :(</div><div><br></div><div>I should mention that I don't actually know if the CreateSubprogram call is even related to the problem. I know that when I comment out the call, the segfault goes away - however, that just might mean that the problem is still there but is not being triggered. </div>

<div><br></div><div>I have to admit I am rather confused about the proper usage of DIFile and DICompileUnit. Both of these are DIScopes, but it's not clear to me whether the symbols within a module should be the children of one or the other. Many of the DIFactory parameters take an explicit DIFile, so those cases are clear - but many of the other context params only have DIDescriptor as their type, so there's not a lot of guidance as to which is the right type of DIDescriptor to use.</div>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<font color="#888888"><br>
--<br>
</font><div><div></div><div class="h5">cheers,<br>
--renato<br>
<br>
<a href="http://systemcall.org/" target="_blank">http://systemcall.org/</a><br>
<br>
Reclaim your digital rights, eliminate DRM, learn more at<br>
<a href="http://www.defectivebydesign.org/what_is_drm" target="_blank">http://www.defectivebydesign.org/what_is_drm</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>-- Talin<br>