mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 01:07:52 +00:00
Remove regcache_save and regcache_cpy
... instead we start to use regcache methods save and restore. It is quite straightforward to replace regcache_save with regcache->save. regcache_cpy has some asserts, some of them not necessary, like gdb_assert (src != dst); because we already assert !m_readonly_p and src->m_readonly_p, so src isn't dst. Some of the asserts are moved to ::restore. gdb: 2018-02-21 Yao Qi <yao.qi@linaro.org> * frame.c (frame_save_as_regcache): Use regcache method save. (frame_pop): Use regcache method restore. * infrun.c (restore_infcall_suspend_state): Likewise. * linux-fork.c (fork_load_infrun_state): Likewise. * ppc-linux-tdep.c (ppu2spu_sniffer): User regcache method save. * regcache.c (regcache_save): Remove. (regcache::restore): More asserts. (regcache_cpy): Remove. * regcache.h (regcache_save): Remove the declaration. (regcache::restore): Move from private to public. Remove the friend declaration of regcache_cpy. (regcache_cpy): Remove declaration.
This commit is contained in:
@@ -281,13 +281,6 @@ reg_buffer::register_buffer (int regnum) const
|
||||
return m_registers + m_descr->register_offset[regnum];
|
||||
}
|
||||
|
||||
void
|
||||
regcache_save (struct regcache *regcache,
|
||||
regcache_cooked_read_ftype *cooked_read, void *src)
|
||||
{
|
||||
regcache->save (cooked_read, src);
|
||||
}
|
||||
|
||||
void
|
||||
regcache::save (regcache_cooked_read_ftype *cooked_read,
|
||||
void *src)
|
||||
@@ -329,10 +322,14 @@ regcache::restore (struct regcache *src)
|
||||
struct gdbarch *gdbarch = m_descr->gdbarch;
|
||||
int regnum;
|
||||
|
||||
gdb_assert (src != NULL);
|
||||
/* The dst had better not be read-only. If it is, the `restore'
|
||||
doesn't make much sense. */
|
||||
gdb_assert (!m_readonly_p);
|
||||
gdb_assert (src->m_readonly_p);
|
||||
|
||||
gdb_assert (gdbarch == src->arch ());
|
||||
|
||||
/* Copy over any registers, being careful to only restore those that
|
||||
were both saved and need to be restored. The full [0 .. gdbarch_num_regs
|
||||
+ gdbarch_num_pseudo_regs) range is checked since some architectures need
|
||||
@@ -347,17 +344,6 @@ regcache::restore (struct regcache *src)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
regcache_cpy (struct regcache *dst, struct regcache *src)
|
||||
{
|
||||
gdb_assert (src != NULL && dst != NULL);
|
||||
gdb_assert (src->m_descr->gdbarch == dst->m_descr->gdbarch);
|
||||
gdb_assert (src != dst);
|
||||
gdb_assert (src->m_readonly_p && !dst->m_readonly_p);
|
||||
|
||||
dst->restore (src);
|
||||
}
|
||||
|
||||
struct regcache *
|
||||
regcache_dup (struct regcache *src)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user