From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 99445 invoked by alias); 24 Aug 2018 10:44:43 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 99432 invoked by uid 89); 24 Aug 2018 10:44:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: =?ISO-8859-1?Q?No, score=-6.9 required=5.0 tests=BAYES_00,GIT_PATCH_1,SPF_PASS autolearn=ham version=3.3.2 spammy=developer-only, name=e2, 2.20, 0x7fffffffda90?= 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 10:44:41 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 819EDAD68; Fri, 24 Aug 2018 10:44:38 +0000 (UTC) Date: Fri, 24 Aug 2018 10:44:00 -0000 From: Richard Biener To: Tom de Vries cc: gcc-patches@gcc.gnu.org, Jakub Jelinek , Jason Merrill , Cary Coutant Subject: Re: [PATCH][debug] Add -gdescriptive-dies In-Reply-To: <516e20a1-0a30-958c-7cd2-848a4879dc4a@suse.de> Message-ID: References: <20180815140258.GA1999@delia> <21062fd5-5697-8da0-44ea-1f0c14e81f33@suse.de> <077f3e77-79b8-4f33-a135-990a885cf999@suse.de> <516e20a1-0a30-958c-7cd2-848a4879dc4a@suse.de> User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="-1609908220-348114482-1535107478=:16707" X-SW-Source: 2018-08/txt/msg01523.txt.bz2 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---1609908220-348114482-1535107478=:16707 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Content-length: 3031 On Wed, 22 Aug 2018, Tom de Vries wrote: > [ was: Re: [PATCH][debug] Add -gforce-named-dies ] > > On 08/22/2018 11:46 AM, Tom de Vries wrote: > > On 08/22/2018 08:56 AM, Tom de Vries wrote: > >> This is an undocumented developer-only option, because using this option may > >> change behaviour of dwarf consumers, f.i., gdb shows the artificial variables: > >> ... > >> (gdb) info locals > >> a = 0x7fffffffda90 "\005" > >> D.4278 = > >> ... > > I just found in the dwarf 5 spec the attribute DW_AT_description > > (present since version 3): > > ... > > 2.20 Entity Descriptions > > Some debugging information entries may describe entities in the program > > that are artificial, or which otherwise have a “name” that is not a > > valid identifier in the programming language. > > > > This attribute provides a means for the producer to indicate the purpose > > or usage of the containing debugging infor > > > > Generally, any debugging information entry that has, or may have, a > > DW_AT_name attribute, may also have a DW_AT_description attribute whose > > value is a null-terminated string providing a description of the entity. > > > > It is expected that a debugger will display these descriptions as part > > of displaying other properties of an entity. > > ... > > > > AFAICT, gdb currently does not explicitly handle this attribute, which I > > think means it's ignored. > > > > It seems applicable to use DW_AT_description at least for the artificial > > decls. > > > > Perhaps even for all cases that are added by the patch? > > > > I've chosen for this option. Using DW_AT_desciption instead of > DW_AT_name should minimize difference in gdb behaviour with and without > -gdescriptive-dies. -gdescribe-dies? > > I'll rewrite the patch. > > OK for trunk? Few comments: +static void +add_desc_attribute (dw_die_ref die, tree decl) +{ + tree decl_name; + + if (!flag_descriptive_dies || dwarf_version < 3) + return; + you said this is a DWARF5 "feature", I'd suggest changing the check to if (!flag_desctiprive_dies || (dwarf_version < 5 && dwarf_strict)) given -gdescribe-dies is enough of a user request to enable the feature. Not sure if we should warn about -gstrict-dwarf combination with it and -gdwarf-N < 5. + else if (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == CONST_DECL) + { + char buf[32]; + char decl_letter = TREE_CODE (decl) == CONST_DECL ? 'C' : 'D'; + sprintf (buf, "%c.%u", decl_letter, DECL_UID (decl)); + add_desc_attribute (die, buf); + } I wondered before if we can use pretty-printing of decl here. At least I wouldn't restrict it to VAR_DECLs, FUNCTION_DECLs can certainly appear here I think. +@item -gdescriptive-dies +@opindex gdescriptive-dies +Add description attribute to DWARF DIEs that have no name attribute. + Either "description attributes" or "a description attribute", not 100% sure being a non-native speaker. Otherwise the patch looks OK to me but please leave Jason time to comment. Richard. ---1609908220-348114482-1535107478=:16707--