summaryrefslogtreecommitdiff
path: root/gdb/infrun.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/infrun.c
parentf98dfd4b46ff7c68b479181714832b4c5fced87e (diff)
downloadbinutils-gdb-5231c1fd732d8cdb7ed92dd3e275ab4698a8052d.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/infrun.c')
-rw-r--r--gdb/infrun.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c
index de7de790710..19b3229abc0 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -865,6 +865,30 @@ displaced_step_fixup (ptid_t event_ptid, enum target_signal signal)
}
}
+/* Update global variables holding ptids to hold NEW_PTID if they were
+ holding OLD_PTID. */
+static void
+infrun_thread_ptid_changed (ptid_t old_ptid, ptid_t new_ptid)
+{
+ struct displaced_step_request *it;
+
+ if (ptid_equal (inferior_ptid, old_ptid))
+ inferior_ptid = new_ptid;
+
+ if (ptid_equal (singlestep_ptid, old_ptid))
+ singlestep_ptid = new_ptid;
+
+ if (ptid_equal (displaced_step_ptid, old_ptid))
+ displaced_step_ptid = new_ptid;
+
+ if (ptid_equal (deferred_step_ptid, old_ptid))
+ deferred_step_ptid = new_ptid;
+
+ for (it = displaced_step_request_queue; it; it = it->next)
+ if (ptid_equal (it->ptid, old_ptid))
+ it->ptid = new_ptid;
+}
+
/* Resuming. */
@@ -4855,4 +4879,6 @@ breakpoints, even if such is supported by the target."),
inferior_ptid = null_ptid;
target_last_wait_ptid = minus_one_ptid;
displaced_step_ptid = null_ptid;
+
+ observer_attach_thread_ptid_changed (infrun_thread_ptid_changed);
}