public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: Aldy Hernandez <aldyh@redhat.com>
Cc: gcc-patches@gcc.gnu.org, jason@redhat.com
Subject: Re: [PATCH][1/n] dwarf2out refactoring for early (LTO) debug
Date: Thu, 20 Aug 2015 09:31:00 -0000	[thread overview]
Message-ID: <alpine.LSU.2.11.1508201107060.4884@zhemvz.fhfr.qr> (raw)
In-Reply-To: <alpine.LSU.2.11.1508191531490.19998@zhemvz.fhfr.qr>

On Wed, 19 Aug 2015, Richard Biener wrote:

> On Tue, 18 Aug 2015, Aldy Hernandez wrote:
> 
> > On 08/18/2015 07:20 AM, Richard Biener wrote:
> > > 
> > > This starts a series of patches (still in development) to refactor
> > > dwarf2out.c to better cope with early debug (and LTO debug).
> > 
> > Awesome!  Thanks.
> > 
> > > Aldyh, what other testing did you usually do for changes?  Run
> > > the gdb testsuite against the new compiler?  Anything else?
> > 
> > gdb testsuite, and make sure you test GCC with --enable-languages=all,go,ada,
> > though the latter is mostly useful while you iron out bugs initially.  I found
> > that ultimately, the best test was C++.
> 
> I see.
> 
> > Pre merge I also bootstrapped the compiler and compared .debug* section sizes
> > in object files to make sure things were within reason.
> > 
> > > +
> > > +static void
> > > +vmsdbgout_early_finish (const char *filename ATTRIBUTE_UNUSED)
> > > +{
> > > +  if (write_symbols == VMS_AND_DWARF2_DEBUG)
> > > +    (*dwarf2_debug_hooks.early_finish) (filename);
> > > +}
> > 
> > You can get rid of ATTRIBUTE_UNUSED now.
> 
> Done.  I've also refrained from moving
> 
>   gen_scheduled_generic_parms_dies ();
>   gen_remaining_tmpl_value_param_die_attribute ();
> 
> for now as that causes regressions I have to investigate.

Tricky beast ;)  For g++.dg/debug/dwarf2/template-func-params-3.C
we run into the issue that when doing early dwarf the
rtl_for_decl_init (&bleh) call will fail because it ends up asking

15809              && ! walk_tree (&init, reference_to_unused, NULL, NULL)

which uses TREE_ASM_WRITTEN to see of 'bleh' was emitted or not.
That's not going to work at this stage - we even have no idea
whether 'bleh' is going to survive IPA or not (might be inlined).
With LTO it gets even tricker as we only see a subset of the whole
program (or original TU) at LTRANS stage.

So it somehow looks like late dwarf thing for this kind of
symbolic constants - but it _also_ looks like a very bad
dwarf representation to me (going through RTL is bad enough, heh).
We expect DW_OP_addr and a reference to _Z4blehv as follows:

        .byte   0x3     # DW_OP_addr
        .quad   _Z4blehv

but I wonder if DWARF has something better so we can refer
to _Z4blehv by means of the DIE for its declaration (so the
debugger can resolve the constant value)?  That would allow
the debugger to print &bleh even if bleh was optimized out
(it just would have to print <optimized out> for the actual
address).

So what I'll do is have two phases of
gen_remaining_tmpl_value_param_die_attribute 
(gen_scheduled_generic_parms_dies doesn't have a similar issue
AFAICS), during early-debug add those we can, retaining those
we can only handle late (just checking the return value of
tree_add_const_value_attribute).  For LTO the remaining ones
will be dropped on the floor (or we'd have to stream them
somehow) unless we can change the DWARF representation of
these symbolic constants.

Thanks,
Richard.

  parent reply	other threads:[~2015-08-20  9:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-18 14:42 Richard Biener
2015-08-18 19:48 ` Aldy Hernandez
2015-08-19  9:36   ` Yao Qi
2015-08-19 13:55   ` Richard Biener
2015-08-19 13:57     ` Aldy Hernandez
2015-08-19 14:54       ` Pedro Alves
2015-08-20  9:31     ` Richard Biener [this message]
2015-08-20 10:25     ` Richard Biener
2015-08-20 10:32       ` Richard Biener
2015-08-21 13:46         ` Richard Biener
2015-08-26 10:50     ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LSU.2.11.1508201107060.4884@zhemvz.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=aldyh@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).