From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17916 invoked by alias); 28 Sep 2010 16:08:36 -0000 Received: (qmail 17904 invoked by uid 22791); 28 Sep 2010 16:08:35 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,TW_EG,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 28 Sep 2010 16:08:30 +0000 Received: (qmail 1272 invoked from network); 28 Sep 2010 16:08:29 -0000 Received: from unknown (HELO orlando.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 28 Sep 2010 16:08:29 -0000 From: Pedro Alves To: gdb-patches@sourceware.org, luisgpm@linux.vnet.ibm.com Subject: Re: [PATCH] testcases: Fix assorted problems related to powerpc Date: Tue, 28 Sep 2010 21:48:00 -0000 User-Agent: KMail/1.13.2 (Linux/2.6.33-29-realtime; KDE/4.4.2; x86_64; ; ) References: <1285689421.12736.138.camel@gargoyle> In-Reply-To: <1285689421.12736.138.camel@gargoyle> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201009281708.26790.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-09/txt/msg00475.txt.bz2 On Tuesday 28 September 2010 16:57:01, Luis Machado wrote: > gdb.base/watch-read.exp tries to create both a HW write watchpoint and a > HW read watchpoint, but since POWER server processors only support a > single HW watchpoint, this doesn't work right. It's strange, though, > that GDB actually creates two HW watches for ppc, but the last one > overrides the read/write flags of the previous one and thus we miss > triggers. I've used an awatch instead, though i'd have to check if GDB > is doing something wrong and if we could make this testcase pass without > any changes. The results with AWATCH are pretty much the same as with > RWATCH + WATCH. > GDB is doing something wrong, and it's possible to make ppc pass this testcase without any (test) changes. I think the patch below is what I used to test on ppc when I wrote that test (), and the test passed with it. -- Pedro Alves Index: src/gdb/ppc-linux-nat.c =================================================================== --- src.orig/gdb/ppc-linux-nat.c 2010-02-22 12:27:25.000000000 -0800 +++ src/gdb/ppc-linux-nat.c 2010-02-22 12:27:29.000000000 -0800 @@ -1270,6 +1270,9 @@ store_ppc_registers (const struct regcac store_spe_register (regcache, tid, -1); } +/* The cached DABR value, to install in new threads. */ +static long saved_dabr_value; + static int ppc_linux_check_watch_resources (int type, int cnt, int ot) { @@ -1324,9 +1327,6 @@ ppc_linux_region_ok_for_hw_watchpoint (C return 1; } -/* The cached DABR value, to install in new threads. */ -static long saved_dabr_value; - /* Set a watchpoint of type TYPE at address ADDR. */ static int ppc_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw) @@ -1352,6 +1352,11 @@ ppc_linux_insert_watchpoint (CORE_ADDR a } dabr_value = addr & ~(read_mode | write_mode); + + gdb_assert (saved_dabr_value == 0 + || (saved_dabr_value & ~(read_mode | write_mode)) == dabr_value); + + dabr_value |= (saved_dabr_value & (read_mode | write_mode)); switch (rw) { case hw_read: