This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 8/8] Special-case wildcard requests in ravenscar-thread.c
- From: Tom Tromey <tom at tromey dot com>
- To: gdb-patches at sourceware dot org
- Cc: Tom Tromey <tromey at adacore dot com>
- Date: Thu, 7 Feb 2019 02:40:16 -0700
- Subject: [PATCH 8/8] Special-case wildcard requests in ravenscar-thread.c
- References: <20190207094016.368-1-tom@tromey.com>
From: Tom Tromey <tromey@adacore.com>
ravenscar-thread.c intercepts resume and wait target requests and
replaces the requested ptid with the ptid of the underlying CPU.
However, this is incorrect when a request is made with a wildcard
ptid.
This patch adds a special case to ravenscar-thread.c for
minus_one_ptid. I don't believe a special case for process wildcards
is necessary, so I have not added that.
gdb/ChangeLog
2019-02-07 Tom Tromey <tromey@adacore.com>
* ravenscar-thread.c (ravenscar_thread_target::resume)
(ravenscar_thread_target::wait): Special case wildcard requests.
---
gdb/ChangeLog | 5 +++++
gdb/ravenscar-thread.c | 20 ++++++++++++++++----
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index 2e8d76d4ae8..4b07b00aae2 100644
--- a/gdb/ravenscar-thread.c
+++ b/gdb/ravenscar-thread.c
@@ -323,8 +323,14 @@ void
ravenscar_thread_target::resume (ptid_t ptid, int step,
enum gdb_signal siggnal)
{
- inferior_ptid = m_base_ptid;
- beneath ()->resume (m_base_ptid, step, siggnal);
+ /* If we see a wildcard resume, we simply pass that on. Otherwise,
+ arrange to resume the base ptid. */
+ if (ptid != minus_one_ptid)
+ {
+ inferior_ptid = m_base_ptid;
+ ptid = m_base_ptid;
+ }
+ beneath ()->resume (ptid, step, siggnal);
}
ptid_t
@@ -334,8 +340,12 @@ ravenscar_thread_target::wait (ptid_t ptid,
{
ptid_t event_ptid;
- inferior_ptid = m_base_ptid;
- event_ptid = beneath ()->wait (m_base_ptid, status, 0);
+ if (ptid != minus_one_ptid)
+ {
+ inferior_ptid = m_base_ptid;
+ ptid = m_base_ptid;
+ }
+ event_ptid = beneath ()->wait (ptid, status, 0);
/* Find any new threads that might have been created, and update
inferior_ptid to the active thread.
@@ -350,6 +360,8 @@ ravenscar_thread_target::wait (ptid_t ptid,
this->update_thread_list ();
this->update_inferior_ptid ();
}
+ else
+ inferior_ptid = m_base_ptid;
return inferior_ptid;
}
--
2.17.2