From patchwork Wed Jun 27 10:17:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Bunt X-Patchwork-Id: 28066 Received: (qmail 18121 invoked by alias); 27 Jun 2018 10:18:07 -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 18110 invoked by uid 89); 27 Jun 2018 10:18:06 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: EUR01-HE1-obe.outbound.protection.outlook.com Received: from mail-he1eur01on0073.outbound.protection.outlook.com (HELO EUR01-HE1-obe.outbound.protection.outlook.com) (104.47.0.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 27 Jun 2018 10:18:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dwNFjwpVcmowoJloFPo8K+s68Ei2If5trqKT0VXhtQU=; b=CBP+FYv4s2kvUdRSaqM9xYXnNWQITP4LIBlB7KSH5yZWHAnTIwx4I/vkzBdOR91mjr3TOSz+0YT+uSw/s3tWpRRjXDWwCJzADK+5CrSiWuUoMpsAjg4i7dLHNvL6yZhmj73i5c9+KnRRvZZWza2hg96r3m9FXdJ6iLC7Ho51kPs= Received: from [10.32.32.29] (217.140.96.140) by AM0PR08MB3186.eurprd08.prod.outlook.com (2603:10a6:208:5d::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.23; Wed, 27 Jun 2018 10:18:01 +0000 To: gdb-patches@sourceware.org Cc: nd@arm.com From: Richard Bunt Subject: [PATCH] Fixed top frame assumption in watchpoint-hw-attach Message-ID: Date: Wed, 27 Jun 2018 11:17:56 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 Return-Path: richard.bunt@arm.com Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Richard.Bunt@arm.com; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-IsSubscribed: yes Fixed top frame assumption in watchpoint-hw-attach watchpoint-hw-attach.exp was noticed to fail on some machines. Thanks to the input from sergiodj and palves on the IRC channel, it was concluded that the test case incorrectly assumed that on attach it was landed in the top-most frame of the inferior. This was fixed by running to a break point in main by explicitly defining the source file name before continuing with the test. Tested on the following architectures x86_64, aarch64 and ppc64le. gdb/testsuite/ChangeLog: 2018-06-25 Richard Bunt * gdb.base/watchpoint-hw-attach.c (main): Remove unneeded code. * gdb.base/watchpoint-hw-attach.exp: Break in outermost frame. --- gdb/testsuite/gdb.base/watchpoint-hw-attach.c | 1 - gdb/testsuite/gdb.base/watchpoint-hw-attach.exp | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/gdb/testsuite/gdb.base/watchpoint-hw-attach.c b/gdb/testsuite/gdb.base/watchpoint-hw-attach.c index 9d55b28..5bfea50 100644 --- a/gdb/testsuite/gdb.base/watchpoint-hw-attach.c +++ b/gdb/testsuite/gdb.base/watchpoint-hw-attach.c @@ -36,7 +36,6 @@ main (void) for (counter = 0; !should_continue && counter < 100; counter++) sleep (1); /* pidacquired */ - watched_variable = 0; /* prewatchtrigger */ /* Trigger a watchpoint. */ watched_variable = 4; printf ("My variable is %d\n", watched_variable); diff --git a/gdb/testsuite/gdb.base/watchpoint-hw-attach.exp b/gdb/testsuite/gdb.base/watchpoint-hw-attach.exp index 0c5037c..ba7205d 100644 --- a/gdb/testsuite/gdb.base/watchpoint-hw-attach.exp +++ b/gdb/testsuite/gdb.base/watchpoint-hw-attach.exp @@ -57,12 +57,12 @@ clean_restart $binfile gdb_test "attach $testpid" "Attaching to program: .*, process $testpid.*" -gdb_test_no_output "set should_continue = 1" - # Ensure the test program is in the top frame so the required # variables are in scope. -gdb_breakpoint [gdb_get_line_number "prewatchtrigger"] -gdb_continue_to_breakpoint "prewatchtrigger" +gdb_breakpoint $srcfile:[gdb_get_line_number "pidacquired"] +gdb_continue_to_breakpoint "$srcfile:pidacquired" + +gdb_test_no_output "set should_continue = 1" gdb_test "watch watched_variable" \ "Hardware watchpoint $decimal: watched_variable"