* [commit] LynxOS: Resume the same thread when receiving a thread create/exit event.
@ 2012-12-17 11:26 Joel Brobecker
2012-12-17 11:33 ` Joel Brobecker
2013-01-04 20:59 ` Pedro Alves
0 siblings, 2 replies; 4+ messages in thread
From: Joel Brobecker @ 2012-12-17 11:26 UTC (permalink / raw)
To: gdb-patches; +Cc: Joel Brobecker
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [commit] LynxOS: Resume the same thread when receiving a thread create/exit event.
2012-12-17 11:26 [commit] LynxOS: Resume the same thread when receiving a thread create/exit event Joel Brobecker
@ 2012-12-17 11:33 ` Joel Brobecker
2013-01-04 20:59 ` Pedro Alves
1 sibling, 0 replies; 4+ messages in thread
From: Joel Brobecker @ 2012-12-17 11:33 UTC (permalink / raw)
To: gdb-patches
> 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.
[...]
> Checked in.
Actually, the checkin failed, because it depends on:
[RFC/commit 3/3] Delete unused variable in lynx_resume
http://www.sourceware.org/ml/gdb-patches/2012-12/msg00544.html
Resolving the conflict due to the dependency feels like undoing
the patch. So I will wait before putting this one in.
--
Joel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [commit] LynxOS: Resume the same thread when receiving a thread create/exit event.
2012-12-17 11:26 [commit] LynxOS: Resume the same thread when receiving a thread create/exit event Joel Brobecker
2012-12-17 11:33 ` Joel Brobecker
@ 2013-01-04 20:59 ` Pedro Alves
2013-01-07 11:52 ` Joel Brobecker
1 sibling, 1 reply; 4+ messages in thread
From: Pedro Alves @ 2013-01-04 20:59 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
On 12/17/2012 11:26 AM, Joel Brobecker wrote:
> 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.
Looks fine to me.
--
Pedro Alves
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [commit] LynxOS: Resume the same thread when receiving a thread create/exit event.
2013-01-04 20:59 ` Pedro Alves
@ 2013-01-07 11:52 ` Joel Brobecker
0 siblings, 0 replies; 4+ messages in thread
From: Joel Brobecker @ 2013-01-07 11:52 UTC (permalink / raw)
To: gdb-patches
> > 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.
[...]
> Looks fine to me.
Thanks! Checked in.
--
Joel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-01-07 11:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-17 11:26 [commit] LynxOS: Resume the same thread when receiving a thread create/exit event Joel Brobecker
2012-12-17 11:33 ` Joel Brobecker
2013-01-04 20:59 ` Pedro Alves
2013-01-07 11:52 ` Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox