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 cleanup *cleanups = make_cleanup_regcache_xfree (regcache);
+ regcache *backup = new regcache (get_frame_arch (this_frame), aspace);
+ struct cleanup *cleanups = make_cleanup_regcache_delete (backup);
- regcache_save (regcache, do_frame_register_read, this_frame);
+ regcache_save (backup, do_frame_register_read, this_frame);
discard_cleanups (cleanups);
- return regcache;
+ return backup;
}
void
trying to extract the old values from the current regcache while
at the same time writing new values into that same cache. */
scratch = frame_save_as_regcache (prev_frame);
- cleanups = make_cleanup_regcache_xfree (scratch);
+ cleanups = make_cleanup_regcache_delete (scratch);
/* FIXME: cagney/2003-03-16: It should be possible to tell the
target's register cache that it is about to be hit with a burst
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);
}
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);
}
*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;
if (fp)
{
if (fp->savedregs)
- regcache_xfree (fp->savedregs);
+ delete fp->savedregs;
if (fp->filepos)
xfree (fp->filepos);
xfree (fp);
DIR *d;
if (fp->savedregs)
- regcache_xfree (fp->savedregs);
+ delete fp->savedregs;
fp->savedregs = regcache_dup (get_current_regcache ());
fp->clobber_regs = clobber_regs;
prev_regs = this_regs;
this_regs = frame_save_as_regcache (get_selected_frame (NULL));
- cleanup = make_cleanup_regcache_xfree (prev_regs);
+ cleanup = make_cleanup_regcache_delete (prev_regs);
/* Note that the test for a valid register must include checking the
gdbarch_register_name because gdbarch_num_regs may be allocated
= 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 cleanup *cleanups = make_cleanup_regcache_xfree (regcache);
- regcache_save (regcache, ppu2spu_unwind_register, &data);
+ regcache *backup = new regcache (data.gdbarch, aspace);
+ struct cleanup *cleanups = make_cleanup_regcache_delete (backup);
+ regcache_save (backup, ppu2spu_unwind_register, &data);
discard_cleanups (cleanups);
cache->frame_id = frame_id_build (base, func);
- cache->regcache = regcache;
+ cache->regcache = backup;
*this_prologue_cache = cache;
return 1;
}
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 = {
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)
-{
- if (regcache == NULL)
- return;
-
- delete regcache;
-}
-
static void
-do_regcache_xfree (void *data)
+do_regcache_delete (void *data)
{
- regcache_xfree ((struct regcache *) data);
+ if (data == NULL)
+ return;
+ delete (regcache *) data;
}
struct cleanup *
-make_cleanup_regcache_xfree (struct regcache *regcache)
+make_cleanup_regcache_delete (struct regcache *regcache)
{
- return make_cleanup (do_regcache_xfree, regcache);
+ return make_cleanup (do_regcache_delete, regcache);
}
/* Cleanup routines for invalidating a register. */
struct gdbarch *,
struct address_space *);
-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);
+struct cleanup *make_cleanup_regcache_delete (regcache *regcache);
/* Return REGCACHE's ptid. */
regcache (const regcache &) = delete;
void operator= (const regcache &) = delete;
- /* class regcache is only extended in unit test, so only mark it
- virtual when selftest is enabled. */
-#if GDB_SELF_TEST
- virtual
-#endif
- ~regcache ()
+ virtual ~regcache ()
{
xfree (m_registers);
xfree (m_register_status);
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 = {