This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 03/24] regcache: handle invalidated regcache
- From: Bhushan Attarde <bhushan dot attarde at imgtec dot com>
- To: <gdb-patches at sourceware dot org>
- Cc: <Maciej dot Rozycki at imgtec dot com>, <Matthew dot Fortune at imgtec dot com>, <James dot Hogan at imgtec dot com>, <Andrew dot Bennett at imgtec dot com>, <Jaydeep dot Patil at imgtec dot com>, Bhushan Attarde <bhushan dot attarde at imgtec dot com>
- Date: Mon, 27 Jun 2016 20:19:30 +0530
- Subject: [PATCH 03/24] regcache: handle invalidated regcache
- Authentication-results: sourceware.org; auth=none
- References: <1467038991-6600-1-git-send-email-bhushan dot attarde at imgtec dot com>
When registers are marked as change, set a new regcache_invalidated
variable which is used by get_thread_regcache to decide whether to
recreate the gdbarch.
gdb/ChangeLog:
* regcache.c (regcache_invalidated): New variable.
(set_current_thread_ptid_arch): Use regcache_invalidated to
set registers_changed_p.
(get_thread_regcache): Reset regcache_invalidated to 0.
(registers_changed_ptid): Set regcache_invalidated to 1.
---
gdb/regcache.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/gdb/regcache.c b/gdb/regcache.c
index c3405b6..3cbec6e 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -489,6 +489,7 @@ struct regcache_list
};
static struct regcache_list *current_regcache;
+static int regcache_invalidated = 1;
struct regcache *
get_thread_arch_aspace_regcache (ptid_t ptid, struct gdbarch *gdbarch,
@@ -547,7 +548,7 @@ set_current_thread_ptid_arch (ptid_t ptid)
struct regcache *
get_thread_regcache (ptid_t ptid)
{
- int registers_changed_p = current_regcache == NULL;
+ int registers_changed_p = current_regcache == NULL || regcache_invalidated;
struct regcache *new_regcache;
set_current_thread_ptid_arch (ptid);
@@ -560,6 +561,7 @@ get_thread_regcache (ptid_t ptid)
registers_changed ();
set_current_thread_ptid_arch (ptid);
new_regcache = get_thread_arch_regcache (ptid, current_thread_arch);
+ regcache_invalidated = 0;
}
return new_regcache;
@@ -646,6 +648,7 @@ registers_changed_ptid (ptid_t ptid)
forget about any frames we have cached, too. */
reinit_frame_cache ();
}
+ regcache_invalidated = 1;
}
void
--
1.9-rc2