From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4764 invoked by alias); 17 Mar 2016 08:40:45 -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 4740 invoked by uid 89); 17 Mar 2016 08:40:44 -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=sk:status_, 2016-03-17 X-HELO: mail-pf0-f182.google.com Received: from mail-pf0-f182.google.com (HELO mail-pf0-f182.google.com) (209.85.192.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 17 Mar 2016 08:40:43 +0000 Received: by mail-pf0-f182.google.com with SMTP id 124so111767652pfg.0 for ; Thu, 17 Mar 2016 01:40:40 -0700 (PDT) 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-transfer-encoding; bh=bfHqvPrgADsk42j9dLJdJj/yODSOSzRo6zHFiSnnZLw=; b=WvdXTR0EVvMQnNy3BQ8W39OmIcnMaUahgGLmDTy2HqDnUP6mJwuqjQ17e10ZNr4Nc0 fWs1AJU4amksef7IvC+jLlAmexbzNU62mJEeKOMkrjpsunmmxTPP88AtOUgD9UJU3pCq 7ogc7q6knYDp0K1KPGLH8zklb+oGRmTT/14KJBudsUxAgw2ErKR+qUieTAV6DqL0Q/J/ 0YiowsOnyJnhxYNGXvdoEi1z/ptkqjMKD927gLArJOcNIvbxd4LCOGthOJki2495t//q +hifWfU3YkbC95YioppQ3d6T1+QzY7NkkVp59H/Ocy7IDa/RI5px9EuirgG8ZC4xlFh7 ja3g== X-Gm-Message-State: AD7BkJLnrLyCxnXYwXwPcmJHN9BjnePdXU63aTxlFnY5It7apODUtHvPdAt4IQQl/XfBQw== X-Received: by 10.98.10.25 with SMTP id s25mr12858490pfi.158.1458204038867; Thu, 17 Mar 2016 01:40:38 -0700 (PDT) Received: from E107787-LIN (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id o69sm11308716pfi.14.2016.03.17.01.40.36 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 17 Mar 2016 01:40:38 -0700 (PDT) From: Yao Qi To: Pedro Alves Cc: Yao Qi , gdb-patches@sourceware.org Subject: Re: [PATCH 2/8] Check LWP_SIGNAL_CAN_BE_DELIVERED for enqueue/dequeue pending signals References: <1457088276-1170-1-git-send-email-yao.qi@linaro.org> <1457088276-1170-3-git-send-email-yao.qi@linaro.org> <56E2A42E.4080308@redhat.com> Date: Thu, 17 Mar 2016 08:40:00 -0000 In-Reply-To: <56E2A42E.4080308@redhat.com> (Pedro Alves's message of "Fri, 11 Mar 2016 10:55:42 +0000") Message-ID: <86a8lxxzsu.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-03/txt/msg00287.txt.bz2 Pedro Alves writes: > I like the idea, but why a macro instead of a function? I thought the condition is simple enough to be a macro. Here is the version to change it to function and also update comments as Luis suggested. --=20 Yao (=E9=BD=90=E5=B0=A7) =46rom 6c086204b3259e576ad9d4abe687ac6f697432fa Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Thu, 3 Mar 2016 08:44:01 +0000 Subject: [PATCH] Check lwp_signal_can_be_delivered for enqueue/dequeue pend= ing signals The enqueue and dequeue signals in linux_resume_one_lwp_throw use one condition and its inverted one. This patch is to move the condition into a function lwp_signal_can_be_delivered, so that the next patch can change the condition in one place. gdb/gdbserver: 2016-03-17 Yao Qi * linux-low.c (lwp_signal_can_be_delivered): New function. (linux_resume_one_lwp_throw): Use lwp_signal_can_be_delivered. diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index 4520a4a..ee8e42a 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -4118,6 +4118,16 @@ single_step (struct lwp_info* lwp) return step; } =20 +/* The signal can be delivered to the inferior if we are not trying to + reinsert a breakpoint and not trying to finish a fast tracepoint + collect. */ + +static int +lwp_signal_can_be_delivered (struct lwp_info *lwp) +{ + return !(lwp->bp_reinsert !=3D 0 || lwp->collecting_fast_tracepoint); +} + /* Resume execution of LWP. If STEP is nonzero, single-step it. If SIGNAL is nonzero, give it that signal. */ =20 @@ -4157,13 +4167,12 @@ linux_resume_one_lwp_throw (struct lwp_info *lwp, } =20 /* If we have pending signals or status, and a new signal, enqueue the - signal. Also enqueue the signal if we are waiting to reinsert a - breakpoint; it will be picked up again below. */ + signal. Also enqueue the signal if it can't be delivered to the + inferior right now. */ if (signal !=3D 0 && (lwp->status_pending_p || lwp->pending_signals !=3D NULL - || lwp->bp_reinsert !=3D 0 - || fast_tp_collecting)) + || !lwp_signal_can_be_delivered (lwp))) { enqueue_pending_signal (lwp, signal, info); =20 @@ -4269,12 +4278,9 @@ linux_resume_one_lwp_throw (struct lwp_info *lwp, } } =20 - /* If we have pending signals, consume one unless we are trying to - reinsert a breakpoint or we're trying to finish a fast tracepoint - collect. */ - if (lwp->pending_signals !=3D NULL - && lwp->bp_reinsert =3D=3D 0 - && fast_tp_collecting =3D=3D 0) + /* If we have pending signals, consume one if it can be delivered to + the inferior. */ + if (lwp->pending_signals !=3D NULL && lwp_signal_can_be_delivered (lwp)) { struct pending_signals **p_sig; =20