diff mbox

[1/4] gdb/observer: Provide target_thread_changed observer

Message ID 1456427706-30077-2-git-send-email-kieran.bingham@linaro.org
State New
Headers show

Commit Message

Kieran Bingham Feb. 25, 2016, 7:15 p.m. UTC
LKD utilises an extra observer to obtain notifications whenever
the target_thread is changed.

This keeps it's internal state aware of any changes that occur
in an event driven manner
---
 gdb/doc/observer.texi | 5 +++++
 gdb/remote.c          | 4 ++++
 2 files changed, 9 insertions(+)

-- 
2.5.0
diff mbox

Patch

diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi
index f4049ad3292e..4a9665b374fc 100644
--- a/gdb/doc/observer.texi
+++ b/gdb/doc/observer.texi
@@ -302,3 +302,8 @@  This observer is used for internal testing.  Do not use.
 See testsuite/gdb.gdb/observer.exp.
 @end deftypefun
 
+@deftypefun void target_thread_changed (ptid_t @var{somearg})
+The target has changed its current thread to ptid_t. Used by LKD and called
+by the shtdi and remote interfaces.
+@end deftypefun
+
diff --git a/gdb/remote.c b/gdb/remote.c
index f09a06e9dcc2..9d3bce690519 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -2162,6 +2162,8 @@  static void
 set_general_thread (struct ptid ptid)
 {
   set_thread (ptid, 1);
+
+  observer_notify_target_thread_changed (ptid);
 }
 
 static void
@@ -7071,6 +7073,8 @@  remote_wait (struct target_ops *ops,
 	mark_async_event_handler (remote_async_inferior_event_token);
     }
 
+  observer_notify_target_thread_changed (event_ptid);
+
   return event_ptid;
 }