[RFC 1/2] Check input interrupt first when reading packet

Pedro Alves palves@redhat.com
Thu Jan 7 17:26:00 GMT 2016


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



More information about the Gdb-patches mailing list