From patchwork Tue Apr 14 11:45:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 47143 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 013092121F for ; Tue, 14 Apr 2015 11:46:15 +0000 (UTC) Received: by lbcne10 with SMTP id ne10sf1892160lbc.1 for ; Tue, 14 Apr 2015 04:46:13 -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=gt5thfB9Y/1+zfT1IC2rr0TZBbUQybN/bMHuPU64fT8=; b=aeSRs2LRKQcKvBFeP8w7E86SzmivvhbX9BaN1oqtfJZk4fj96pQ1D5uoDdnLnUkft/ 6ER0wtRJeO551AXU+v4gm7ABD+oPbVYkJ1DdZipmFzcFPyyfdS4JFnGpYV1IjLHnHwHi dWpAVfzMtEc0/rK/Eui/refQt+0tUY3uqIlw7utQg60UaeaLTJK2sws8Hw9k8d4PruDs L+Oh8TgMO95e8GGodqoT4vCeZljIs2uB1SaGicvXxZ/XP6/DjFdkJYSisLuchLKfaa/y GXOw/chsAYLUNwr1mg2myiQznl2e7ir+YVwkvcTuA3/fGp8o+nhuwfa8cwmsGzU6fw7B 8xMg== X-Gm-Message-State: ALoCoQlNAdX2z3Ko85uPYkgun30bgasQJsGfrcx/vQJGBV96XWwC0OGCXTk9uDEmUszd/iJjEkl6 X-Received: by 10.180.105.226 with SMTP id gp2mr2705965wib.1.1429011973715; Tue, 14 Apr 2015 04:46:13 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.10.208 with SMTP id k16ls36609lab.42.gmail; Tue, 14 Apr 2015 04:46:13 -0700 (PDT) X-Received: by 10.152.238.7 with SMTP id vg7mr17897415lac.3.1429011973430; Tue, 14 Apr 2015 04:46:13 -0700 (PDT) Received: from mail-la0-x22d.google.com (mail-la0-x22d.google.com. [2a00:1450:4010:c03::22d]) by mx.google.com with ESMTPS id rm3si704542lbb.5.2015.04.14.04.46.13 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Apr 2015 04:46:13 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22d as permitted sender) client-ip=2a00:1450:4010:c03::22d; Received: by layy10 with SMTP id y10so5682417lay.0 for ; Tue, 14 Apr 2015 04:46:13 -0700 (PDT) X-Received: by 10.112.140.231 with SMTP id rj7mr17494594lbb.76.1429011973289; Tue, 14 Apr 2015 04:46:13 -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 l1csp1802977lbt; Tue, 14 Apr 2015 04:46:12 -0700 (PDT) X-Received: by 10.66.235.200 with SMTP id uo8mr35524787pac.18.1429011971299; Tue, 14 Apr 2015 04:46:11 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id kz11si1202649pab.98.2015.04.14.04.46.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Apr 2015 04:46:11 -0700 (PDT) Received-SPF: pass (google.com: domain of gdb-patches-return-121931-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 123120 invoked by alias); 14 Apr 2015 11:46:01 -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 123107 invoked by uid 89); 14 Apr 2015 11:46:00 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f49.google.com Received: from mail-pa0-f49.google.com (HELO mail-pa0-f49.google.com) (209.85.220.49) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 14 Apr 2015 11:45:58 +0000 Received: by pabsx10 with SMTP id sx10so8950813pab.3 for ; Tue, 14 Apr 2015 04:45:57 -0700 (PDT) X-Received: by 10.70.126.225 with SMTP id nb1mr35722449pdb.71.1429011956954; Tue, 14 Apr 2015 04:45:56 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc1-power7.osuosl.org. [140.211.15.137]) by mx.google.com with ESMTPSA id pb2sm914052pdb.33.2015.04.14.04.45.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Apr 2015 04:45:56 -0700 (PDT) From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH] [testsuite] Probe awatch/rwatch support Date: Tue, 14 Apr 2015 12:45:49 +0100 Message-Id: <1429011949-28215-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:c03::22d 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 I see some awatch/rwatch related fails on one arm board which doesn't hw watchpoint or it is not enabled in the kernel, like this, rwatch global^M Expression cannot be implemented with read/access watchpoint.^M (gdb) FAIL: gdb.base/break-idempotent.exp: always-inserted off: rwatch: once: rwatch global Although we've had a proc skip_hw_watchpoint_access_tests to check whether rwatch/awatch is supported according to target triplet, it isn't accurate because HW watchpoint support varies on different processor implementations and linux kernel of the same arch. This patch is to probe the awatch/rwatch support in a new proc gdb_read_access_watchpoint, and callers just bail out the test if awatch/rwatch isn't supported or isn't successfully created. This patch skips these tests on native arm-linux testing, so fails go away. -FAIL: gdb.base/break-idempotent.exp: always-inserted off: rwatch: once: rwatch global -FAIL: gdb.base/break-idempotent.exp: always-inserted off: rwatch: twice: rwatch global -FAIL: gdb.base/break-idempotent.exp: always-inserted off: awatch: once: awatch global -FAIL: gdb.base/break-idempotent.exp: always-inserted off: awatch: twice: awatch global -FAIL: gdb.base/break-idempotent.exp: always-inserted on: rwatch: once: rwatch global -FAIL: gdb.base/break-idempotent.exp: always-inserted on: rwatch: twice: rwatch global -FAIL: gdb.base/break-idempotent.exp: always-inserted on: awatch: once: awatch global -FAIL: gdb.base/break-idempotent.exp: always-inserted on: awatch: twice: awatch global -FAIL: gdb.base/watch-read.exp: set hardware read watchpoint on global variable -FAIL: gdb.base/watch-read.exp: read watchpoint triggers on first read (timeout) -FAIL: gdb.base/watch-read.exp: read watchpoint triggers on read after value changed (timeout) -FAIL: gdb.base/watch-read.exp: set write watchpoint on global variable (timeout) -FAIL: gdb.base/watch-read.exp: write watchpoint triggers (timeout) -FAIL: gdb.base/watch-read.exp: only write watchpoint triggers when value changes (timeout) -FAIL: gdb.base/watch-read.exp: read watchpoint triggers when value doesn't change, trapping reads and writes (timeout) -FAIL: gdb.base/watch-read.exp: only read watchpoint triggers when value doesn't change (timeout) -FAIL: gdb.base/watch_thread_num.exp: Watchpoint on shared variable -FAIL: gdb.base/watch_thread_num.exp: info breakpoint shows watchpoint is thread-specific -FAIL: gdb.base/watch_thread_num.exp: Watchpoint triggered iteration 1 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Check thread that triggered iteration 1 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Watchpoint triggered iteration 2 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Check thread that triggered iteration 2 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Watchpoint triggered iteration 3 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Check thread that triggered iteration 3 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Watchpoint triggered iteration 4 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Check thread that triggered iteration 4 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Watchpoint triggered iteration 5 (timeout) -FAIL: gdb.base/watch_thread_num.exp: Check thread that triggered iteration 5 (timeout) -FAIL: gdb.base/watchpoint-hw-hit-once.exp: continue -FAIL: gdb.base/watchpoint-hw-hit-once.exp: continue to break-at-exit (the program exited) -FAIL: gdb.multi/watchpoint-multi.exp: awatch c on inferior 2 this patch should also fix fails in gdb.base/watch_thread_num.exp on s390x, which were reporeted here: https://www.sourceware.org/ml/gdb-testers/2015-q2/msg01663.html gdb/testsuite: 2015-04-14 Yao Qi * gdb.base/break-idempotent.exp (set_breakpoint): Match the output for read/access watchpoint. * gdb.base/watch-read.exp: Invoke gdb_read_access_watchpoint and return if it returns false. * gdb.base/watch_thread_num.exp: Likewise. * gdb.base/watchpoint-hw-hit-once.exp: Likewise. * gdb.multi/watchpoint-multi.exp: Likewise. * gdb.base/watchpoint-reuse-slot.exp: Match the output for read/access watchpoint. * lib/gdb.exp (gdb_read_access_watchpoint): New proc. --- gdb/testsuite/gdb.base/break-idempotent.exp | 7 +++++++ gdb/testsuite/gdb.base/watch-read.exp | 8 ++++---- gdb/testsuite/gdb.base/watch_thread_num.exp | 7 ++++--- gdb/testsuite/gdb.base/watchpoint-hw-hit-once.exp | 4 +++- gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp | 3 +++ gdb/testsuite/gdb.multi/watchpoint-multi.exp | 6 +++--- gdb/testsuite/lib/gdb.exp | 25 +++++++++++++++++++++++ 7 files changed, 49 insertions(+), 11 deletions(-) diff --git a/gdb/testsuite/gdb.base/break-idempotent.exp b/gdb/testsuite/gdb.base/break-idempotent.exp index c5dae96..ef7db22 100644 --- a/gdb/testsuite/gdb.base/break-idempotent.exp +++ b/gdb/testsuite/gdb.base/break-idempotent.exp @@ -107,6 +107,13 @@ proc set_breakpoint { break_command } { -re "Could not insert hardware watchpoint.*$gdb_prompt $" { unsupported $test } + -re "Expression cannot be implemented with read/access watchpoint..*$gdb_prompt $" { + if { $break_command == "watch" } { + fail $test + } else { + unsupported $test + } + } -re "atchpoint \[0-9\]+: global\r\n$gdb_prompt $" { pass $test } diff --git a/gdb/testsuite/gdb.base/watch-read.exp b/gdb/testsuite/gdb.base/watch-read.exp index ddba14e..4bf9a9e 100644 --- a/gdb/testsuite/gdb.base/watch-read.exp +++ b/gdb/testsuite/gdb.base/watch-read.exp @@ -42,10 +42,10 @@ set read_line [gdb_get_line_number "read line" $srcfile] # Test running to a read of `global', with a read watchpoint set # watching it. - -gdb_test "rwatch global" \ - "Hardware read watchpoint .*: global" \ - "set hardware read watchpoint on global variable" +if { ![gdb_read_access_watchpoint "rwatch" "global" \ + "set hardware read watchpoint on global variable"] } { + return +} # The first read is on entry to the loop. diff --git a/gdb/testsuite/gdb.base/watch_thread_num.exp b/gdb/testsuite/gdb.base/watch_thread_num.exp index d559f22..1995e5d 100644 --- a/gdb/testsuite/gdb.base/watch_thread_num.exp +++ b/gdb/testsuite/gdb.base/watch_thread_num.exp @@ -71,9 +71,10 @@ delete_breakpoints # simultaneously, on targets with continuable watchpoints, such as # x86. See PR breakpoints/10116. -gdb_test "awatch shared_var thread $thread_num" \ - "Hardware access \\(read/write\\) watchpoint .*: shared_var.*" \ - "Watchpoint on shared variable" +if { ![gdb_read_access_watchpoint "awatch" "shared_var thread $thread_num" \ + "Watchpoint on shared variable"] } { + return +} gdb_test "info breakpoint \$bpnum" \ "stop only in thread $thread_num" \ diff --git a/gdb/testsuite/gdb.base/watchpoint-hw-hit-once.exp b/gdb/testsuite/gdb.base/watchpoint-hw-hit-once.exp index 7ae76e0..d0aa2b9 100644 --- a/gdb/testsuite/gdb.base/watchpoint-hw-hit-once.exp +++ b/gdb/testsuite/gdb.base/watchpoint-hw-hit-once.exp @@ -27,7 +27,9 @@ if ![runto_main] { return -1 } -gdb_test "rwatch watchee" +if { ![gdb_read_access_watchpoint "rwatch" "watchee" "rwatch watchee"] } { + return +} gdb_breakpoint [gdb_get_line_number "dummy = 2"] diff --git a/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp b/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp index abe81d6..d9a7cee 100644 --- a/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp +++ b/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp @@ -106,6 +106,9 @@ foreach cmd {"watch" "awatch" "rwatch"} { -re "Target does not support.*$gdb_prompt $" { unsupported $test } + -re "Expression cannot be implemented with read/access watchpoint..*$gdb_prompt $" { + unsupported $test + } -re "$gdb_prompt $" { pass $test lappend cmds $cmd diff --git a/gdb/testsuite/gdb.multi/watchpoint-multi.exp b/gdb/testsuite/gdb.multi/watchpoint-multi.exp index dcf2f1b..7cd437f 100644 --- a/gdb/testsuite/gdb.multi/watchpoint-multi.exp +++ b/gdb/testsuite/gdb.multi/watchpoint-multi.exp @@ -60,9 +60,9 @@ gdb_load $binfile gdb_breakpoint main {temporary} gdb_test "run" "Temporary breakpoint.* main .*" "start to main inferior 2" -gdb_test "awatch c" \ - "Hardware access \\(read/write\\) watchpoint \[0-9\]+: c" \ - "awatch c on inferior 2" +if { ![gdb_read_access_watchpoint "awatch" "c" "awatch c on inferior 2"] } { + return +} gdb_breakpoint "marker_exit" diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index f1616e3..1448fba 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -455,6 +455,31 @@ proc gdb_breakpoint { function args } { return 1 } +# Insert read/access watchpoint on location LOC. TYPE is either rwatch +# or awatch. Emit PASS, FAIL or UNSUPPORTED in test summary. Return 1 +# for success, 0 for failure. + +proc gdb_read_access_watchpoint { type loc message } { + global gdb_prompt + + gdb_test_multiple "$type $loc" $message { + -re "Target does not support this type of hardware watchpoint\\.\r\n$gdb_prompt $" { + unsupported $message + } + -re "Could not insert hardware watchpoint.*$gdb_prompt $" { + unsupported $message + } + -re "Expression cannot be implemented with read/access watchpoint..*$gdb_prompt $" { + unsupported $message + } + -re "Hardware .* watchpoint .*: .*\r\n$gdb_prompt $" { + pass $message + return 1 + } + } + return 0; +} + # Set breakpoint at function and run gdb until it breaks there. # Since this is the only breakpoint that will be set, if it stops # at a breakpoint, we will assume it is the one we want. We can't