From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 77345 invoked by alias); 24 Aug 2018 13:18:41 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 77237 invoked by uid 89); 24 Aug 2018 13:18:41 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,KAM_SHORT,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 24 Aug 2018 13:18:39 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 78808AECE; Fri, 24 Aug 2018 13:18:37 +0000 (UTC) Date: Fri, 24 Aug 2018 13:18:00 -0000 From: Richard Biener To: Tom de Vries cc: Kevin Buettner , gdb-patches@sourceware.org, Jakub Jelinek Subject: Re: [RFC, gdb/exp] Handle DW_OP_GNU_variable_value refs to abstract dies In-Reply-To: <982919b5-93ba-3840-5839-6accc904b459@suse.de> Message-ID: References: <20180802210405.5c04ca7a@pinnacle.lan> <20180802211754.40a529c2@pinnacle.lan> <87o9ej1emk.fsf@tromey.com> <20180818133158.7e5b4dcb@pinnacle.lan> <93529546-71b0-4268-880a-79b00062ecd2@suse.de> <20180823141240.577345e0@pinnacle.lan> <982919b5-93ba-3840-5839-6accc904b459@suse.de> User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SW-Source: 2018-08/txt/msg00592.txt.bz2 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 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.