Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: Tom de Vries <tdevries@suse.de>
Cc: Kevin Buettner <kevinb@redhat.com>,
	gdb-patches@sourceware.org,     Jakub Jelinek <jakub@redhat.com>
Subject: Re: [RFC, gdb/exp] Handle DW_OP_GNU_variable_value refs to abstract dies
Date: Fri, 24 Aug 2018 13:18:00 -0000	[thread overview]
Message-ID: <alpine.LSU.2.20.1808241511470.16707@zhemvz.fhfr.qr> (raw)
In-Reply-To: <982919b5-93ba-3840-5839-6accc904b459@suse.de>

On Fri, 24 Aug 2018, Tom de Vries wrote:

> [ was: Re: [PATCH 1/3] Add support for DW_OP_GNU_variable_value ]
> 
> On 08/23/2018 11:12 PM, Kevin Buettner wrote:
> > On Wed, 22 Aug 2018 17:35:23 +0200
> > Tom de Vries <tdevries@suse.de> wrote:
> > 
> >> On 08/18/2018 10:31 PM, Kevin Buettner wrote:
> >>>     This patch adds support for DW_OP_GNU_variable_value to GDB.
> >>>     
> >>>     Jakub Jelinek provides a fairly expansive discussion of this DWARF
> >>>     expression opcode in his GCC patch...
> >>>     
> >>>         https://gcc.gnu.org/ml/gcc-patches/2017-02/msg01499.html
> >>>     
> >>>     It has also been proposed for addition to the DWARF Standard:
> >>>     
> >>>         http://www.dwarfstd.org/ShowIssue.php?issue=161109.2  
> >>
> >> Hi,
> >>
> >> AFAIU from the discussion here (
> >> https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01351.html ) if:
> >> - a DW_OP_GNU_variable_value refers to a die 'a', and
> >> - there's a die 'b' with abstract_origin 'a' that does have a
> >>   DW_AT_location, and
> >> - die 'b' is 'in scope' in an evaluation context,
> >> then the evaluation of DW_OP_GNU_variable_value 'a' should return the
> >> value found at the DW_AT_location of die 'b'.
> >>
> >> I've written a gcc demonstrator patch to generate code like this for
> >> VLAs, and found that gdb master (containing this patch series) does not
> >> support this.
> >>
> >> Is this further support of DW_OP_GNU_variable_value something you're
> >> currently working on, or plan to work on?
> > 
> > Tom and I discussed this briefly on IRC.  Tom says that he'll take
> > a look at it...
> > 
> 
> Hi,
> 
> sofar I've written:
> - a hack that fixes the test-case I have, without regressing anything,
>   and
> - the rationale for the change,
> hoping that this should sufficiently explain what we're trying to implement.
> 
> Hints on how to implement are welcome.

I wonder if there isn't already support to lookup 'd' when the
DIE of the concrete instance just has the location and refers to
'd' via an abstract origin.  So the idea is to do this kind of
lookup from the original context of the conrete instance we came
from when evaluating DW_OP_GNU_variable_value on the 
abstract instance DIE.

Btw, apart from the use with early debug / LTO this would make it
possible to remove repeating VLA types in inline instances.  If you
build the following with -O -g you get three instances of int[n]
DIEs, one in the abstract copy and two generated for the
DW_TAG_inlined_subroutine in bar.  Ideally we could elide those,
having the type of a fully specified in the abstract instance
and the concrete instances providing locations for n.

static inline void foo (int n) { int a[n]; }
int bar(int n1, int n2)
{
  foo (n1);
  foo (n2);
}

Richard.


  reply	other threads:[~2018-08-24 13:18 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-03  4:04 [PATCH 0/3] Add support for DW_OP_GNU_variable_value Kevin Buettner
2018-08-03  4:18 ` [PATCH 1/3] " Kevin Buettner
2018-08-03 18:36   ` Tom Tromey
2018-08-18 20:32     ` Kevin Buettner
2018-08-22 15:35       ` Tom de Vries
2018-08-23 21:12         ` Kevin Buettner
2018-08-24 13:09           ` [RFC, gdb/exp] Handle DW_OP_GNU_variable_value refs to abstract dies Tom de Vries
2018-08-24 13:18             ` Richard Biener [this message]
2018-09-04 10:17             ` [PATCH, " Tom de Vries
2018-09-04 13:06               ` Tom de Vries
2018-09-04 21:54                 ` Kevin Buettner
2018-09-05 10:53                   ` Tom de Vries
2018-09-06  3:46                   ` Tom Tromey
2018-09-06  6:40                     ` Tom de Vries
2018-09-06 13:11                       ` Tom Tromey
2018-08-03 18:43   ` [PATCH 1/3] Add support for DW_OP_GNU_variable_value Tom Tromey
2018-08-03  4:19 ` [PATCH 2/3] Add support of DW_OP_GNU_variable_value to DWARF assembler Kevin Buettner
2018-08-03 18:37   ` Tom Tromey
2018-08-18 20:32     ` Kevin Buettner
2018-08-03  4:22 ` [PATCH 3/3] Test case for DW_OP_GNU_variable_value Kevin Buettner
2018-08-03 18:40   ` Tom Tromey
2018-08-18 20:32     ` Kevin Buettner

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.20.1808241511470.16707@zhemvz.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=jakub@redhat.com \
    --cc=kevinb@redhat.com \
    --cc=tdevries@suse.de \
    /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