From patchwork Sun Sep 24 02:46:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 23115 Received: (qmail 42111 invoked by alias); 24 Sep 2017 02:46:19 -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 42035 invoked by uid 89); 24 Sep 2017 02:46:16 -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: gproxy9-pub.mail.unifiedlayer.com Received: from gproxy9-pub.mail.unifiedlayer.com (HELO gproxy9-pub.mail.unifiedlayer.com) (69.89.20.122) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 24 Sep 2017 02:46:15 +0000 Received: from cmgw3 (unknown [10.0.90.84]) by gproxy9.mail.unifiedlayer.com (Postfix) with ESMTP id CA3F81E07B6 for ; Sat, 23 Sep 2017 20:46:13 -0600 (MDT) Received: from box522.bluehost.com ([74.220.219.122]) by cmgw3 with id DEmA1w00L2f2jeq01EmDtf; Sat, 23 Sep 2017 20:46:13 -0600 X-Authority-Analysis: v=2.2 cv=K/VSJ2eI c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=2JCJgTwv5E4A:10 a=zstS-IiYAAAA:8 a=pbbXBiW06EHEvmCoDFkA:9 a=HFwGu8DUkgFPy0fh:21 a=4Wjm6s6pIvl7Vq1W:21 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-Ka; Sat, 23 Sep 2017 20:46:10 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 1/5] Remove regcache_xmalloc Date: Sat, 23 Sep 2017 20:46:04 -0600 Message-Id: <20170924024608.4346-2-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-Ka 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: 3 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Local-Domain: yes This patch removes regcache_xmalloc in favor of plain "new". ChangeLog 2017-09-23 Tom Tromey * regcache.h (regcache_xmalloc): Don't declare. (regcache_raw_set_cached_value): Update comment. * regcache.c (regcache_xmalloc): Remove. * ppc-linux-tdep.c (ppu2spu_sniffer): Use new. * jit.c (jit_frame_sniffer): Use new. * frame.c (frame_save_as_regcache): Use new. --- gdb/ChangeLog | 9 +++++++++ gdb/frame.c | 4 ++-- gdb/jit.c | 2 +- gdb/ppc-linux-tdep.c | 2 +- gdb/regcache.c | 6 ------ gdb/regcache.h | 4 +--- 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/gdb/frame.c b/gdb/frame.c index f100da3..ad0cb92 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1021,8 +1021,8 @@ struct regcache * frame_save_as_regcache (struct frame_info *this_frame) { struct address_space *aspace = get_frame_address_space (this_frame); - struct regcache *regcache = regcache_xmalloc (get_frame_arch (this_frame), - aspace); + struct regcache *regcache = new regcache (get_frame_arch (this_frame), + aspace); struct cleanup *cleanups = make_cleanup_regcache_xfree (regcache); regcache_save (regcache, do_frame_register_read, this_frame); diff --git a/gdb/jit.c b/gdb/jit.c index fbfee99..6eea38f 100644 --- a/gdb/jit.c +++ b/gdb/jit.c @@ -1205,7 +1205,7 @@ jit_frame_sniffer (const struct frame_unwind *self, *cache = XCNEW (struct jit_unwind_private); priv_data = (struct jit_unwind_private *) *cache; - priv_data->regcache = regcache_xmalloc (gdbarch, aspace); + priv_data->regcache = new regcache (gdbarch, aspace); priv_data->this_frame = this_frame; callbacks.priv_data = priv_data; diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index df664ea..4c851eb 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -1363,7 +1363,7 @@ ppu2spu_sniffer (const struct frame_unwind *self, = FRAME_OBSTACK_CALLOC (1, struct ppu2spu_cache); struct address_space *aspace = get_frame_address_space (this_frame); - struct regcache *regcache = regcache_xmalloc (data.gdbarch, aspace); + struct regcache *regcache = new regcache (data.gdbarch, aspace); struct cleanup *cleanups = make_cleanup_regcache_xfree (regcache); regcache_save (regcache, ppu2spu_unwind_register, &data); discard_cleanups (cleanups); diff --git a/gdb/regcache.c b/gdb/regcache.c index 4ef9151..2a92cf0 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -241,12 +241,6 @@ regcache_get_ptid (const struct regcache *regcache) return regcache->ptid (); } -struct regcache * -regcache_xmalloc (struct gdbarch *gdbarch, struct address_space *aspace) -{ - return new regcache (gdbarch, aspace); -} - void regcache_xfree (struct regcache *regcache) { diff --git a/gdb/regcache.h b/gdb/regcache.h index eb0454a..877ed59 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -37,8 +37,6 @@ extern struct regcache *get_thread_arch_aspace_regcache (ptid_t, void regcache_xfree (struct regcache *regcache); struct cleanup *make_cleanup_regcache_xfree (struct regcache *regcache); -struct regcache *regcache_xmalloc (struct gdbarch *gdbarch, - struct address_space *aspace); /* Return REGCACHE's ptid. */ @@ -84,7 +82,7 @@ extern LONGEST regcache_raw_get_signed (struct regcache *regcache, /* Set a raw register's value in the regcache's buffer. Unlike regcache_raw_write, this is not write-through. The intention is allowing to change the buffer contents of a read-only regcache - allocated with regcache_xmalloc. */ + allocated with new. */ extern void regcache_raw_set_cached_value (struct regcache *regcache, int regnum, const gdb_byte *buf);