<br><br><div class="gmail_quote">On Wed, Oct 17, 2012 at 7:57 AM, Eric Christopher <span dir="ltr"><<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">> Yes it looks like our patches are at cross-purposes.<br>
><br>
> I assume that your patch gets the desired effect because there is now a DIE that<br>
> points to the subprogram's generated code?  That's not good for me, because if<br>
> there's a class method definition DIE, it insists on having a declaration DIE too.<br>
> I'm not sure whether the same is true for standalone functions.<br>
><br>
> I wonder if there is a way we could produce an artificial subprogram DIE, but then<br>
> have LLVM not actually emit it to the DWARF.  That is, suppress the excess DWARF<br>
> in LLVM rather than in Clang.  If lives long enough to build the address ranges (and<br>
> also .debug_line?) it would meet your needs, and then if it doesn't actually get emitted<br>
> to .debug_info, it would meet my needs.<br></div></blockquote><div><br></div><div>What are your needs? Do you want to keep the .debug_info smaller, or this DIE may</div><div>be malformed and cause problems for you? I'm somewhat afraid that data in</div>
<div>.debug_line would not be enough for me. This depends on the way a tool maps</div><div>instruction address to compile unit. One of the way is:</div><div>1) get the compile unit DIE</div><div>2) get a DWARF line table for this DIE</div>
<div>3) parse the table and build address ranges for this compile unit.</div><div><br></div><div>This (step 3) is of course inefficient.</div><div>Currently LLVM's DebugInfo lib does the following:</div><div>1) get the compile unit DIE</div>
<div>2) get all subprogram DIEs for this CU</div><div>3) collects address ranges for these subprograms.</div><div><br></div><div>So, for such an approach, I need the debug_info entries for artificial functions and methods.</div>
<div>generated by Clang. I even may need entries for functions with disabled debug</div><div>info. What I don't need is the debug info for bodies of these functions (all the local variables</div><div>etc.).</div><div>
<br></div><div>Probably the best way is to use .debug_ranges section and add</div><div>a single DW_AT_ranges into the compile unit DIE. In this way we'll be able</div><div>to get all the instruction address ranges for compile unit without scanning any</div>
<div>additional DIEs (or using weird .debug_aranges section).</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
<br>
</div>I'm more than happy to revert r158009, I originally added it to reduce<br>
the amount of debug information since often people would not be trying<br>
to add break points or debug through an artificial function. Alexey's<br>
patch and motivation, however, lead me to believe that this was<br>
originally incorrect as we may want a backtrace with information and<br>
line numbers that includes artificial functions like global<br>
constructors.<br>
<br>
Either of you have an argument against reverting it?<br></blockquote><div><br></div><div>I have not.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<span class="HOEnZb"><font color="#888888"><br>
-eric<br>
</font></span></blockquote></div><br clear="all"><div><br></div>-- <br><div>Alexey Samsonov, MSK</div><br>