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.
This commit is contained in:
Pedro Alves
2008-08-18 22:35:17 +00:00
parent f98dfd4b46
commit 5231c1fd73
7 changed files with 68 additions and 0 deletions

View File

@@ -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)"));