From patchwork Fri Mar 4 10:44:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 11190 Received: (qmail 118086 invoked by alias); 4 Mar 2016 10:44:58 -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 117256 invoked by uid 89); 4 Mar 2016 10:44:57 -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-languages-length:2195 X-HELO: mail-pf0-f193.google.com Received: from mail-pf0-f193.google.com (HELO mail-pf0-f193.google.com) (209.85.192.193) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 04 Mar 2016 10:44:54 +0000 Received: by mail-pf0-f193.google.com with SMTP id q129so2982034pfb.3 for ; Fri, 04 Mar 2016 02:44:53 -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=RrqotOuBaDTiqgpynjVjB2igDL60ql8+ljkz3IPyGv4=; b=EadUnlpxJHRbRF/NjAFh2y+mF+xv6pygohOuYRVtrjTNiE5L7PaRw5cjMN7mt/FWXs 6g8P5NlWfdIVTiiSIYY1llzU+Jf/U9SlKWQjdQZjUcw/wDCiN6+t1mLj8sMaEp16e4Yf FHM4YyiJ+aH5Ec09d+uTApQEySJic8N6tRO+2l2UhcVSs6eZuaKU5JfVnZ1z+Y0ilCok cQmCikcNbV4Zc4Pb+fI4TpsRpxLCc42Peic8ztOOjYl0LXbL3/02G6YwIdhHMO943KBi H8uARYieEL89M4LmNbUkfD6Yge2f36ak9n1oaOI/GnaB7ergBOMAhR+bmVjFWHaycCGv m7gg== X-Gm-Message-State: AD7BkJJZlXrF8CrrCPgxhAwuLUcOQRtlauaW60XsrFhXVuy5Yt3Dijnp/RtLpnIuLCxZzg== X-Received: by 10.98.86.139 with SMTP id h11mr10830567pfj.105.1457088291255; Fri, 04 Mar 2016 02:44:51 -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.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 04 Mar 2016 02:44:50 -0800 (PST) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 7/8] Resume the inferior with signal rather than stepping over Date: Fri, 4 Mar 2016 10:44:35 +0000 Message-Id: <1457088276-1170-8-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 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-04 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 2330e67..9bae787 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -4119,12 +4119,10 @@ single_step (struct lwp_info* lwp) } /* The signal can not be delivered to the inferior if we are trying to - reinsert a breakpoint for software single step or we're trying to finish a fast tracepoint collect. */ #define LWP_SIGNAL_CAN_BE_DELIVERED(LWP) \ - !(((LWP)->bp_reinsert != 0 && can_software_single_step ()) \ - || (LWP)->collecting_fast_tracepoint) + !((LWP)->collecting_fast_tracepoint) /* Resume execution of LWP. If STEP is nonzero, single-step it. If SIGNAL is nonzero, give it that signal. */ @@ -4572,6 +4570,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;