aboutsummaryrefslogtreecommitdiff
path: root/gdb/regcache.h
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2018-02-21 11:20:03 +0000
committerYao Qi <yao.qi@linaro.org>2018-02-21 11:20:03 +0000
commitfc5b87361580d915e28ae5f3cc4794b75b671b5a (patch)
tree467350f5b0a6a236ec88f665f3eb8cfbe941f3fb /gdb/regcache.h
parent849d0ba802323fe05e3039ed5b22957db2c85a67 (diff)
downloadgdb-fc5b87361580d915e28ae5f3cc4794b75b671b5a.zip
gdb-fc5b87361580d915e28ae5f3cc4794b75b671b5a.tar.gz
gdb-fc5b87361580d915e28ae5f3cc4794b75b671b5a.tar.bz2
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.
Diffstat (limited to 'gdb/regcache.h')
-rw-r--r--gdb/regcache.h31
1 files changed, 10 insertions, 21 deletions
diff --git a/gdb/regcache.h b/gdb/regcache.h
index 1c7ee8c..a4ca2ec 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -198,20 +198,10 @@ extern struct type *register_type (struct gdbarch *gdbarch, int regnum);
extern int register_size (struct gdbarch *gdbarch, int regnum);
-
-/* Save/restore a register cache. The set of registers saved /
- restored into the DST regcache determined by the save_reggroup /
- restore_reggroup respectively. COOKED_READ returns zero iff the
- register's value can't be returned. */
-
typedef enum register_status (regcache_cooked_read_ftype) (void *src,
int regnum,
gdb_byte *buf);
-extern void regcache_save (struct regcache *dst,
- regcache_cooked_read_ftype *cooked_read,
- void *cooked_read_context);
-
enum regcache_dump_what
{
regcache_dump_none, regcache_dump_raw,
@@ -317,8 +307,16 @@ public:
return m_aspace;
}
+/* Save/restore 'this' regcache. The set of registers saved /
+ restored into the regcache determined by the save_reggroup /
+ restore_reggroup respectively. COOKED_READ returns zero iff the
+ register's value can't be returned. */
void save (regcache_cooked_read_ftype *cooked_read, void *src);
+ /* Writes to regcache will go through to the target. SRC is a
+ read-only register cache. */
+ void restore (struct regcache *src);
+
void cooked_write (int regnum, const gdb_byte *buf);
void raw_write (int regnum, const gdb_byte *buf);
@@ -383,7 +381,6 @@ protected:
static std::forward_list<regcache *> current_regcache;
private:
- void restore (struct regcache *src);
void transfer_regset (const struct regset *regset,
struct regcache *out_regcache,
@@ -401,9 +398,8 @@ private:
/* Is this a read-only cache? A read-only cache is used for saving
the target's register state (e.g, across an inferior function
call or just before forcing a function return). A read-only
- cache can only be updated via the methods regcache_dup() and
- regcache_cpy(). The actual contents are determined by the
- reggroup_save and reggroup_restore methods. */
+ cache can only be created via a constructor. The actual contents
+ are determined by the save and restore methods. */
const bool m_readonly_p;
/* If this is a read-write cache, which thread's registers is
it connected to? */
@@ -415,19 +411,12 @@ private:
friend void
registers_changed_ptid (ptid_t ptid);
-
- friend void
- regcache_cpy (struct regcache *dst, struct regcache *src);
};
/* Duplicate the contents of a register cache to a read-only register
cache. The operation is pass-through. */
extern struct regcache *regcache_dup (struct regcache *regcache);
-/* Writes to DEST will go through to the target. SRC is a read-only
- register cache. */
-extern void regcache_cpy (struct regcache *dest, struct regcache *src);
-
extern void registers_changed (void);
extern void registers_changed_ptid (ptid_t);