[2/2] watchpoint-reuse-slot.exp: skip when requesting two breakpoints in one slot on aarch64

Message ID 1426257692-30461-2-git-send-email-qiyaoltc@gmail.com
State New, archived
Headers

Commit Message

Yao Qi March 13, 2015, 2:41 p.m. UTC
  From: Yao Qi <yao.qi@linaro.org>

watchpoint-reuse-slot.exp sets two hardware breakpoints in contiguous
address to reuse one debug register.  However, requested address for
breakpoint should be 4-byte aligned on aarch64, so it is impossible
to request two hardware breakpoints and use one debug register.  This
patch is to skip the test in the case on aarch64-linux.  Since arm
has Thumb mode, in which instruction address can be 2-byte aligned,
more thoughts are needed for arm in my next step.

gdb/testsuite:

2015-03-13  Yao Qi  <yao.qi@linaro.org>

	* gdb.base/watchpoint-reuse-slot.exp: Skip tests when two
	breakpoints are requested on aarch64-linux.
---
 gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
  

Comments

Pedro Alves March 16, 2015, 12:35 p.m. UTC | #1
On 03/13/2015 02:41 PM, Yao Qi wrote:
> From: Yao Qi <yao.qi@linaro.org>
> 
> watchpoint-reuse-slot.exp sets two hardware breakpoints in contiguous
> address to reuse one debug register.  However, requested address for
> breakpoint should be 4-byte aligned on aarch64, so it is impossible
> to request two hardware breakpoints and use one debug register.  This
> patch is to skip the test in the case on aarch64-linux.  Since arm
> has Thumb mode, in which instruction address can be 2-byte aligned,
> more thoughts are needed for arm in my next step.

So I take it that GDB complains when the user tries this, and thus
the test is failing on aarch64?  What does the log show?

Thanks,
Pedro Alves
  
Yao Qi March 16, 2015, 2:10 p.m. UTC | #2
Pedro Alves <palves@redhat.com> writes:

> So I take it that GDB complains when the user tries this, and thus
> the test is failing on aarch64?  What does the log show?

Yes, some tests fail on aarch64.

stepi^M
Warning:^M
Cannot insert hardware breakpoint 224.^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: hbreak x hbreak: : width 1, iter 0: base + 1: stepi advanced

hbreak *(buf.byte + 0 + 1)^M
Hardware assisted breakpoint 448 at 0x410a61^M
Warning:^M
Cannot insert hardware breakpoint 448.^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: hbreak x hbreak: : width 1, iter 0: base + 1: hbreak *(buf.byte + 0 + 1)

all the fails this patch fixes are:
FAIL: gdb.base/watchpoint-reuse-slot.exp: always-inserted off: hbreak x hbreak: : width 1, iter 0: base + 1: stepi advanced
FAIL: gdb.base/watchpoint-reuse-slot.exp: always-inserted off: hbreak x hbreak: : width 1, iter 1: base + 0: stepi advanced
FAIL: gdb.base/watchpoint-reuse-slot.exp: always-inserted off: hbreak x hbreak: : width 1, iter 1: base + 1: stepi advanced
FAIL: gdb.base/watchpoint-reuse-slot.exp: always-inserted off: hbreak x hbreak: : width 1, iter 2: base + 0: stepi advanced
FAIL: gdb.base/watchpoint-reuse-slot.exp: always-inserted off: hbreak x hbreak: : width 1, iter 2: base + 1: stepi advanced
FAIL: gdb.base/watchpoint-reuse-slot.exp: always-inserted off: hbreak x hbreak: : width 1, iter 3: base + 0: stepi advanced
FAIL: gdb.base/watchpoint-reuse-slot.exp: always-inserted on: hbreak x hbreak: : width 1, iter 0: base + 1: hbreak *(buf.byte + 0 + 1)
FAIL: gdb.base/watchpoint-reuse-slot.exp: always-inserted on: hbreak x hbreak: : width 1, iter 0: base + 1: stepi advanced
FAIL: gdb.base/watchpoint-reuse-slot.exp: always-inserted on: hbreak x hbreak: : width 1, iter 1: base + 0: hbreak *(buf.byte + 1 + 0)
FAIL: gdb.base/watchpoint-reuse-slot.exp: always-inserted on: hbreak x hbreak: : width 1, iter 1: base + 0: stepi advanced
FAIL: gdb.base/watchpoint-reuse-slot.exp: always-inserted on: hbreak x hbreak: : width 1, iter 1: base + 1: hbreak *(buf.byte + 1 + 1)
FAIL: gdb.base/watchpoint-reuse-slot.exp: always-inserted on: hbreak x hbreak: : width 1, iter 1: base + 1: stepi advanced
FAIL: gdb.base/watchpoint-reuse-slot.exp: always-inserted on: hbreak x hbreak: : width 1, iter 2: base + 0: hbreak *(buf.byte + 2 + 0)
FAIL: gdb.base/watchpoint-reuse-slot.exp: always-inserted on: hbreak x hbreak: : width 1, iter 2: base + 0: stepi advanced
FAIL: gdb.base/watchpoint-reuse-slot.exp: always-inserted on: hbreak x hbreak: : width 1, iter 2: base + 1: hbreak *(buf.byte + 2 + 1)
FAIL: gdb.base/watchpoint-reuse-slot.exp: always-inserted on: hbreak x hbreak: : width 1, iter 2: base + 1: stepi advanced
FAIL: gdb.base/watchpoint-reuse-slot.exp: always-inserted on: hbreak x hbreak: : width 1, iter 3: base + 0: hbreak *(buf.byte + 3 + 0)
FAIL: gdb.base/watchpoint-reuse-slot.exp: always-inserted on: hbreak x hbreak: : width 1, iter 3: base + 0: stepi advanced
  

Patch

diff --git a/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp b/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp
index df6eeb6..c646f22 100644
--- a/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp
+++ b/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp
@@ -178,10 +178,18 @@  foreach always_inserted {"off" "on" } {
 	foreach cmd2 $cmds {
 	    for {set width 1} {$width < 4} {incr width} {
 
-		if {$cmd1 == "hbreak" && $cmd2 == "hbreak" && $width > 1} {
-		    # hbreak ignores WIDTH, no use testing more than
-		    # once.
-		    continue
+		if {$cmd1 == "hbreak" && $cmd2 == "hbreak"} {
+		    if {$width > 1} {
+			# hbreak ignores WIDTH, no use testing more than
+			# once.
+			continue
+		    }
+
+		    if { [istarget "aarch64*-*-linux*"] } {
+			# The address for breakpoint should be 4-byte
+			# aligned, so can't reuse slot.
+			continue
+		    }
 		}
 
 		if {($cmd1 == "hbreak" && $cmd2 != "hbreak"