Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Luis Machado <lgustavo@codesourcery.com>
To: Pedro Alves <palves@redhat.com>, <gdb-patches@sourceware.org>
Subject: Re: [PATCH 4/5] gdbserver: Leave already-vCont-resumed threads as they were
Date: Wed, 17 Feb 2016 11:46:00 -0000	[thread overview]
Message-ID: <56C45D7D.2040904@codesourcery.com> (raw)
In-Reply-To: <1455677091-13683-5-git-send-email-palves@redhat.com>

On 02/17/2016 12:44 AM, Pedro Alves wrote:
> Currently GDB never sends more than one action per vCont packet, when
> connected in non-stop mode.  A follow up patch will change that, and
> it exposed a gdbserver problem with the vCont handling.
>
> For example, this in non-stop mode:
>
>    => vCont;s:p1.1;c
>    <= OK
>
> Should be equivalent to:
>
>    => vCont;s:p1.1
>    <= OK
>    => vCont;c
>    <= OK
>
> But gdbserver currently doesn't handle this.  In the latter case,
> "vCont;c" makes gdbserver clobber the previous step request.  This
> patch fixes that.
>
> Note the server side must ignore resume actions for the thread that
> has a pending %Stopped notification (and any other threads with events
> pending), until GDB acks the notification with vStopped.  Otherwise,
> e.g., the following case is mishandled:
>
>   #1 => g  (or any other packet)
>   #2 <= [registers]
>   #3 <= %Stopped T05 thread:p1.2
>   #4 => vCont s:p1.1;c
>   #5 <= OK
>
> Above, the server must not resume thread p1.2 when it processes the
> vCont.  GDB can't know that p1.2 stopped until it acks the %Stopped
> notification.  (Otherwise it wouldn't send a default "c" action.)
>
> (The vCont documentation already specifies this.)
>
> Finally, special care must also be given to handling fork/vfork
> events.  A (v)fork event actually tells us that two processes stopped
> -- the parent and the child.  Until we follow the fork, we must not
> resume the child.  Therefore, if we have a pending fork follow, we
> must not send a global wildcard resume action (vCont;c).  We can still
> send process-wide wildcards though.
>
> (The comments above will be added as code comments to gdb in a follow
> up patch.)
>
> gdb/gdbserver/ChangeLog:
> 2016-02-16  Pedro Alves  <palves@redhat.com>
>
> 	* linux-low.c (linux_set_resume_request): Ignore resume requests
> 	for already-resumed threads.
> 	* server.c (in_queued_stop_replies_ptid, in_queued_stop_replies):
> 	New functions.
> 	* server.h (in_queued_stop_replies): New declaration.
> ---
>   gdb/gdbserver/linux-low.c | 27 +++++++++++++++++++++++++++
>   gdb/gdbserver/server.c    | 33 ++++++++++++++++++++++++++++++++-
>   gdb/gdbserver/server.h    |  4 ++++
>   3 files changed, 63 insertions(+), 1 deletion(-)
>
> diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
> index 8b025bd..2cac4c0 100644
> --- a/gdb/gdbserver/linux-low.c
> +++ b/gdb/gdbserver/linux-low.c
> @@ -4465,6 +4465,33 @@ linux_set_resume_request (struct inferior_list_entry *entry, void *arg)
>   	      continue;
>   	    }
>
> +	  /* Ignore (wildcard) resume requests for already-resumed
> +	     requests.  */

For already-resumed requests or threads? Looked a little confusing.

If you really meant "requests", then we may need to adjust the wording a 
bit, like "for requests that have already been acknowledged.".

The rest of the series looks good to me.


  reply	other threads:[~2016-02-17 11:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-17  2:44 [PATCH 0/5] Coalesce/aggregate (async) vCont packets/actions Pedro Alves
2016-02-17  2:44 ` [PATCH 1/5] gdb: Clean up remote.c:remote_resume Pedro Alves
2016-02-17 11:45   ` Luis Machado
2016-02-17 12:32     ` Pedro Alves
2016-02-17 13:44       ` Luis Machado
2016-02-17  2:44 ` [PATCH 2/5] gdb: Free inferior->priv when inferior exits Pedro Alves
2016-02-17  2:44 ` [PATCH 3/5] gdb/doc: Clarify vCont packet description Pedro Alves
2016-02-17 15:56   ` Eli Zaretskii
2016-02-17  2:51 ` [PATCH 4/5] gdbserver: Leave already-vCont-resumed threads as they were Pedro Alves
2016-02-17 11:46   ` Luis Machado [this message]
2016-02-17 12:32     ` Pedro Alves
2016-10-26 15:39       ` Pedro Alves
2016-02-17  2:51 ` [PATCH 5/5] gdb: Coalesce/aggregate (async) vCont packets/actions Pedro Alves
2016-02-17 13:42   ` Luis Machado
2016-10-26 15:35     ` 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=56C45D7D.2040904@codesourcery.com \
    --to=lgustavo@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /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