This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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(+)

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;
 }
 
-- 
2.5.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]