aboutsummaryrefslogtreecommitdiff
path: root/gdb/regcache.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2010-04-29 16:33:16 +0000
committerPedro Alves <palves@redhat.com>2010-04-29 16:33:16 +0000
commite66408edfdc94395f4a59bbe360abb222ccc48ea (patch)
tree7a885efc4c6361cbf4b55b4ac3838c2215d5831c /gdb/regcache.c
parentb2319725b8a702f0efa820d0cc4dd0bdd7d8f52b (diff)
downloadgdb-e66408edfdc94395f4a59bbe360abb222ccc48ea.zip
gdb-e66408edfdc94395f4a59bbe360abb222ccc48ea.tar.gz
gdb-e66408edfdc94395f4a59bbe360abb222ccc48ea.tar.bz2
PR gdb/11557
gdb/ * regcache.c (registers_changed): Rename to ... (registers_changed_ptid): ... this, and only delete register cache entries matching the ptid filter argument. (registers_changed): Reimplement on top of registers_changed_ptid. * regcache.h (registers_changed_ptid): Declare. * target.c (target_resume): Flush register caches. gdb/testsuite/ * gdb.mi/mi-ns-stale-regcache.exp, gdb.mi/ns-stale-regcache.c: New files.
Diffstat (limited to 'gdb/regcache.c')
-rw-r--r--gdb/regcache.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/gdb/regcache.c b/gdb/regcache.c
index d6f58fe..c3fcd9d 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -518,15 +518,27 @@ regcache_thread_ptid_changed (ptid_t old_ptid, ptid_t new_ptid)
Indicate that registers may have changed, so invalidate the cache. */
void
-registers_changed (void)
+registers_changed_ptid (ptid_t ptid)
{
- struct regcache_list *list, *next;
+ struct regcache_list *list, **list_link;
- for (list = current_regcache; list; list = next)
+ list = current_regcache;
+ list_link = &current_regcache;
+ while (list)
{
- next = list->next;
- regcache_xfree (list->regcache);
- xfree (list);
+ if (ptid_match (list->regcache->ptid, ptid))
+ {
+ struct regcache_list *dead = list;
+
+ *list_link = list->next;
+ regcache_xfree (list->regcache);
+ list = *list_link;
+ xfree (dead);
+ continue;
+ }
+
+ list_link = &list->next;
+ list = *list_link;
}
current_regcache = NULL;
@@ -545,6 +557,11 @@ registers_changed (void)
alloca (0);
}
+void
+registers_changed (void)
+{
+ registers_changed_ptid (minus_one_ptid);
+}
void
regcache_raw_read (struct regcache *regcache, int regnum, gdb_byte *buf)