public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Don Breazeal <donb@codesourcery.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v8 6/7] Remote fork catch
Date: Thu, 23 Apr 2015 14:19:00 -0000	[thread overview]
Message-ID: <5538FF8B.4020101@redhat.com> (raw)
In-Reply-To: <1429304325-13878-7-git-send-email-donb@codesourcery.com>

On 04/17/2015 09:58 PM, Don Breazeal wrote:

>> > I think there's a race here, in non-stop mode.  Consider:
>> > 
>> >  #1 - process forks just before gdb starts fetching the remote thread
>> >       list.
>> >  #2 - gdbserver adds the fork child  its thread list.
>> >  #3 - gdbserver queues the fork event, sends vStopped notification
>> >  #4 - gdb/remote_update_thread_list pulls the thread list
>> >  #5 - we're now in remove_new_fork_child, but we don't know
>> >       about the fork event yet.  It's still pending in the vStopped
>> >       queue.
>> > 
>> > So I think that we need to make remote_update_thread_list do,
>> > in this order:
>> > 
>> >  #1 - fetch the remote thread list
>> >  #2 - fetch the pending vStopped notifications
>> >         (remote_notif_get_pending_events)
>> >  #3 - call remove_new_fork_child
>> >  #4 - add threads we don't know about yet to our list.
>> > 
>> > and make remove_new_fork_child also peek at the
>> > pending vStopped events queue (and in the future at
>> > any other layers of pending events in the core side.)
> I think all that was necessary here was to insert a call to
> remote_notif_get_pending_events before the call to remove_new_fork_child,
> since remote_notif_get_pending_events ultimately calls
> remote_parse_stop_reply on the responses from the target, handling the
> pending events like normal events.  Or am I missing something?  I 
> inferred from your comment above that there might be more to it.

It fetches the vStopped notifications out of the remote,
and parses them, but the events are left in the stop reply
queue, they're not handled.  They're only handled once the
core next calls target_wait -> remote_wait_ns -> queued_stop_reply.

So we need to peek into the stop reply queue, and check if we have
pending fork events.  We have peek_stop_reply for a similar use,
but it's not the same.

Thanks,
Pedro Alves

  reply	other threads:[~2015-04-23 14:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-17 20:59 [PATCH v8 0/7] Don Breazeal
2015-04-17 20:59 ` [PATCH v8 3/7] Extended-remote Linux follow fork Don Breazeal
2015-04-23 14:18   ` Pedro Alves
2015-04-17 20:59 ` [PATCH v8 4/7] Arch-specific remote " Don Breazeal
2015-04-17 20:59 ` [PATCH v8 1/7] Identify remote fork event support Don Breazeal
2015-04-23 14:17   ` Pedro Alves
2015-04-17 20:59 ` [PATCH v8 2/7] Clone remote breakpoints Don Breazeal
2015-04-17 21:00 ` [PATCH v8 5/7] Remote follow vfork Don Breazeal
2015-04-23 14:19   ` Pedro Alves
2015-04-17 21:00 ` [PATCH v8 7/7] Extended-remote follow fork documentation Don Breazeal
2015-04-23 14:20   ` Pedro Alves
2015-04-17 21:00 ` [PATCH v8 6/7] Remote fork catch Don Breazeal
2015-04-23 14:19   ` Pedro Alves [this message]
2015-05-06 16:10     ` Don Breazeal
2015-05-08 10:14       ` Pedro Alves
2015-05-08 16:42         ` Don Breazeal
2015-05-08 17:47           ` Pedro Alves
2015-05-08 10:16       ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5538FF8B.4020101@redhat.com \
    --to=palves@redhat.com \
    --cc=donb@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).