From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [RFA 1/5] Remove regcache_xmalloc
Date: Sun, 24 Sep 2017 02:46:00 -0000 [thread overview]
Message-ID: <20170924024608.4346-2-tom@tromey.com> (raw)
In-Reply-To: <20170924024608.4346-1-tom@tromey.com>
This patch removes regcache_xmalloc in favor of plain "new".
ChangeLog
2017-09-23 Tom Tromey <tom@tromey.com>
* 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);
--
2.9.5
next prev parent reply other threads:[~2017-09-24 2:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-24 2:46 [RFA 0/5] remove cleanups from regcache Tom Tromey
2017-09-24 2:46 ` [RFA 2/5] Remove regcache_xfree Tom Tromey
2017-09-24 2:46 ` [RFA 3/5] Remove make_cleanup_regcache_xfree Tom Tromey
2017-09-24 2:46 ` Tom Tromey [this message]
2017-09-26 4:55 ` [RFA 1/5] Remove regcache_xmalloc Tom Tromey
2017-09-26 5:10 ` Sergio Durigan Junior
2017-09-24 2:46 ` [RFA 4/5] Remove make_cleanup_regcache_invalidate Tom Tromey
2017-09-25 20:04 ` Yao Qi
2017-09-26 1:36 ` Tom Tromey
2017-09-26 1:56 ` Tom Tromey
2017-09-24 2:46 ` [RFA 5/5] Remove the last cleanup from regcache.c Tom Tromey
2017-09-26 0:08 ` [RFA 0/5] remove cleanups from regcache Yao Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170924024608.4346-2-tom@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox