From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8773 invoked by alias); 10 Mar 2011 13:45:08 -0000 Received: (qmail 8746 invoked by uid 22791); 10 Mar 2011 13:45:07 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 10 Mar 2011 13:44:57 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p2ADiumT012545 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 10 Mar 2011 08:44:56 -0500 Received: from host1.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p2ADisZw011736 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 10 Mar 2011 08:44:55 -0500 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p2ADisVI011486; Thu, 10 Mar 2011 14:44:54 +0100 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p2ADirau011485; Thu, 10 Mar 2011 14:44:53 +0100 Date: Thu, 10 Mar 2011 13:45:00 -0000 From: Jan Kratochvil To: robert song Cc: gdb@sourceware.org Subject: Re: Why no hwatch command in gdb ? Message-ID: <20110310134453.GA11068@host1.jankratochvil.net> References: <20110310081154.GA13603@host1.jankratochvil.net> <20110310103409.GA29242@host1.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2011-03/txt/msg00075.txt.bz2 Hi Robert, On Thu, 10 Mar 2011 13:18:06 +0100, robert song wrote: > Well, I am confused with the gdb hardware watchpoint support in x86 > arch. x86* is special as its debug registers capabilities are complicated - it can watch 1/2/4/8 bytes and there are 4 of them. GDB supports aliasing, so if you watch string[0] and string[1] GDB will merge it and will watch 2 bytes at &string[0]. Upper layers GDB do not support any target-specific watchpoint tricks, so i386 pretends it can always merge them somehow - and if it latter cannot it will fail. See i386_can_use_hw_breakpoint. > I tested it in a ARM board. Now the kernel can support up to 1 > hardware watchpoint and 6 hardware breakpoints. As ARM does suppors only a single register size the aliasing does not need to be supported on ARM, therefore the hardware watchpoints count limitations works on ARM (in general, I do not know ARM). > Firstly, before the program run, we can not set the hardware breakpoint. ... > But in x86, I took a look at my CentOS 5.5 7.0.1-23.el5. > We can set the hardware breakpoint before program runs, it's not the > standard gdb function. There is a patch named > gdb-bz541866-rwatch-before-run.patch, in the patch, > target_can_use_hardware_watchpoint is forced to be 1. http://pkgs.fedoraproject.org/gitweb/?p=gdb.git;a=blob;f=gdb-bz541866-rwatch-before-run.patch;hb=f15/master FSF GDB started to disallow hardware watchpoints such as `awatch'/`rwatch' since one point. As it was considered a regression by the users I had to "temporarily" revert the upstream change and put there the older hack. The watchpoints framework needs to be improved to support this a sane way. > So the problem is because of the previous patch of this distribution > ????? I do not know on which arch which specific problem you want to solve now. Thanks, Jan