From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 120193 invoked by alias); 21 Dec 2017 03:15:40 -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 120179 invoked by uid 89); 21 Dec 2017 03:15:39 -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=Hx-languages-length:2064 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:15:38 +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 vBL3FWgI031653 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 20 Dec 2017 22:15:36 -0500 Received: by simark.ca (Postfix, from userid 112) id 25AAD1E59F; Wed, 20 Dec 2017 22:15:32 -0500 (EST) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 401941E4C4; Wed, 20 Dec 2017 22:15:31 -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:15:00 -0000 From: Simon Marchi To: Stafford Horne Cc: GDB patches , Openrisc Subject: Re: [PATCH v3 3/4] reggroups: Create reggroup_gdbarch_new for dynamic reggroups In-Reply-To: <20171219142257.13402-4-shorne@gmail.com> References: <20171219142257.13402-1-shorne@gmail.com> <20171219142257.13402-4-shorne@gmail.com> Message-ID: <31e43543479eecd36327738c8682ce37@polymtl.ca> 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:15:32 +0000 X-IsSubscribed: yes X-SW-Source: 2017-12/txt/msg00463.txt.bz2 On 2017-12-19 09:22, Stafford Horne wrote: > Traditionally reggroups have been created via reggroup_new() during > initialization code and never freed. Now, if we want to initialize > reggroups dynamically (i.e. in target description) we should be able to > free them. Create this function reggroup_gdbarch_new() which will > allocate the reggroup memory onto the passed gdbarch obstack. > > gdb/ChangeLog: > > 2017-06-10 Stafford Horne > > * reggroups.c (reggroup_gdbarch_new): New function. > * reggroups.h (reggroup_gdbarch_new): New function. > --- > gdb/reggroups.c | 12 ++++++++++++ > gdb/reggroups.h | 4 ++++ > 2 files changed, 16 insertions(+) > > diff --git a/gdb/reggroups.c b/gdb/reggroups.c > index 5d5e33f2a3..acad91a0ab 100644 > --- a/gdb/reggroups.c > +++ b/gdb/reggroups.c > @@ -46,6 +46,18 @@ reggroup_new (const char *name, enum reggroup_type > type) > return group; > } > > +struct reggroup * > +reggroup_gdbarch_new (struct gdbarch *gdbarch, const char *name, > + enum reggroup_type type) > +{ > + struct reggroup *group = GDBARCH_OBSTACK_ZALLOC (gdbarch, > + struct reggroup); > + > + group->name = gdbarch_obstack_strdup (gdbarch, name); > + group->type = type; > + return group; > +} > + > /* Register group attributes. */ > > const char * > diff --git a/gdb/reggroups.h b/gdb/reggroups.h > index 18fc1bf294..c1653cd39d 100644 > --- a/gdb/reggroups.h > +++ b/gdb/reggroups.h > @@ -41,6 +41,10 @@ extern struct reggroup *const restore_reggroup; > /* Create a new local register group. */ > extern struct reggroup *reggroup_new (const char *name, > enum reggroup_type type); > +/* Create a new register group allocated onto the gdbarch obstack. */ > +extern struct reggroup *reggroup_gdbarch_new (struct gdbarch *gdbarch, > + const char *name, > + enum reggroup_type type); > > /* Add a register group (with attribute values) to the pre-defined > list. */ > extern void reggroup_add (struct gdbarch *gdbarch, struct reggroup > *group); LGTM.