From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4468 invoked by alias); 13 Sep 2011 14:37:14 -0000 Received: (qmail 4364 invoked by uid 22791); 13 Sep 2011 14:37:13 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e24smtp04.br.ibm.com (HELO e24smtp04.br.ibm.com) (32.104.18.25) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 13 Sep 2011 14:36:55 +0000 Received: from /spool/local by br.ibm.com with XMail ESMTP for from ; Tue, 13 Sep 2011 11:36:45 -0300 Received: from d24relay01.br.ibm.com ([9.8.31.16]) by br.ibm.com ([10.172.0.140]) with XMail ESMTP; Tue, 13 Sep 2011 11:35:32 -0300 Received: from d24av03.br.ibm.com (d24av03.br.ibm.com [9.8.31.95]) by d24relay01.br.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p8DEYmEf3137740 for ; Tue, 13 Sep 2011 11:34:48 -0300 Received: from d24av03.br.ibm.com (loopback [127.0.0.1]) by d24av03.br.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p8DEZelU016909 for ; Tue, 13 Sep 2011 11:35:40 -0300 Received: from [9.18.201.23] ([9.18.201.23]) by d24av03.br.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p8DEZd1H016875; Tue, 13 Sep 2011 11:35:40 -0300 Message-ID: <4E6F6A30.2040101@linux.vnet.ibm.com> Date: Tue, 13 Sep 2011 14:42:00 -0000 From: Edjunior Barbosa Machado User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.20) Gecko/20110805 Lightning/1.0b2 Thunderbird/3.1.12 MIME-Version: 1.0 To: Pedro Alves CC: Ulrich Weigand , gdb-patches@sourceware.org Subject: Re: Watchpoint resource accounting broken (Re: [5/6] breakpoints_ops for all kinds of breakpoints: new watchpoints instance type) References: <201109121503.p8CF3JCD003396@d06av02.portsmouth.uk.ibm.com> <4E6E2265.8050102@linux.vnet.ibm.com> <201109131355.11485.pedro@codesourcery.com> In-Reply-To: <201109131355.11485.pedro@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit x-cbid: 11091314-8936-0000-0000-0000046F5AEB 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/msg00212.txt.bz2 On 09/13/2011 09:55 AM, Pedro Alves wrote: > On Monday 12 September 2011 16:16:53, Edjunior Barbosa Machado wrote: >> On 09/12/2011 12:03 PM, Ulrich Weigand wrote: >>> Note how just "i", the result of hw_watchpoint_used_count, is passed to >>> target_can_use_hardware_watchpoint -- this works only if the current >>> watchpoint is on the list that hw_watchpoint_used_count iterates over. >> >> I noticed this problem too and was considering use "i + reg_cnt" instead >> of only "i" when calling hw_watchpoint_used_count() (actually, I saw gdb >> used to use this previously). >> However, with this change, due to the same problem with the watchpoint >> added to breakpoint list that Ulrich mentioned, watchpoints added before >> run the inferior will not work. > > 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. Thanks, -- Edjunior