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 873ED385B835 for ; Mon, 30 Mar 2020 15:32:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 873ED385B835 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) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 1FF231E581; Mon, 30 Mar 2020 11:32:37 -0400 (EDT) Subject: Re: [PATCH 11/20] Add reprocessing flag to struct attribute To: Tom Tromey , gdb-patches@sourceware.org References: <20200328192208.11324-1-tom@tromey.com> <20200328192208.11324-12-tom@tromey.com> From: Simon Marchi Message-ID: <95abbf1c-cfa2-c031-d89e-d495dc0d4449@simark.ca> Date: Mon, 30 Mar 2020 11:32:36 -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-12-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 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:32:38 -0000 On 2020-03-28 3:21 p.m., Tom Tromey wrote: > diff --git a/gdb/dwarf2/attribute.c b/gdb/dwarf2/attribute.c > index 72ec13c11f9..73c1ef9f792 100644 > --- a/gdb/dwarf2/attribute.c > +++ b/gdb/dwarf2/attribute.c > @@ -206,3 +206,17 @@ attribute::form_is_unsigned () const > || form == DW_FORM_ref8 > || form == DW_FORM_ref_udata); > } > + > +/* See attribute.h. */ > + > +bool > +attribute::form_is_reprocessed () const The name is odd, the "form" isn't reprocessed. What would you think of "form_requires_processing"? The "requires_reprocessing" field implicitly means "attribute_requires_reprocessing". But if we want to avoid confusion between the two, the field could be renamed "reprocessing_done", and its logic inverted. > @@ -179,8 +193,22 @@ struct attribute > u.unsnd = unsnd; > } > > + /* Temporarily this attribute to an unsigned integer. This is used Missing a word here? > + only for those forms that require reprocessing. */ > + void set_unsigned_reprocess (ULONGEST unsnd) > + { > + gdb_assert (form_is_reprocessed ()); > + u.unsnd = unsnd; > + requires_reprocessing = 1; > + } > + > + > + ENUM_BITFIELD(dwarf_attribute) name : 15; > + > + /* If this requires reprocessing, is it in its final form, or is it > + still stored as an unsigned? */ > + unsigned int requires_reprocessing : 1; It would be good to explain what we mean by "reprocessing", here would be a good place. It would be good to give the example of the DW_FORM_strx form, where we could encounter this form before having seen the corresponding DW_AT_str_offsets_base attribute. So we first store the offset as an unsigned integer in the attribute, then "reprocess" it later to fetch the actual string. Simon