From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 122637 invoked by alias); 26 Jan 2016 11:42:35 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 122620 invoked by uid 89); 26 Jan 2016 11:42:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1173 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 26 Jan 2016 11:42:33 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id C67557AE8E; Tue, 26 Jan 2016 11:42:32 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0QBgVHk018227; Tue, 26 Jan 2016 06:42:32 -0500 Message-ID: <56A75BA7.6070602@redhat.com> Date: Tue, 26 Jan 2016 11:42:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Yao Qi , gdb-patches@sourceware.org Subject: Re: [PATCH 1/2] [GDBserver] Check input interrupt after reading in a packet References: <86powqqa57.fsf@gmail.com> <1453802339-20401-1-git-send-email-yao.qi@linaro.org> <1453802339-20401-2-git-send-email-yao.qi@linaro.org> In-Reply-To: <1453802339-20401-2-git-send-email-yao.qi@linaro.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-01/txt/msg00645.txt.bz2 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