From patchwork Fri Mar 4 10:44:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 11186 Received: (qmail 110647 invoked by alias); 4 Mar 2016 10:44:49 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 110184 invoked by uid 89); 4 Mar 2016 10:44:48 -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=Hx-spam-relays-external:209.85.192.194, H*RU:209.85.192.194, STEP, Hx-languages-length:2326 X-HELO: mail-pf0-f194.google.com Received: from mail-pf0-f194.google.com (HELO mail-pf0-f194.google.com) (209.85.192.194) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 04 Mar 2016 10:44:46 +0000 Received: by mail-pf0-f194.google.com with SMTP id x188so828048pfb.2 for ; Fri, 04 Mar 2016 02:44:46 -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:subject:date:message-id:in-reply-to :references; bh=6yfZCzDqnuyK9F93xYKEc3/tH+nHvmY2J+x7jVJfCOc=; b=LHbO8tqWlTYx/+E0evJlIyp60HSVVQhstEO+nU7/G3fW1bdI14hdXTAZGKxb8ehABJ PTXOv8I0b2UpyzjOh23a+ewp9axPAlxWe7GIDDY3vpEOJ2JuD51OpgeocVYsM2F7WjK8 dp7sBW2pC2M2x2tDQyuaYeUrrRhPQftONZI/z91oGLh5OjAGhveWn6kMOGkQ/nL/a3qG S3OCGe01ePUqdzFc56e6ozVQ1BBb8p1nRf0C3gwSQjOWg+pMF3OtTpyEbN47fZ2shtjx EPYAfdH9Xok0OkBxjbvk2oaJYF/kfTw3Y7PMm279wHqe2AdQfTorbKko0RljiALNlFLU DI3Q== X-Gm-Message-State: AD7BkJIvp6L023brmMFNq2rxPrT39nAP0UD6tUKGDao8by/teRZvVqSOufH6HE3G0mF9Vg== X-Received: by 10.98.79.205 with SMTP id f74mr10876127pfj.68.1457088284736; Fri, 04 Mar 2016 02:44:44 -0800 (PST) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id e20sm4604321pfd.4.2016.03.04.02.44.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 04 Mar 2016 02:44:44 -0800 (PST) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 2/8] Check LWP_SIGNAL_CAN_BE_DELIVERED for enqueue/dequeue pending signals Date: Fri, 4 Mar 2016 10:44:30 +0000 Message-Id: <1457088276-1170-3-git-send-email-yao.qi@linaro.org> In-Reply-To: <1457088276-1170-1-git-send-email-yao.qi@linaro.org> References: <1457088276-1170-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes 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 macro LWP_SIGNAL_CAN_BE_DELIVERED, so that the next patch can change the condition in one place. gdb/gdbserver: 2016-03-04 Yao Qi * linux-low.c (LWP_SIGNAL_CAN_BE_DELIVERED): New macro. (linux_resume_one_lwp_throw): Use LWP_SIGNAL_CAN_BE_DELIVERED. --- gdb/gdbserver/linux-low.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index 4520a4a..dcf58db 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -4118,6 +4118,13 @@ single_step (struct lwp_info* lwp) return step; } +/* The signal can not be delivered to the inferior if we are trying to + reinsert a breakpoint or we're trying to finish a fast tracepoint + collect. */ + +#define LWP_SIGNAL_CAN_BE_DELIVERED(LWP) \ + !((LWP)->bp_reinsert != 0 || (LWP)->collecting_fast_tracepoint) + /* Resume execution of LWP. If STEP is nonzero, single-step it. If SIGNAL is nonzero, give it that signal. */ @@ -4157,13 +4164,12 @@ linux_resume_one_lwp_throw (struct lwp_info *lwp, } /* 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 != 0 && (lwp->status_pending_p || lwp->pending_signals != NULL - || lwp->bp_reinsert != 0 - || fast_tp_collecting)) + || !LWP_SIGNAL_CAN_BE_DELIVERED (lwp))) { enqueue_pending_signal (lwp, signal, info); @@ -4269,12 +4275,9 @@ linux_resume_one_lwp_throw (struct lwp_info *lwp, } } - /* 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 != NULL - && lwp->bp_reinsert == 0 - && fast_tp_collecting == 0) + /* If we have pending signals, consume one if it can be delivered to + the inferior. */ + if (lwp->pending_signals != NULL && LWP_SIGNAL_CAN_BE_DELIVERED (lwp)) { struct pending_signals **p_sig;