From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 112628 invoked by alias); 4 Mar 2016 10:44:52 -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 112007 invoked by uid 89); 4 Mar 2016 10:44:51 -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=Breakpoint, Hx-languages-length:2229, HX-Received:10.98.42.207 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:49 +0000 Received: by mail-pf0-f193.google.com with SMTP id q129so2981911pfb.3 for ; Fri, 04 Mar 2016 02:44:49 -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=8ammpNJ9e5JYilJHJRLHjOtoJOaZdhdraS5ILiAwDt8=; b=fh062FeT4qNpoGxBJtuM86ro4Elika4lqfEF9WUo0KNHHOPnvnZ1WW1MKipivFXRmQ EGwB7iTWfvBE6aUiCgCWwPECC3NIOLXWzIVE99lJIlq9uyRY1et1LZTg05dJyHIp+gAn KoxdOpEP+1fXbLe5ybUju8Q7ijNhtlOxzysWf7HYeGW35Xu4JCNfhFoZSyvE29K8eZPl SN8jN2l29lpDEGCSfM7LcrZibZrU4swqKnFMMkk2KGzuXSClyfaS+N/olbyUu/4wumfO h26c9HSN6E7GzFI93i/I7WuoQ9qeB2kFQbA15XHyW6/YNJnBN0j679Pw2ohDEdZAb+tq zLgg== X-Gm-Message-State: AD7BkJIcfyyr6rwBjWnQ8pqzq56zhSdg17TRFo0b55WizSt68SkahFGbtWtBLY6pRkmNYw== X-Received: by 10.98.42.207 with SMTP id q198mr10942440pfq.103.1457088287456; Fri, 04 Mar 2016 02:44:47 -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.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 04 Mar 2016 02:44:46 -0800 (PST) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 4/8] Force to insert software single step breakpoint Date: Fri, 04 Mar 2016 10:44:00 -0000 Message-Id: <1457088276-1170-5-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 X-SW-Source: 2016-03/txt/msg00073.txt.bz2 GDB doesn't insert software single step breakpoint if the instruction branches to itself, so that the program can't stop after command "si". (gdb) b 32 Breakpoint 2 at 0x8680: file git/gdb/testsuite/gdb.base/branch-to-self.c, line 32. (gdb) c Continuing. Breakpoint 2, main () at gdb/git/gdb/testsuite/gdb.base/branch-to-self.c:32 32 asm (".Lhere: " BRANCH_INSN " .Lhere"); /* loop-line */ (gdb) si infrun: clear_proceed_status_thread (Thread 3991.3991) infrun: proceed (addr=0xffffffff, signal=GDB_SIGNAL_DEFAULT) infrun: step-over queue now empty infrun: resuming [Thread 3991.3991] for step-over infrun: skipping breakpoint: stepping past insn at: 0x8680 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sending packet: $Z0,8678,4#f3...Packet received: OK infrun: skipping breakpoint: stepping past insn at: 0x8680 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Sending packet: $Z0,b6fe86c8,4#82...Packet received: OK infrun: resume (step=1, signal=GDB_SIGNAL_0), trap_expected=1, current thread [Thread 3991.3991] at 0x868 breakpoint.c:should_be_inserted thinks the breakpoint shouldn't be inserted, which is wrong. This patch restrict the condition that only return false if breakpoint is NOT single step breakpoint. gdb: 2016-03-02 Yao Qi * breakpoint.c (should_be_inserted): Don't return 0 if single step breakpoint is inserted at the address we're stepping over. --- gdb/breakpoint.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index f99a7ab..72a3fdb 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -2219,9 +2219,12 @@ should_be_inserted (struct bp_location *bl) return 0; /* Don't insert a breakpoint if we're trying to step past its - location. */ + location except single step breakpoint, because the single step + breakpoint may be inserted at the location we're trying to step + if the instruction branches to itself. */ if ((bl->loc_type == bp_loc_software_breakpoint || bl->loc_type == bp_loc_hardware_breakpoint) + && bl->owner->type != bp_single_step && stepping_past_instruction_at (bl->pspace->aspace, bl->address)) { -- 1.9.1