From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 89540 invoked by alias); 23 Mar 2016 16:10:03 -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 89437 invoked by uid 89); 23 Mar 2016 16:10:02 -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=trap X-HELO: mail-pf0-f196.google.com Received: from mail-pf0-f196.google.com (HELO mail-pf0-f196.google.com) (209.85.192.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 23 Mar 2016 16:09:58 +0000 Received: by mail-pf0-f196.google.com with SMTP id q129so4626602pfb.3 for ; Wed, 23 Mar 2016 09:09:58 -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:subject:date:message-id:in-reply-to :references; bh=WTF1qlFW7g9BV5HPoIZc8j91Yw1CJkcBZXMD7MPppv0=; b=P4BMUag8/lfjfAajtJbe6PElC6+LENd3l282OjraFEYhYn9ilNC6oTeG4vvjHeArF4 W3W3JVGVFy5lKcJo5yEP8E0KOgY67Whz2OQr41pTnLIDrIaN1woZ3jKI2Us/EhHHX5Qe hHh6wqx/ocAwbT5PYDbwGYiNB58X8F5AD2VYCM92U2aWJkRBoIpSmUiXdu5OS7bjnS2u r3dolnMq7tm9qqA/9q4RyOUWEJS1mmxu19ZNfI5IrmRn+yehoO7les/tvFvJfhlvGqZK qM3QvoM/xu9NYSYDSeON57hBkIHScrvWWXTq1qzrBbEw8p6WYBbXzS3wpWWiDF1mGr8T vOnA== X-Gm-Message-State: AD7BkJLaBQZfS9RvT/Ds4+igJIkllCXoagF27avl9STdcrcsdXKQFrIrVGIUg5W8fTwtcw== X-Received: by 10.98.72.141 with SMTP id q13mr5488138pfi.152.1458749396553; Wed, 23 Mar 2016 09:09:56 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id 79sm5206701pfq.65.2016.03.23.09.09.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 Mar 2016 09:09:56 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 6/7] Resume the inferior with signal rather than stepping over Date: Wed, 23 Mar 2016 16:10:00 -0000 Message-Id: <1458749384-19793-7-git-send-email-yao.qi@linaro.org> In-Reply-To: <1458749384-19793-1-git-send-email-yao.qi@linaro.org> References: <1458749384-19793-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes X-SW-Source: 2016-03/txt/msg00474.txt.bz2 When GDBserver steps over a breakpoint using software single step, it enqueues the signal, single step and deliver the signal in the next resume if step over is not needed. In this way, the program won't receive the signal if the conditional breakpoint is set a branch to self instruction, because the step over is always needed. This patch removes the restriction that don't deliver the signal to the inferior if we are trying to reinsert a breakpoint for software single step and change the decision on resume vs. step-over when the LWP has pending signals to deliver. gdb/gdbserver: 2016-03-23 Yao Qi * linux-low.c (LWP_SIGNAL_CAN_BE_DELIVERED): Adjust. (need_step_over_p): Return zero if the LWP has pending signals can be delivered on software single step target. --- gdb/gdbserver/linux-low.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index 7e55349..6b72c91 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -4118,7 +4118,6 @@ single_step (struct lwp_info* lwp) } /* The signal can be delivered to the inferior if we are not trying to - reinsert a breakpoint for software single step and not trying to finish a fast tracepoint collect. Since signal can be delivered in the step-over, the program may go to signal handler and trap again after return from the signal handler. We can live with the spurious @@ -4127,8 +4126,7 @@ single_step (struct lwp_info* lwp) static int lwp_signal_can_be_delivered (struct lwp_info *lwp) { - return (!(lwp->bp_reinsert != 0 && can_software_single_step ()) - && !lwp->collecting_fast_tracepoint); + return !lwp->collecting_fast_tracepoint; } /* Resume execution of LWP. If STEP is nonzero, single-step it. If @@ -4577,6 +4575,20 @@ need_step_over_p (struct inferior_list_entry *entry, void *dummy) return 0; } + /* On software single step target, resume the inferior with signal + rather than stepping over. */ + if (can_software_single_step () + && lwp->pending_signals != NULL + && lwp_signal_can_be_delivered (lwp)) + { + if (debug_threads) + debug_printf ("Need step over [LWP %ld]? Ignoring, has pending" + " signals.\n", + lwpid_of (thread)); + + return 0; + } + saved_thread = current_thread; current_thread = thread; -- 1.9.1