summaryrefslogtreecommitdiff
path: root/gdb/regcache.c
diff options
context:
space:
mode:
authorPedro Alves <pedro@codesourcery.com>2008-08-18 22:35:16 +0000
committerPedro Alves <pedro@codesourcery.com>2008-08-18 22:35:16 +0000
commit4ea5edc9147e10b0a1716571facf177294f75a51 (patch)
tree7e1831aa6a22145db082d2fe566166a158b807f9 /gdb/regcache.c
parent29f4dd7bf0e85c26b7702da5ecda035a27a96c9d (diff)
downloadgdb-4ea5edc9147e10b0a1716571facf177294f75a51.tar.gz
2008-08-18 Pedro Alves <pedro@codesourcery.com>
gdb/doc/ * observer.texi (thread_ptid_changed): New. gdb/ * gdbthread.h (thread_change_ptid): Declare. * infrun.c (infrun_thread_ptid_changed): New. (_initialize_infrun): Attach infrun_thread_ptid_changed to the thread_ptid_changed observer. * regcache.c (regcache_thread_ptid_changed): New. (_initialize_regcache): Attach regcache_thread_ptid_changed to the thread_ptid_changed observer. * thread.c (thread_change_ptid): New.
Diffstat (limited to 'gdb/regcache.c')
-rw-r--r--gdb/regcache.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 199b626a1a7..616a6f71817 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -453,6 +453,16 @@ regcache_observer_target_changed (struct target_ops *target)
registers_changed ();
}
+/* Update global variables old ptids to hold NEW_PTID if they were
+ holding OLD_PTID. */
+static void
+regcache_thread_ptid_changed (ptid_t old_ptid, ptid_t new_ptid)
+{
+ if (current_regcache != NULL
+ && ptid_equal (current_regcache->ptid, old_ptid))
+ current_regcache->ptid = new_ptid;
+}
+
/* Low level examining and depositing of registers.
The caller is responsible for making sure that the inferior is
@@ -1134,6 +1144,7 @@ _initialize_regcache (void)
regcache_descr_handle = gdbarch_data_register_post_init (init_regcache_descr);
observer_attach_target_changed (regcache_observer_target_changed);
+ observer_attach_thread_ptid_changed (regcache_thread_ptid_changed);
add_com ("flushregs", class_maintenance, reg_flush_command,
_("Force gdb to flush its register cache (maintainer command)"));