This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][PR debug/65549] Restore DW_AT_abstract_origin for cross-unit call sites


On Wed, 10 Jun 2015, Pierre-Marie de Rodat wrote:

> Thank you for your answer, Richard!
> 
> On 06/10/2015 08:58 AM, Richard Biener wrote:
> > Hmm, so the underlying issue is that we don't associate comp_unit_die ()
> > with any TRANSLATION_UNIT_DECL.
> 
> Indeed.
> 
> > For the LTO early debug work I did the following at the very
> > beginning of dwarf2out_early_finish:
> > 
> >    /* Pick the first TRANSLATION_UNIT_DECL we didn't create a DIE for
> >       and equate it with our default CU DIE.  LTO output needs to be
> >       able to lookup DIEs for translation unit decls.  */
> >    unsigned i;
> >    tree decl;
> >    FOR_EACH_VEC_SAFE_ELT (all_translation_units, i, decl)
> >      if (!lookup_decl_die (decl))
> >        equate_decl_number_to_die (decl, comp_unit_die ());
> 
> If I understand correctly, this does not only "pick the first" (as the comment
> says) but do equate for all DIE-less units, right? Why isn't this hunk in
> mainline yet by the way?

Hmm, yes.  It meant to break after the first ;)  (without LTO
there usually is only one TU decl, apart from Java I think).
The hunk isn't in mainline because it was part of an experimental patch I 
did on the early-debug branch.

> 
> > We create some DIEs for builtin types too early before frontends
> > got a chance to build their TRANSLATION_UNIT_DECL, so comp_unit_die
> > gets created before there is any TRANSLATION_UNIT_DECL.  Another
> > approach would of course be that the Frontends register their main
> > TRANSLATION_UNIT_DECL with dwarf2out via a debug hook.
> > 
> > But - does the above work for you and fix the regression?  If so
> > adding a debug hook would probably be the cleaner solution still.
> 
> Yes it does, thanks! However we need to fix this on the 4.9 branch as well and
> this patch would need reworking to be applied there (no debug early). So
> here's a patch that introduce a register_main_translation_unit debug hook: is
> this what you had in mind? This works for me on the 4.9 branch and on mainline
> as well, regtested on x86_64-linux.

Yeah, that looks great!

Of course I wonder about Java (builds multiple ones, one for each
input file) and Go (no idea).  I suppose Java would need to build
another one where all the "defaults" go (or it doesn't have any
such entities).

In theory we could have changed dwarf2out_init to get a
translation-unit-decl argument as well.  But your patch looks like
we don't have such at the point of dwarf2out_init in all frontends.

Your patch is ok (and ok to backport) IMHO, though please give
others the chance to chime in.

Thanks,
Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]