From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8648 invoked by alias); 25 Jan 2016 09:30:30 -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 8521 invoked by uid 89); 25 Jan 2016 09:30:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=arrives, HX-Received:Mon X-HELO: mail-pf0-f179.google.com Received: from mail-pf0-f179.google.com (HELO mail-pf0-f179.google.com) (209.85.192.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 25 Jan 2016 09:30:23 +0000 Received: by mail-pf0-f179.google.com with SMTP id n128so79239782pfn.3 for ; Mon, 25 Jan 2016 01:30:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type :content-transfer-encoding; bh=iPhweL58zkb9rA1NmtzgEepwhFZW4Lpl1XkV8MeNBnA=; b=GoyMAJKbrYKTZo/23DBSlkfgVSitz8UbzmREUQaOqgzCcxs4lJOpaENaE8nVRS3nWq mtdamFt0WQ93D/hJS5/8jypzvgptxa+tbuxaCDMmCNWL2nEbCEzUMapej5TGA/4sclzJ Q/+4tN90L+VAOjt+w+rVildQ8OAnVXHFuoYu3ypriegH72xAUAppbtd43UdELHOfUQBr q+/HicFRKsOEVk6ukVWr6QgpG+lCUJua/7sT0SSPC27M4ae2sNZhYpwlAaKAXgrHUZoL srdKwrTOUApIMih1xgGgVkj/X7V4BeOOjxEnd9sxx4cGbdZTUlYQxq699gVovEpMHo1b Qrng== X-Gm-Message-State: AG10YORhTQyPGekubgH5xFhb/ZEXM3ILgGV27eQbz3toJMMoSZnQ6iy1d6f5xYYTEd/pJg== X-Received: by 10.98.70.90 with SMTP id t87mr24598898pfa.110.1453714221406; Mon, 25 Jan 2016 01:30:21 -0800 (PST) Received: from E107787-LIN (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id o67sm27001860pfa.58.2016.01.25.01.30.17 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 25 Jan 2016 01:30:20 -0800 (PST) From: Yao Qi To: Pedro Alves Cc: Yao Qi , gdb-patches@sourceware.org Subject: Re: [PATCH] Fix fail in gdb.base/interrupt-noterm.exp References: <1453480183-5131-1-git-send-email-yao.qi@linaro.org> <56A25D13.2080608@redhat.com> <86twm5r0yp.fsf@gmail.com> <56A26849.9070206@redhat.com> Date: Mon, 25 Jan 2016 09:30:00 -0000 In-Reply-To: <56A26849.9070206@redhat.com> (Pedro Alves's message of "Fri, 22 Jan 2016 17:35:05 +0000") Message-ID: <86powqqa57.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2016-01/txt/msg00611.txt.bz2 Pedro Alves writes: > If 1. is followed by 3., then the \\003 is always read by gdb s/ready by/sent by/ ? > after the vCont;c. We call enable_async_io before reaching > mywait. Since we're in all-stop, that means we'll block Although we call enable_async_io earlier, so the window between received vCont;c and calling enable_async_io is tiny, it is still possible that \\003 arrives at that period. > inside mywait -> waitpid, all the while \\003 is already available to > read in the socket. Since we're blocked in waitpid, we won't see > the \\003 until after the next time the program happens to stop. > > Agree? Yes, I agree. > > It still seems to me like a gdbserver bug. > > I think that after calling enable_async_io, we need to check whether > input is already pending from GDB, and if so, process it immediately -- we > know the only input coming from GDB at this point is a \\003. IOW, I thi= nk > we need to call input_interrupt after calling enable_async_io. input_int= errupt > already uses select before reading, so it handles the case of there > being no input available without blocking. > > However, we need to be careful, because a SIGIO can race with calling > input_interrupt from mainline code... What you mean here is that we can call input_interrupt after calling enable_async_io, but meanwhile, \\0003 arrives, and input_interrupt is invoked as a SIGIO handler, so there is a race. Is it correct? I agree your next email about the approach of block/unblock SIGIO is better. I'll give a fix that way. --=20 Yao (=E9=BD=90=E5=B0=A7)