From: Yao Qi <qiyaoltc@gmail.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] [arm] watchpoint-reuse-slot.exp: skip setting HW points on some address
Date: Fri, 10 Apr 2015 13:01:00 -0000 [thread overview]
Message-ID: <1428670853-1336-1-git-send-email-qiyaoltc@gmail.com> (raw)
From: Yao Qi <yao.qi@linaro.org>
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 <yao.qi@linaro.org>
* 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
--
1.9.1
next reply other threads:[~2015-04-10 13:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-10 13:01 Yao Qi [this message]
2015-04-10 13:57 ` Pedro Alves
2015-04-10 15:25 ` Yao Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1428670853-1336-1-git-send-email-qiyaoltc@gmail.com \
--to=qiyaoltc@gmail.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox