This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC 1/2] Check input interrupt first when reading packet
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 07 Jan 2016 17:26:48 +0000
- Subject: Re: [RFC 1/2] Check input interrupt first when reading packet
- Authentication-results: sourceware.org; auth=none
- References: <1450697443-29067-1-git-send-email-yao dot qi at linaro dot org> <1450697443-29067-2-git-send-email-yao dot qi at linaro dot org> <568AAEA6 dot 4050303 at redhat dot com> <86lh84x9i0 dot fsf at gmail dot com>
On 01/05/2016 04:43 PM, Yao Qi wrote:
> Pedro Alves <palves@redhat.com> writes:
>
> Hi Pedro,
> sorry for the delayed reply. Takes much time reading these patches and
> discussions in archives.
Likewise here.
> I am inclined to tweak the doc as well, because looks people at that
> moment believed that ^C is meaningless when the target is stopped.
> See https://www.sourceware.org/ml/gdb-patches/2005-11/msg00307.html
Alright, let's do this then.
>>> diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
>>> index 05e3d63..8bb5b13 100644
>>> --- a/gdb/gdbserver/remote-utils.c
>>> +++ b/gdb/gdbserver/remote-utils.c
>>> @@ -959,6 +959,15 @@ getpkt (char *buf)
>>> while (1)
>>> {
>>> c = readchar ();
>>> +
>>> + /* The '\003' may appear before or after each packet, so
>>> + check for an input interrupt. */
>>> + if (c == '\003')
>>> + {
>>> + (*the_target->request_interrupt) ();
>>> + c = readchar ();
>>
>> I'd write "continue;" instead of another readchar,
>>
>> (Pedantically, you could have another '\003' in the buffer.)
>
> Done.
LGTM.
Thanks,
Pedro Alves