This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] LynxOS: Resume the same thread when receiving a thread create/exit event.
- From: Joel Brobecker <brobecker at adacore dot com>
- To: gdb-patches at sourceware dot org
- Cc: Joel Brobecker <brobecker at adacore dot com>
- Date: Mon, 17 Dec 2012 06:26:37 -0500
- Subject: [commit] LynxOS: Resume the same thread when receiving a thread create/exit event.
Before this patch, the ptid passed to lynx_resume was completely
ignored, and we used the current_inferior. This resulted in trying
to resume the inferior execution using the wrong ptid after having
received a thread create/exit event, because the inferior_ptid
was still set to the ptid prior to receiving the signal.
gdb/gdbserver/ChangeLog:
* lynx-low.c (lynx_resume): Use the resume_info parameter
to determine the ptid for the lynx_ptrace call, unless
it is equal to minus_one_ptid, in which case we use the
ptid of the current_inferior.
(lynx_wait_1): After having received a thread create/exit
event, resume the inferior's execution using the signaling
thread's ptid, rather than the old ptid.
Tested on ppc-lynx5.
I hesitated a little before self-approving. But it seemed sufficiently
straightforward and enough of an improvement (in lynx_resume) that
I allowed myself to go ahead. I will handle comments right away,
if any.
Checked in.
Thanks,
--
Joel
---
gdb/gdbserver/ChangeLog | 10 ++++++++++
gdb/gdbserver/lynx-low.c | 11 +++++++----
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 8ba20b0..40bcbab 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,15 @@
2012-12-17 Joel Brobecker <brobecker@adacore.com>
+ * lynx-low.c (lynx_resume): Use the resume_info parameter
+ to determine the ptid for the lynx_ptrace call, unless
+ it is equal to minus_one_ptid, in which case we use the
+ ptid of the current_inferior.
+ (lynx_wait_1): After having received a thread create/exit
+ event, resume the inferior's execution using the signaling
+ thread's ptid, rather than the old ptid.
+
+2012-12-17 Joel Brobecker <brobecker@adacore.com>
+
* lynx-low.c (lynx_wait_1): Add debug trace before adding
new thread.
diff --git a/gdb/gdbserver/lynx-low.c b/gdb/gdbserver/lynx-low.c
index 644ff35..3173e3a 100644
--- a/gdb/gdbserver/lynx-low.c
+++ b/gdb/gdbserver/lynx-low.c
@@ -349,14 +349,17 @@ lynx_attach (unsigned long pid)
static void
lynx_resume (struct thread_resume *resume_info, size_t n)
{
- ptid_t inferior_ptid = thread_to_gdb_id (current_inferior);
/* FIXME: Assume for now that n == 1. */
+ ptid_t ptid = resume_info[0].thread;
const int request = (resume_info[0].kind == resume_step
? PTRACE_SINGLESTEP : PTRACE_CONT);
const int signal = resume_info[0].sig;
+ if (ptid_equal (ptid, minus_one_ptid))
+ ptid = thread_to_gdb_id (current_inferior);
+
regcache_invalidate ();
- lynx_ptrace (request, inferior_ptid, 1, signal, 0);
+ lynx_ptrace (request, ptid, 1, signal, 0);
}
/* Resume the execution of the given PTID. */
@@ -497,12 +500,12 @@ retry:
case SIGNEWTHREAD:
/* We just added the new thread above. No need to do anything
further. Just resume the execution again. */
- lynx_continue (ptid);
+ lynx_continue (new_ptid);
goto retry;
case SIGTHREADEXIT:
remove_thread (find_thread_ptid (new_ptid));
- lynx_continue (ptid);
+ lynx_continue (new_ptid);
goto retry;
}
}
--
1.7.0.4