[debug-early] C++ clones and limbo DIEs

Aldy Hernandez aldyh@redhat.com
Mon Feb 2 03:15:00 GMT 2015


On 01/31/2015 10:22 PM, Jason Merrill wrote:
> On 01/30/2015 06:49 PM, Aldy Hernandez wrote:
>> +  FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (node)
>> +    if (DECL_ABSTRACT_ORIGIN (node->decl))
>
> If we do this for all functions, not just those with
> DECL_ABSTRACT_ORIGIN set...
>
>> +  /* FIXME: What does this do for templates?  I think we don't want to
>> +     send a template off to early_global_decl, but rather walk through
>> +     its specializations and emit them.  */
>>    for (tree t = level->names; t; t = TREE_CHAIN(t))
>>      debug_hooks->early_global_decl (t);
>
> ...could we drop this hunk?

Well, we'd also have to output globals, which we're currently not doing 
in finalize_compilation_unit.  But if you're ok with generating early 
dwarf for functions as well as globals/statics from 
finalize_compilation_unit() then we could get rid of virtually every 
call to early_global_decl() from the front-ends.

So instead of FOR_EACH_*FUNCTION*, we could have:

+  symtab_node *node;
+  FOR_EACH_SYMBOL (node)
+  {
+    cgraph_node *cn = dyn_cast <cgraph_node *> (node);
+    /* Global symbols get early debug information regardless, but
+       functions need to be visible.  */
+    if (!cn || cn->has_gimple_body_p ())
+      (*debug_hooks->early_global_decl) (node->decl);
+  }

Is this what you have in mind, or did you want to handle globals separately?

Do keep in mind that the above snippet would have the side-effect of not 
creating debug information for optimized away global statics.  I assume 
this is intended or acceptable?

Thanks.
Aldy



More information about the Gcc-patches mailing list