From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11429 invoked by alias); 13 Sep 2011 14:42:35 -0000 Received: (qmail 11418 invoked by uid 22791); 13 Sep 2011 14:42:34 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 13 Sep 2011 14:42:21 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=EU1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1R3UBn-0004rN-I1 from pedro_alves@mentor.com ; Tue, 13 Sep 2011 07:42:19 -0700 Received: from scottsdale.localnet ([172.16.63.104]) by EU1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 13 Sep 2011 15:42:16 +0100 From: Pedro Alves To: Edjunior Barbosa Machado Subject: Re: Watchpoint resource accounting broken (Re: [5/6] breakpoints_ops for all kinds of breakpoints: new watchpoints instance type) Date: Tue, 13 Sep 2011 14:54:00 -0000 User-Agent: KMail/1.13.6 (Linux/2.6.38-11-generic; KDE/4.7.0; x86_64; ; ) Cc: Ulrich Weigand , gdb-patches@sourceware.org References: <201109121503.p8CF3JCD003396@d06av02.portsmouth.uk.ibm.com> <201109131355.11485.pedro@codesourcery.com> <4E6F6A30.2040101@linux.vnet.ibm.com> In-Reply-To: <4E6F6A30.2040101@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201109131542.14795.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: 2011-09/txt/msg00213.txt.bz2 On Tuesday 13 September 2011 15:35:28, Edjunior Barbosa Machado wrote: > On 09/13/2011 09:55 AM, Pedro Alves wrote: > > Can you expand on this? I don't think I'm understanding that problem. > > The problem of setting watches before run the inferior occurs because > update_watchpoint() expect that the watchpoint being parsed shouldn't be > in the breakpoint_chain. > > When you adds the watchpoint it passes through update_watchpoint() the > first time without reparsing it, but it adds the watch to the > breakpoint_chain right after (in install_breakpoint()). Then, after > start the inferior, when running update_watchpoint() again, > hw_watchpoint_used_count() will count this watch previously added and > reparse will not evaluate the available resources properly. > Moreover, I've noticed it doesn't occur on x86 since > target_can_use_hardware_watchpoint() (i386_can_use_hw_breakpoint()) > always returns 1, but affects archs such as ppc64. This problem in > specific can be seen on gdb.base/watchpoint-hw.exp testcase. > > By the way, had the chance to retest your new patch on ppc64 and it > seems to fix several issues related to watchpoints, including the > failure pointed by gdb.base/watchpoint-hw.exp. Ah, okay. I thought you were describing some other problem. That happens if we just always added the current watchpoint's resources in addition to the resources of the watchpoints already listed, because we would count the same breakpoint twice in some paths. Waiting on Ulrich (or anyone else) to comment then. -- Pedro Alves