Move current_regcache to regcache::current_regcache
This patches moves global variable current_regcache to a class regcache static variable (protected) so that the unit test I add in the following patch can access it (by means of extending class regcache in unit test). gdb: 2017-05-24 Yao Qi <yao.qi@linaro.org> * regcache.c (current_regcache): Change it to regcache::current_regcache. (regcache_observer_target_changed): Update. (regcache_thread_ptid_changed): Make it a regcache static method. (regcache_thread_ptid_changed): Update. (class regcache_access): New. (current_regcache_test): Update. (_initialize_regcache): Update. * regcache.h: Include forward_list. (regcache): Declare regcache_thread_ptid_changed and declare registers_changed_ptid as friend.
This commit is contained in:
parent
d8e07dda92
commit
e521e87e85
3 changed files with 52 additions and 24 deletions
|
@ -21,6 +21,7 @@
|
|||
#define REGCACHE_H
|
||||
|
||||
#include "common-regcache.h"
|
||||
#include <forward_list>
|
||||
|
||||
struct regcache;
|
||||
struct regset;
|
||||
|
@ -336,9 +337,13 @@ public:
|
|||
debug. */
|
||||
void debug_print_register (const char *func, int regno);
|
||||
|
||||
private:
|
||||
static void regcache_thread_ptid_changed (ptid_t old_ptid, ptid_t new_ptid);
|
||||
protected:
|
||||
regcache (gdbarch *gdbarch, address_space *aspace_, bool readonly_p_);
|
||||
|
||||
static std::forward_list<regcache *> current_regcache;
|
||||
|
||||
private:
|
||||
gdb_byte *register_buffer (int regnum) const;
|
||||
|
||||
void restore (struct regcache *src);
|
||||
|
@ -382,6 +387,9 @@ private:
|
|||
get_thread_arch_aspace_regcache (ptid_t ptid, struct gdbarch *gdbarch,
|
||||
struct address_space *aspace);
|
||||
|
||||
friend void
|
||||
registers_changed_ptid (ptid_t ptid);
|
||||
|
||||
friend void
|
||||
regcache_cpy (struct regcache *dst, struct regcache *src);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue