From patchwork Fri Apr 10 13:00:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 6133 Received: (qmail 2458 invoked by alias); 10 Apr 2015 13:01:02 -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 2446 invoked by uid 89); 10 Apr 2015 13:01:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, NORMAL_HTTP_TO_IP, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f48.google.com Received: from mail-pa0-f48.google.com (HELO mail-pa0-f48.google.com) (209.85.220.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 10 Apr 2015 13:01:01 +0000 Received: by pabsx10 with SMTP id sx10so21099628pab.3 for ; Fri, 10 Apr 2015 06:00:59 -0700 (PDT) X-Received: by 10.66.228.130 with SMTP id si2mr2500746pac.92.1428670859402; Fri, 10 Apr 2015 06:00:59 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by mx.google.com with ESMTPSA id rx3sm2233829pbc.78.2015.04.10.06.00.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 10 Apr 2015 06:00:58 -0700 (PDT) From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH] [arm] watchpoint-reuse-slot.exp: skip setting HW points on some address Date: Fri, 10 Apr 2015 14:00:53 +0100 Message-Id: <1428670853-1336-1-git-send-email-qiyaoltc@gmail.com> X-IsSubscribed: yes From: Yao Qi Hi, ARM linux kernel has some requirements on the address/length setting for HW breakpoints/watchpoints, but watchpoint-reuse-slot.exp doesn't consider them and sets HW points on various addresses. Many fails are causes as a result: stepi^M Warning:^M Could not insert hardware watchpoint 20.^M Could not insert hardware breakpoints:^M You may have requested too many hardware breakpoints/watchpoints.^M ^M (gdb) FAIL: gdb.base/watchpoint-reuse-slot.exp: always-inserted off: watch x watch: : width 2, iter 2: base + 1: stepi advanced watch *(buf.byte + 2 + 1)@2^M Hardware watchpoint 388: *(buf.byte + 2 + 1)@2^M Warning:^M Could not insert hardware watchpoint 388.^M Could not insert hardware breakpoints:^M You may have requested too many hardware breakpoints/watchpoints.^M ^M (gdb) FAIL: gdb.base/watchpoint-reuse-slot.exp: always-inserted on: watch x watch: : width 2, iter 2: base + 1: watch *(buf.byte + 2 + 1)@2 This patch is to reflect kernel requirements in watchpoint-reuse-slot.exp in order to skip some tests. gdb/testsuite: 2015-04-10 Yao Qi * gdb.base/watchpoint-reuse-slot.exp (valid_addr_p): Return false for some offset and width combinations which aren't supported by linux kernel. --- gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp b/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp index 6d2c867..abe81d6 100644 --- a/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp +++ b/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp @@ -150,6 +150,33 @@ proc valid_addr_p {cmd offset width} { return 0 } } + } elseif { [istarget "arm*-*-linux*"] } { + if { $cmd == "hbreak" } { + # Breakpoints must be of length 2 (thumb) or 4 (ARM) bytes. + if { $width != 2 && $width != 4 } { + return 0 + } + } else { + # Watchpoints can be of length 1, 2, 4 or 8 bytes. + if { [expr $width % 2] != 0 } { + return 0 + } + } + + if { [expr ($offset) % 8] == 0 && $width == 8 } { + # If WIDTH is 8 byte, the address should be 8-byte aligned. + return 1 + } elseif { [expr ($offset) % 4] == 0 } { + return 1 + } elseif { [expr ($offset) % 4] == 2 && $width == 2 } { + # Halfword watchpoints and breakpoints. + return 1 + } elseif { [expr ($offset) % 4] == 1 && $width == 1 && $cmd != "hbreak" } { + # Single byte watchpoints. + return 1 + } else { + return 0 + } } return 1