From patchwork Fri Apr 17 09:40:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 47276 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AE3E420553 for ; Fri, 17 Apr 2015 09:40:25 +0000 (UTC) Received: by lbcne10 with SMTP id ne10sf22553863lbc.1 for ; Fri, 17 Apr 2015 02:40:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:mailing-list :precedence:list-id:list-unsubscribe:list-subscribe:list-archive :list-post:list-help:sender:delivered-to:from:to:subject:date :message-id:x-original-sender:x-original-authentication-results; bh=SxiTVcq8JO+Po/cl3eivuHR0zzIR6VLkelrrz+KBgvk=; b=eP0lh4Oncz1LznFzGpa0XXcrKY1lN4pG0gLRZSR4ibmIosi7WPqat88vhelmUHKydN XAH/S0ztLbpg2eMX/SLci/lk87gI/xlcsnURvlbL1lo/SoaHccwBP5iql6Qw+uRtWNru aTd4YUQPgdzkQkfRCy7HcjlIEggUXJmPVTYXMI38tF/EfScTVca4BXVGPBtWDOEBBDCm MhwiLZblhFHcRspnXaMpg2G61i9X22LJ0hxAToJAcwmx5/Lc/lRWvI+7pRI0sflBj6Id fIysf1pRdogL5OcTXc29Dgqv3gci/Dd8eMQjv/JO9MaEMqsD4aeoEjKJLSeeqj5XiSgM lKqg== X-Gm-Message-State: ALoCoQmB1QOyRatgdT+bfPGoCRwBJ7TF9dXVvaGj0qVD/0XC40bmoBWYik6Q4xWi6FyIzojRMDGV X-Received: by 10.112.122.39 with SMTP id lp7mr966347lbb.5.1429263624663; Fri, 17 Apr 2015 02:40:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.205.70 with SMTP id le6ls456000lac.50.gmail; Fri, 17 Apr 2015 02:40:24 -0700 (PDT) X-Received: by 10.112.169.42 with SMTP id ab10mr1852129lbc.3.1429263624519; Fri, 17 Apr 2015 02:40:24 -0700 (PDT) Received: from mail-lb0-x232.google.com (mail-lb0-x232.google.com. [2a00:1450:4010:c04::232]) by mx.google.com with ESMTPS id l7si8367056lbb.115.2015.04.17.02.40.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Apr 2015 02:40:24 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::232 as permitted sender) client-ip=2a00:1450:4010:c04::232; Received: by lbbzk7 with SMTP id zk7so78435737lbb.0 for ; Fri, 17 Apr 2015 02:40:24 -0700 (PDT) X-Received: by 10.112.199.133 with SMTP id jk5mr1933057lbc.32.1429263624429; Fri, 17 Apr 2015 02:40:24 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.67.65 with SMTP id l1csp3622675lbt; Fri, 17 Apr 2015 02:40:23 -0700 (PDT) X-Received: by 10.70.30.193 with SMTP id u1mr3856635pdh.59.1429263623496; Fri, 17 Apr 2015 02:40:23 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id mi9si15993741pab.79.2015.04.17.02.40.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Apr 2015 02:40:23 -0700 (PDT) Received-SPF: pass (google.com: domain of gdb-patches-return-122060-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 90771 invoked by alias); 17 Apr 2015 09:40:14 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list 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 90754 invoked by uid 89); 17 Apr 2015 09:40:13 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f181.google.com Received: from mail-pd0-f181.google.com (HELO mail-pd0-f181.google.com) (209.85.192.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 17 Apr 2015 09:40:12 +0000 Received: by pdbqa5 with SMTP id qa5so122835143pdb.1 for ; Fri, 17 Apr 2015 02:40:10 -0700 (PDT) X-Received: by 10.66.66.41 with SMTP id c9mr3891678pat.128.1429263610854; Fri, 17 Apr 2015 02:40:10 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by mx.google.com with ESMTPSA id t9sm9623041pas.3.2015.04.17.02.40.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Apr 2015 02:40:10 -0700 (PDT) From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH] return zero in arm_linux_can_use_hw_breakpoint if HW point isn't supported Date: Fri, 17 Apr 2015 10:40:00 +0100 Message-Id: <1429263600-4098-1-git-send-email-qiyaoltc@gmail.com> X-IsSubscribed: yes X-Original-Sender: qiyaoltc@gmail.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::232 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@sourceware.org; dmarc=fail (p=NONE dis=NONE) header.from=gmail.com X-Google-Group-Id: 836684582541 From: Yao Qi This patch is to cherry-pick part of Pedro's patch here https://sourceware.org/ml/gdb-patches/2015-04/msg00527.html in which zero is returned if the HW point isn't supported. In arm-linux native gdb testing on a board doesn't support HW breakpoint, without this patch, the output in gdb.base/breakpoint-in-ro-region.exp is like: (gdb) hbreak *0x83bc^M Hardware breakpoints used exceeds limit.^M (gdb) PASS: gdb.base/breakpoint-in-ro-region.exp: probe hbreak support (support) with this patch, the output becomes: (gdb) hbreak *0x83bc^M No hardware breakpoint support in the target.^M (gdb) PASS: gdb.base/breakpoint-in-ro-region.exp: probe hbreak support (no support) As a result, the following fails are fixed. -FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted off: auto-hw on: step in ro region (cannot insert hw break) -FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted off: auto-hw on: thread advanced -FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted on: auto-hw on: step in ro region (cannot insert hw break) -FAIL: gdb.base/breakpoint-in-ro-region.exp: always-inserted on: auto-hw on: thread advanced gdb: 2015-04-17 Pedro Alves * arm-linux-nat.c (arm_linux_can_use_hw_breakpoint): Return zero if HW point of TYPE isn't supported. --- gdb/arm-linux-nat.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index bb8358c..afc5817 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -771,12 +771,20 @@ arm_linux_can_use_hw_breakpoint (struct target_ops *self, if (type == bp_hardware_watchpoint || type == bp_read_watchpoint || type == bp_access_watchpoint || type == bp_watchpoint) { - if (cnt + ot > arm_linux_get_hw_watchpoint_count ()) + int count = arm_linux_get_hw_watchpoint_count (); + + if (count == 0) + return 0; + else if (cnt + ot > count) return -1; } else if (type == bp_hardware_breakpoint) { - if (cnt > arm_linux_get_hw_breakpoint_count ()) + int count = arm_linux_get_hw_breakpoint_count (); + + if (count == 0) + return 0; + else if (cnt > count) return -1; } else