aboutsummaryrefslogtreecommitdiff
path: root/gdb/regcache.h
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2017-05-24 22:15:23 +0100
committerYao Qi <yao.qi@linaro.org>2017-05-24 22:15:23 +0100
commite521e87e8514b9d3497208b70bcd067f132c58ed (patch)
tree471784e5e4d6ed9539dc3eaa8ca424103ec930e2 /gdb/regcache.h
parentd8e07dda92366be0f6fc2e7128620d3dd53494e3 (diff)
downloadgdb-e521e87e8514b9d3497208b70bcd067f132c58ed.zip
gdb-e521e87e8514b9d3497208b70bcd067f132c58ed.tar.gz
gdb-e521e87e8514b9d3497208b70bcd067f132c58ed.tar.bz2
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.
Diffstat (limited to 'gdb/regcache.h')
-rw-r--r--gdb/regcache.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/gdb/regcache.h b/gdb/regcache.h
index da00abd..fdc47ba 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -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);
@@ -383,6 +388,9 @@ private:
struct address_space *aspace);
friend void
+ registers_changed_ptid (ptid_t ptid);
+
+ friend void
regcache_cpy (struct regcache *dst, struct regcache *src);
};