From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id LSAZIKcKEmWP8RwAWB0awg (envelope-from ) for ; Mon, 25 Sep 2023 18:33:11 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=pB94emxg; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 794FD1E0C3; Mon, 25 Sep 2023 18:33:11 -0400 (EDT) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 69CC51E028 for ; Mon, 25 Sep 2023 18:33:09 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0AECC385B53E for ; Mon, 25 Sep 2023 22:33:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0AECC385B53E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1695681189; bh=3+VWcc5RnGkS4LtEs7li364YKLP9qupiOd6aRVf/7TQ=; h=Date:To:Cc:Subject:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=pB94emxg7/ZDhV5hT6LkbUvvXC051NdKDxefVbe7v5lOEO5QGtseOPrlA1sJeDouY HFC7lCdHsTI/xyjYu2cnaXq9NNB9vpFWADX9I6N1+28yDmcihMvjNR9tmm8h8NveX/ JZL6bDBYahexuln4rOIaW3hzKD4J9M98G/+RvTFo= Received: from lndn.lancelotsix.com (lndn.lancelotsix.com [51.195.220.111]) by sourceware.org (Postfix) with ESMTPS id 8CCAF3858436 for ; Mon, 25 Sep 2023 22:32:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8CCAF3858436 Received: from octopus (cust120-dsl54.idnet.net [212.69.54.120]) by lndn.lancelotsix.com (Postfix) with ESMTPSA id BE359853C0; Mon, 25 Sep 2023 22:32:47 +0000 (UTC) Date: Mon, 25 Sep 2023 23:32:41 +0100 To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 3/7] Remove byte vectors from cplus_struct_type Message-ID: <20230925223241.phor5lusw7jd4flf@octopus> References: <20230921-field-bits-v1-0-201285360900@adacore.com> <20230921-field-bits-v1-3-201285360900@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230921-field-bits-v1-3-201285360900@adacore.com> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (lndn.lancelotsix.com [0.0.0.0]); Mon, 25 Sep 2023 22:32:47 +0000 (UTC) X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Lancelot SIX via Gdb-patches Reply-To: Lancelot SIX Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Hi Tom On Thu, Sep 21, 2023 at 12:01:30PM -0600, Tom Tromey via Gdb-patches wrote: > This removes some byte vectors from cplus_struct_type, moving the > information into bitfields in holes in struct field. > --- > gdb/dwarf2/read.c | 86 +++++++------------------------------- > gdb/gdbtypes.c | 53 ----------------------- > gdb/gdbtypes.h | 118 ++++++++++++++++++++++++--------------------------- > gdb/stabsread.c | 123 +++++++++++++++++++----------------------------------- > 4 files changed, 113 insertions(+), 267 deletions(-) > > diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h > index 505c8ba12b5..c72512b8204 100644 > --- a/gdb/gdbtypes.h > +++ b/gdb/gdbtypes.h > @@ -668,6 +668,46 @@ struct field > m_loc.dwarf_block = dwarf_block; > } > > + /* True if this field is 'private'. */ > + bool is_private () const > + { return m_private; } > + > + /* Set the field's "private" flag. */ > + void set_private () > + { > + /* Can't have both. */ > + gdb_assert (!m_protected); > + m_private = true; > + } > + > + /* True if this field is 'protected'. */ > + bool is_protected () const > + { return m_protected; } > + > + /* Set the field's "protected" flag. */ > + void set_protected () > + { > + /* Can't have both. */ > + gdb_assert (!m_private); > + m_protected = true; > + } > + > + /* True if this field is 'virtual'. */ > + bool is_virtual () const > + { return m_virtual; } > + > + /* Set the field's "virtual" flag. */ > + void set_virtual () > + { m_virtual = true; } > + > + /* True if this field is 'ignored'. */ > + bool is_ignored () const > + { return m_ignored; } > + > + /* Set the field's "ignored" flag. */ > + void set_ignored () > + { m_ignored = true; } > + > union field_location m_loc; > > /* * For a function or member type, this is 1 if the argument is > @@ -677,6 +717,15 @@ struct field > > unsigned int m_artificial : 1; > > + /* Whether the field is 'private'. */ > + bool m_private : 1; > + /* Whether the field is 'protected'. */ > + bool m_protected : 1; Is there a reason I miss to not use an enum to describe the visibility? This would avoid having to verify that m_private and m_protected are mutually exclusive. Is seems to me that something similar to debug_visibility m_visibility : 2; (or a custom enum) should work. > + /* Whether the field is 'virtual'. */ > + bool m_virtual : 1; > + /* Whether the field is 'ignored'. */ > + bool m_ignored : 1; > + > /* * Discriminant for union field_location. */ > > ENUM_BITFIELD(field_loc_kind) m_loc_kind : 3; > diff --git a/gdb/stabsread.c b/gdb/stabsread.c > index 7402a26a401..9a84e5f3f80 100644 > --- a/gdb/stabsread.c > +++ b/gdb/stabsread.c > @@ -3108,11 +3115,15 @@ read_baseclasses (struct stab_field_info *fip, const char **pp, > } > ++(*pp); > > - newobj->visibility = *(*pp)++; > - switch (newobj->visibility) > + int visibility = *(*pp)++; > + switch (visibility) > { > case VISIBILITY_PRIVATE: > + newobj->field.set_private (); > + break; > case VISIBILITY_PROTECTED: > + newobj->field.set_private (); I think this should be: newobj->field.set_protected (); > + break; > case VISIBILITY_PUBLIC: > break; > default: Best, Lancelot.