From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25589 invoked by alias); 30 Dec 2009 16:47:42 -0000 Received: (qmail 25577 invoked by uid 22791); 30 Dec 2009 16:47:41 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL,BAYES_00,SPF_PASS 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; Wed, 30 Dec 2009 16:47:36 +0000 Received: from mailhub3.br.ibm.com (mailhub3.br.ibm.com [9.18.232.110]) by e24smtp05.br.ibm.com (8.14.3/8.13.1) with ESMTP id nBUGcK3w028629 for ; Wed, 30 Dec 2009 14:38:20 -0200 Received: from d24av01.br.ibm.com (d24av01.br.ibm.com [9.8.31.91]) by mailhub3.br.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id nBUGnW9F2298064 for ; Wed, 30 Dec 2009 14:49:32 -0200 Received: from d24av01.br.ibm.com (loopback [127.0.0.1]) by d24av01.br.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id nBUGlX2s031947 for ; Wed, 30 Dec 2009 14:47:33 -0200 Received: from hactar.localnet ([9.8.6.18]) by d24av01.br.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id nBUGlW9V031944 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 30 Dec 2009 14:47:33 -0200 From: Thiago Jung Bauermann To: gdb-patches@sourceware.org Subject: [RFA] Fix hw watchpoint count in update_watchpoint Date: Wed, 30 Dec 2009 16:47:00 -0000 User-Agent: KMail/1.12.2 (Linux/2.6.30-2-686; KDE/4.3.2; i686; ; ) MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_4P4OLgA3mVrcQPy" Message-Id: <200912301446.48771.bauerman@br.ibm.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: 2009-12/txt/msg00439.txt.bz2 --Boundary-00=_4P4OLgA3mVrcQPy Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-length: 752 Hi, update_watchpoint counts the number of existing hardware watchpoints to decide whether there is room for another one. The problem is that it miscounts the number of existing hardware watchpoints. The reason is that the given watchpoint can already be a hardware watchpoint and thus it will be counted as such by hw_watchpoint_used_count, which may make update_watchpoint decide that it should downgrade the hardware watchpoint to a software one. Ok to commit? -- []'s Thiago Jung Bauermann IBM Linux Technology Center 20090-12-30 Jan Kratochvil Thiago Jung Bauermann * breakpoint.c (update_watchpoint): Change b->type to bp_watchpoint before calling hw_watchpoint_used_count. --Boundary-00=_4P4OLgA3mVrcQPy Content-Type: text/x-patch; charset="UTF-8"; name="watchpoint-count-fix.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="watchpoint-count-fix.diff" Content-length: 675 Index: gdb.git/gdb/breakpoint.c =================================================================== --- gdb.git.orig/gdb/breakpoint.c 2009-12-28 14:00:45.000000000 -0200 +++ gdb.git/gdb/breakpoint.c 2009-12-30 12:39:12.000000000 -0200 @@ -1152,6 +1152,10 @@ update_watchpoint (struct breakpoint *b, { int i, mem_cnt, other_type_used; + /* Mark as software watchpoint to ensure that this watchpoint + will not be counted in the hw_watchpoint_used_count call + below. */ + b->type = bp_watchpoint; i = hw_watchpoint_used_count (bp_hardware_watchpoint, &other_type_used); mem_cnt = can_use_hardware_watchpoint (val_chain); --Boundary-00=_4P4OLgA3mVrcQPy--