[PATCH 03/24] regcache: handle invalidated regcache

Bhushan Attarde bhushan.attarde@imgtec.com
Mon Jun 27 14:50:00 GMT 2016


    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



More information about the Gdb-patches mailing list