[PATCH 1/2] [GDBserver] Check input interrupt after reading in a packet
Pedro Alves
palves@redhat.com
Tue Jan 26 11:42:00 GMT 2016
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
More information about the Gdb-patches
mailing list