From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10348 invoked by alias); 12 Sep 2011 15:17:31 -0000 Received: (qmail 10339 invoked by uid 22791); 12 Sep 2011 15:17:29 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e24smtp05.br.ibm.com (HELO e24smtp05.br.ibm.com) (32.104.18.26) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 12 Sep 2011 15:17:15 +0000 Received: from /spool/local by br.ibm.com with XMail ESMTP for from ; Mon, 12 Sep 2011 12:17:13 -0300 Received: from mailhub3.br.ibm.com ([9.18.232.110]) by br.ibm.com ([10.172.0.141]) with XMail ESMTP; Mon, 12 Sep 2011 12:17:10 -0300 Received: from d24av03.br.ibm.com (d24av03.br.ibm.com [9.8.31.95]) by mailhub3.br.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p8CFKDAi1810642 for ; Mon, 12 Sep 2011 12:20:16 -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 p8CFHDje024451 for ; Mon, 12 Sep 2011 12:17:14 -0300 Received: from [9.18.198.233] ([9.18.198.233]) by d24av03.br.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p8CFHDlM024441; Mon, 12 Sep 2011 12:17:13 -0300 Message-ID: <4E6E2265.8050102@linux.vnet.ibm.com> Date: Mon, 12 Sep 2011 15:23: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: Ulrich Weigand CC: Pedro Alves , 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> In-Reply-To: <201109121503.p8CF3JCD003396@d06av02.portsmouth.uk.ibm.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit x-cbid: 11091215-2362-0000-0000-000004D05A53 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/msg00196.txt.bz2 On 09/12/2011 12:03 PM, Ulrich Weigand wrote: > However, update_watchpoint relies on having the watchpoint under > investigation be on the breakpoint list; see the comment: > > /* We need to determine how many resources are already > used for all other hardware watchpoints plus this one > to see if we still have enough resources to also fit > this watchpoint in as well. To guarantee the > hw_watchpoint_used_count call below counts this > watchpoint, make sure that it is marked as a hardware > watchpoint. */ > if (b->base.type == bp_watchpoint) > b->base.type = bp_hardware_watchpoint; > > i = hw_watchpoint_used_count (b->base.type, &other_type_used); > target_resources_ok = target_can_use_hardware_watchpoint > (b->base.type, i, other_type_used); > > 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. -- Edjunior