public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Yao Qi <qiyaoltc@gmail.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/2] [GDBserver] Check input interrupt after reading in a packet
Date: Tue, 26 Jan 2016 11:42:00 -0000	[thread overview]
Message-ID: <56A75BA7.6070602@redhat.com> (raw)
In-Reply-To: <1453802339-20401-2-git-send-email-yao.qi@linaro.org>

On 01/26/2016 09:58 AM, Yao Qi wrote:

> +  /* The '\003' may appear after some packet, and check it in the buffer,
> +     so that we can process the interrupt in time.  */

I can't parse seem to parse this correctly.

I think we should expand the explanation, like:

  /* The readchar above may have already read a '\003' out of the socket and
   moved it to the local buffer.  For example, when GDB sends vCont;c immediately
   followed by interrupt (see gdb.base/interrupt-noterm.exp).  As soon as we see
   the vCont;c, we'll resume the inferior and wait.  Since we've already moved
   the '\003' to the local buffer, SIGIO won't help.  In that case, if we don't
   check for interrupt after the vCont;c packet, the interrupt character would
   stay in the buffer unattended until after the next (unrelated) stop.  */

> +  if (readchar_bufcnt > 0 && *readchar_bufp == '\003')

This should be a "while" instead of a single "if".

> +    {
> +      /* Consume the interrupt character in the buffer.  */
> +      readchar ();
> +      (*the_target->request_interrupt) ();
> +    }
> +
>    return bp - buf;
>  }

Otherwise LGTM.

Thanks,
Pedro Alves

  reply	other threads:[~2016-01-26 11:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-22 16:29 [PATCH] Fix fail in gdb.base/interrupt-noterm.exp Yao Qi
2016-01-22 16:47 ` Pedro Alves
2016-01-22 17:14   ` Yao Qi
2016-01-22 17:35     ` Pedro Alves
2016-01-22 18:30       ` Pedro Alves
2016-01-25  9:30       ` Yao Qi
2016-01-25 10:43         ` Pedro Alves
2016-01-26  9:59         ` [PATCH 0/2 V2] Fix a " Yao Qi
2016-01-26  9:59           ` [PATCH 1/2] [GDBserver] Check input interrupt after reading in a packet Yao Qi
2016-01-26 11:42             ` Pedro Alves [this message]
2016-01-26 13:53               ` Yao Qi
2016-01-26  9:59           ` [PATCH 2/2] [GDBserver] Block and unblock SIGIO Yao Qi
2016-01-26 12:01             ` Pedro Alves
2016-01-26 13:55               ` Yao Qi

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=56A75BA7.6070602@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=qiyaoltc@gmail.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).