This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/2] [GDBserver] Check input interrupt after reading in a packet
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>, gdb-patches at sourceware dot org
- Date: Tue, 26 Jan 2016 11:42:31 +0000
- Subject: Re: [PATCH 1/2] [GDBserver] Check input interrupt after reading in a packet
- Authentication-results: sourceware.org; auth=none
- References: <86powqqa57 dot fsf at gmail dot com> <1453802339-20401-1-git-send-email-yao dot qi at linaro dot org> <1453802339-20401-2-git-send-email-yao dot qi at linaro dot 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