This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 1/4] gdb/observer: Provide target_thread_changed observer
- From: Kieran Bingham <kieran dot bingham at linaro dot org>
- To: gdb-patches at sourceware dot org
- Cc: arnez at linux dot vnet dot ibm dot com, jeffm at suse dot com, peter dot griffin at linaro dot org, lee dot jones at linaro dot org, yao dot qi at linaro dot org, russell dot wayman at linaro dot org, kernel at stlinux dot com, Kieran Bingham <kieran dot bingham at linaro dot org>
- Date: Thu, 25 Feb 2016 19:15:03 +0000
- Subject: [PATCH 1/4] gdb/observer: Provide target_thread_changed observer
- Authentication-results: sourceware.org; auth=none
- References: <1456427706-30077-1-git-send-email-kieran dot bingham at linaro dot org>
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