public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Jason Merrill <jason@redhat.com>,Aldy Hernandez
	<aldyh@redhat.com>,GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fix early debug regression with DW_AT_string_length (PR debug/71906)
Date: Tue, 09 Aug 2016 17:10:00 -0000	[thread overview]
Message-ID: <082C92EB-A15B-4776-AA5A-8C1DB29E9B00@gmail.com> (raw)
In-Reply-To: <20160809143624.GW14857@tucnak.redhat.com>

On August 9, 2016 4:36:24 PM GMT+02:00, Jakub Jelinek <jakub@redhat.com> wrote:
>On Mon, Aug 01, 2016 at 12:44:30PM +0200, Richard Biener wrote:
>> Note that reading the dwarf standard, it looks like it accepts a
>location
>> which means we could do an implicit location description using
>> DW_OP_stack_value which gives us access to arbitrary dwarf
>> expressions (and thus the possibility to handle it similar to VLAs).
>
>Sure.  But for the DW_AT_string_length, the issue is that with early
>debug,
>we want the attribute early, but locations within a function obviously
>can be provided late, after the function is compiled.
>
>Which is why the patch uses DW_OP_call4 as the holder of the
>information
>that the string length is provided by the value of some variable.
>In certain cases it can stay that way even during late debug, if the
>var
>disappears or has no location info etc., then DW_AT_string_length is
>dropped, or in other cases the location of the var is copied into the
>attribute etc.
>
>This is different from the VLA bounds in DW_AT_upper_bound etc., where
>it is allowed to just refer to a DIE that holds the value (so we can
>stick
>it into the attribute early and just supply the var's location later),
>for
>DW_AT_string_length it is not allowed.
>
>> But maybe I am missing something?  (now running into the issue
>> with LTO debug and gfortran.dg/save_5.f90 where during early debug
>> we emit a location that ends up refering to a symbol that might be
>> optimized away later - early debug cannot sanitize referenced symbols
>> via resolv_addr obviously).  Annotating the DIE late is also not
>> what I want to do as I'd need to pull in all type DIEs into the late
>CU
>> that way (well, at least selected ones, but I'm really trying to
>avoid
>> going down that route).
>
>In some cases like location of file scope vars, or this
>DW_AT_string_length,
>you really need to adjust late the debug info created early, there is
>no
>workaround for that.

I suppose the workaround is to fix/extend DWARF... (DW_AT_GNU_string_length that allows us to refer to another DIE?)

Richard.

>	Jakub


  reply	other threads:[~2016-08-09 17:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-21 16:53 Jakub Jelinek
2016-07-22 11:55 ` Richard Biener
2016-07-22 12:08   ` Jakub Jelinek
2016-07-22 12:39     ` Richard Biener
2016-08-01 10:44       ` Richard Biener
2016-08-09 14:36         ` Jakub Jelinek
2016-08-09 17:10           ` Richard Biener [this message]
2016-08-10  8:17             ` Jakub Jelinek
2016-08-10 10:23               ` Richard Biener
2016-08-11 12:36                 ` Jakub Jelinek
2016-08-11 14:09                   ` Richard Biener
2016-08-12 17:47 ` Jason Merrill
2016-08-12 17:57   ` Jakub Jelinek
2016-08-15 10:07     ` Jakub Jelinek

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=082C92EB-A15B-4776-AA5A-8C1DB29E9B00@gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=aldyh@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --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).