From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 104299 invoked by alias); 21 Dec 2017 03:03:13 -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 104282 invoked by uid 89); 21 Dec 2017 03:03:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 21 Dec 2017 03:03:10 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id vBL3342k027828 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 20 Dec 2017 22:03:09 -0500 Received: by simark.ca (Postfix, from userid 112) id 68E5A1E59F; Wed, 20 Dec 2017 22:03:04 -0500 (EST) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 5A8A81E4C4; Wed, 20 Dec 2017 22:03:03 -0500 (EST) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 21 Dec 2017 03:03:00 -0000 From: Simon Marchi To: Stafford Horne Cc: GDB patches , Openrisc Subject: Re: [PATCH v3 2/4] reggroups: Convert reggroups from post_init to pre_init In-Reply-To: <20171219142257.13402-3-shorne@gmail.com> References: <20171219142257.13402-1-shorne@gmail.com> <20171219142257.13402-3-shorne@gmail.com> Message-ID: X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.2 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Thu, 21 Dec 2017 03:03:04 +0000 X-IsSubscribed: yes X-SW-Source: 2017-12/txt/msg00462.txt.bz2 On 2017-12-19 09:22, Stafford Horne wrote: > Currently the reggroups gdbarch_data cannot be manipulated until after > the gdbarch is completely initialized. This is usually done when the > object init depends on architecture specific fields. In the case of > reggroups it only depends on the obstack being available. > > Coverting this to pre_init allows using reggroups during gdbarch > initialization. This is needed to allow registering arbitrary > reggroups > during gdbarch initializations. > > gdb/ChangeLog: > > 2017-06-06 Stafford Horne > > * reggroups.c (reggroups_init): Change to depend only on > obstack rather than gdbarch. > (reggroup_add): Remove logic for forcing premature init. > (_initialize_reggroup): Set `reggroups_data` with > gdbarch_data_register_pre_init() rather than > gdbarch_data_register_post_init(). > --- > gdb/reggroups.c | 15 ++++----------- > 1 file changed, 4 insertions(+), 11 deletions(-) > > diff --git a/gdb/reggroups.c b/gdb/reggroups.c > index 2ecd0b494f..5d5e33f2a3 100644 > --- a/gdb/reggroups.c > +++ b/gdb/reggroups.c > @@ -26,6 +26,7 @@ > #include "regcache.h" > #include "command.h" > #include "gdbcmd.h" /* For maintenanceprintlist. */ > +#include "gdb_obstack.h" > > /* Individual register groups. */ > > @@ -76,10 +77,9 @@ struct reggroups > static struct gdbarch_data *reggroups_data; > > static void * > -reggroups_init (struct gdbarch *gdbarch) > +reggroups_init (struct obstack *obstack) > { > - struct reggroups *groups = GDBARCH_OBSTACK_ZALLOC (gdbarch, > - struct reggroups); > + struct reggroups *groups = OBSTACK_ZALLOC (obstack, struct > reggroups); > > groups->last = &groups->first; > return groups; > @@ -105,13 +105,6 @@ reggroup_add (struct gdbarch *gdbarch, struct > reggroup *group) > struct reggroups *groups > = (struct reggroups *) gdbarch_data (gdbarch, reggroups_data); > > - if (groups == NULL) > - { > - /* ULGH, called during architecture initialization. Patch > - things up. */ > - groups = (struct reggroups *) reggroups_init (gdbarch); > - deprecated_set_gdbarch_data (gdbarch, reggroups_data, groups); > - } > add_group (groups, group, > GDBARCH_OBSTACK_ZALLOC (gdbarch, struct reggroup_el)); > } > @@ -298,7 +291,7 @@ struct reggroup *const restore_reggroup = > &restore_group; > void > _initialize_reggroup (void) > { > - reggroups_data = gdbarch_data_register_post_init (reggroups_init); > + reggroups_data = gdbarch_data_register_pre_init (reggroups_init); > > /* The pre-defined list of groups. */ > add_group (&default_groups, general_reggroup, XNEW (struct > reggroup_el)); LGTM.