From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id F14E7385B835 for ; Mon, 30 Mar 2020 15:02:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F14E7385B835 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark@simark.ca Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 928541E581; Mon, 30 Mar 2020 11:02:34 -0400 (EDT) Subject: Re: [PATCH 05/20] Remove some uses of DW_STRING_IS_CANONICAL To: Tom Tromey , gdb-patches@sourceware.org References: <20200328192208.11324-1-tom@tromey.com> <20200328192208.11324-6-tom@tromey.com> From: Simon Marchi Message-ID: <2f3698db-d6f3-ef0d-3d1e-ae0ef9e0ae45@simark.ca> Date: Mon, 30 Mar 2020 11:02:34 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200328192208.11324-6-tom@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US-large Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-25.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, URIBL_CSS, URIBL_CSS_A autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Mar 2020 15:02:36 -0000 On 2020-03-28 3:21 p.m., Tom Tromey wrote: > This removes the rvalue uses of DW_STRING_IS_CANONICAL, replacing them > with an accessor method. > > 2020-03-28 Tom Tromey > > * dwarf2/read.c (anonymous_struct_prefix, dwarf2_name) > (dump_die_shallow): Use canonical_p. > * dwarf2/attribute.h (struct attribute) : New > method. > --- > gdb/ChangeLog | 7 +++++++ > gdb/dwarf2/attribute.h | 6 ++++++ > gdb/dwarf2/read.c | 8 ++++---- > 3 files changed, 17 insertions(+), 4 deletions(-) > > diff --git a/gdb/dwarf2/attribute.h b/gdb/dwarf2/attribute.h > index cefd3c5541e..f20540559aa 100644 > --- a/gdb/dwarf2/attribute.h > +++ b/gdb/dwarf2/attribute.h > @@ -100,6 +100,12 @@ struct attribute > > LONGEST constant_value (int default_value) const; > > + /* Return true if this attribute holds a canonical string. */ > + bool canonical_p () const > + { > + return string_is_canonical; > + } Would you be able to improve the documentation to say what is a "canonical string"? If this is a DWARF concept and described in the DWARF spec, you could just refer to the relevant section of the standard too. Is this method only relevant if the attribute is of a string form? If so, the method name should perhaps still have "string" in its name, like "is_canonical_string" or "canonical_string_p". I presume it doesn't make sense to call this method when the attribute has a non-string form, so should there be a gdb_assert that checks that the attribute has a string form? Simon