+
+/* Key for the hash map keeping the regcaches. */
+
+struct target_ptid_arch
+{
+ target_ptid_arch (process_stratum_target *target, ptid_t ptid, gdbarch *arch)
+ : target (target), ptid (ptid), arch (arch)
+ {}
+
+ process_stratum_target *target;
+ ptid_t ptid;
+ gdbarch *arch;
+
+ bool operator== (const target_ptid_arch &other) const
+ {
+ return (this->target == other.target
+ && this->ptid == other.ptid
+ && this->arch == other.arch);
+ }
+};
+
+/* Hash function for target_ptid_arch. */
+
+struct hash_target_ptid_arch
+{
+ size_t operator() (const target_ptid_arch &val) const
+ {
+ hash_ptid h_ptid;
+ std::hash<long> h_long;
+ return h_ptid (val.ptid) + h_long ((long) val.arch);
+ }
+};
+
+using target_ptid_arch_regcache_map
+ = std::unordered_map<target_ptid_arch, regcache *, hash_target_ptid_arch>;
+
+/* Hash map containing the regcaches. */
+
+static target_ptid_arch_regcache_map the_regcaches;