aboutsummaryrefslogtreecommitdiff
path: root/gdb/regcache.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2008-08-18 22:35:17 +0000
committerPedro Alves <palves@redhat.com>2008-08-18 22:35:17 +0000
commit5231c1fd732d8cdb7ed92dd3e275ab4698a8052d (patch)
tree5b0fe57134939c5da0bc46b67bd127b15897d656 /gdb/regcache.c
parentf98dfd4b46ff7c68b479181714832b4c5fced87e (diff)
downloadgdb-5231c1fd732d8cdb7ed92dd3e275ab4698a8052d.zip
gdb-5231c1fd732d8cdb7ed92dd3e275ab4698a8052d.tar.gz
gdb-5231c1fd732d8cdb7ed92dd3e275ab4698a8052d.tar.bz2
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 199b626..616a6f7 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)"));