This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 00/23] All-stop on top of non-stop
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 13 Apr 2015 17:22:59 +0100
- Subject: Re: [PATCH v2 00/23] All-stop on top of non-stop
- Authentication-results: sourceware.org; auth=none
- References: <1428410990-28560-1-git-send-email-palves at redhat dot com> <86lhi0v1el dot fsf at gmail dot com> <55278B2B dot 1070809 at redhat dot com> <868ue0uyfa dot fsf at gmail dot com> <552BE0A3 dot 5040001 at redhat dot com> <86vbh0t34m dot fsf at gmail dot com>
On 04/13/2015 05:16 PM, Yao Qi wrote:
> Pedro Alves <palves@redhat.com> writes:
>
> Pedro,
> I can't apply this patch cleanly, so unable to test it for
> aarch64-linux. I'll give a test once your V3 is posted, in which this
> patch is included, I assume.
Oh, sorry for not being clearer, I didn't meant for you to try
the patch, only to say that I got a handle in the issue, to avoid you
wasting any time trying to debug it, in case you felt compelled to do
that. I'll post something testable once I clean things up a bit more.
>
>> + /* If we have events pending, go through handle_inferior_event
>> + again, picking up a pending event at random. This avoids
>> + thread starvation. */
>> + pending = iterate_over_threads (resumed_thread_with_pending_status,
>> + NULL);
>
> A quick question, I don't see how pending events are picked up at
> random. Do you mean target_ops->to_wait, such as linux_nat_wait, can
> get event at random?
>
It's done in do_target_wait. So we go back to the event loop,
and end up in fetch_inferior_event again. In the series/branch, that
fetch_inferior_event calls do_target_wait instead of target_wait directly:
/* Wrapper for target_wait that first checks whether threads have
pending status to report before actually asking the target for more
events. */
static ptid_t
do_target_wait (ptid_t ptid, struct target_waitstatus *status, int options)
{
which calls random_pending_event_thread, and that is what takes care
of the randomization.
Thanks,
Pedro Alves