From patchwork Sun Sep 24 02:46:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 23117 Received: (qmail 42257 invoked by alias); 24 Sep 2017 02:46:21 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 42046 invoked by uid 89); 24 Sep 2017 02:46:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: gproxy6-pub.mail.unifiedlayer.com Received: from gproxy6-pub.mail.unifiedlayer.com (HELO gproxy6-pub.mail.unifiedlayer.com) (67.222.39.168) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 24 Sep 2017 02:46:16 +0000 Received: from cmgw2 (unknown [10.0.90.83]) by gproxy6.mail.unifiedlayer.com (Postfix) with ESMTP id 605E11E069F for ; Sat, 23 Sep 2017 20:46:14 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by cmgw2 with id DEmB1w00P2f2jeq01EmEMq; Sat, 23 Sep 2017 20:46:14 -0600 X-Authority-Analysis: v=2.2 cv=dZfw5Tfe c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=2JCJgTwv5E4A:10 a=zstS-IiYAAAA:8 a=iaIBhAS0CkARPMLumFUA:9 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from 75-166-76-94.hlrn.qwest.net ([75.166.76.94]:56144 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1dvwvq-001i9G-UW; Sat, 23 Sep 2017 20:46:11 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 2/5] Remove regcache_xfree Date: Sat, 23 Sep 2017 20:46:05 -0600 Message-Id: <20170924024608.4346-3-tom@tromey.com> In-Reply-To: <20170924024608.4346-1-tom@tromey.com> References: <20170924024608.4346-1-tom@tromey.com> X-BWhitelist: no X-Exim-ID: 1dvwvq-001i9G-UW X-Source-Sender: 75-166-76-94.hlrn.qwest.net (bapiya.Home) [75.166.76.94]:56144 X-Source-Auth: tom+tromey.com X-Email-Count: 4 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Local-Domain: yes This removes regcache_xfree in favor of plain "delete". ChangeLog 2017-09-23 Tom Tromey * spu-tdep.c (spu2ppu_dealloc_cache): Use delete. * regcache.h (regcache_xfree): Don't declare. * regcache.c (regcache_xfree): Remove. (do_regcache_xfree): Use delete. * ppc-linux-tdep.c (ppu2spu_dealloc_cache): Use delete. * linux-fork.c (free_fork): Use delete. (fork_save_infrun_state): Likewise. * jit.c (jit_dealloc_cache): Use delete. * infrun.c (discard_infcall_suspend_state): Use delete. --- gdb/ChangeLog | 12 ++++++++++++ gdb/infrun.c | 2 +- gdb/jit.c | 2 +- gdb/linux-fork.c | 4 ++-- gdb/ppc-linux-tdep.c | 2 +- gdb/regcache.c | 11 +---------- gdb/regcache.h | 1 - gdb/spu-tdep.c | 2 +- 8 files changed, 19 insertions(+), 17 deletions(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index 26853b1..f44ca91 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -8921,7 +8921,7 @@ make_cleanup_restore_infcall_suspend_state void discard_infcall_suspend_state (struct infcall_suspend_state *inf_state) { - regcache_xfree (inf_state->registers); + delete inf_state->registers; xfree (inf_state->siginfo_data); xfree (inf_state); } diff --git a/gdb/jit.c b/gdb/jit.c index 6eea38f..a8e63b3 100644 --- a/gdb/jit.c +++ b/gdb/jit.c @@ -1167,7 +1167,7 @@ jit_dealloc_cache (struct frame_info *this_frame, void *cache) struct jit_unwind_private *priv_data = (struct jit_unwind_private *) cache; gdb_assert (priv_data->regcache != NULL); - regcache_xfree (priv_data->regcache); + delete priv_data->regcache; xfree (priv_data); } diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c index 22a11c6..6b9c6a8 100644 --- a/gdb/linux-fork.c +++ b/gdb/linux-fork.c @@ -126,7 +126,7 @@ free_fork (struct fork_info *fp) if (fp) { if (fp->savedregs) - regcache_xfree (fp->savedregs); + delete fp->savedregs; if (fp->filepos) xfree (fp->filepos); xfree (fp); @@ -292,7 +292,7 @@ fork_save_infrun_state (struct fork_info *fp, int clobber_regs) DIR *d; if (fp->savedregs) - regcache_xfree (fp->savedregs); + delete fp->savedregs; fp->savedregs = regcache_dup (get_current_regcache ()); fp->clobber_regs = clobber_regs; diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 4c851eb..2faee42 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -1382,7 +1382,7 @@ static void ppu2spu_dealloc_cache (struct frame_info *self, void *this_cache) { struct ppu2spu_cache *cache = (struct ppu2spu_cache *) this_cache; - regcache_xfree (cache->regcache); + delete cache->regcache; } static const struct frame_unwind ppu2spu_unwind = { diff --git a/gdb/regcache.c b/gdb/regcache.c index 2a92cf0..54aed6c 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -241,19 +241,10 @@ regcache_get_ptid (const struct regcache *regcache) return regcache->ptid (); } -void -regcache_xfree (struct regcache *regcache) -{ - if (regcache == NULL) - return; - - delete regcache; -} - static void do_regcache_xfree (void *data) { - regcache_xfree ((struct regcache *) data); + delete (struct regcache *) data; } struct cleanup * diff --git a/gdb/regcache.h b/gdb/regcache.h index 877ed59..4a430ae 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -35,7 +35,6 @@ extern struct regcache *get_thread_arch_aspace_regcache (ptid_t, struct gdbarch *, struct address_space *); -void regcache_xfree (struct regcache *regcache); struct cleanup *make_cleanup_regcache_xfree (struct regcache *regcache); /* Return REGCACHE's ptid. */ diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c index 4338d5c..f77e37f 100644 --- a/gdb/spu-tdep.c +++ b/gdb/spu-tdep.c @@ -1288,7 +1288,7 @@ static void spu2ppu_dealloc_cache (struct frame_info *self, void *this_cache) { struct spu2ppu_cache *cache = (struct spu2ppu_cache *) this_cache; - regcache_xfree (cache->regcache); + delete cache->regcache; } static const struct frame_unwind spu2ppu_unwind = {