From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14695 invoked by alias); 16 Oct 2013 12:32:37 -0000 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 Received: (qmail 14682 invoked by uid 89); 16 Oct 2013 12:32:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 16 Oct 2013 12:32:37 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9GCWZnB025047 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 16 Oct 2013 08:32:35 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r9GCWXc0017193; Wed, 16 Oct 2013 08:32:34 -0400 Message-ID: <525E8761.8060405@redhat.com> Date: Wed, 16 Oct 2013 12:32:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Andrew Burgess CC: "gdb-patches@sourceware.org" Subject: Re: [PATCH] hardware watchpoints turned off, inferior not yet started References: <525E5EB6.4070305@broadcom.com> In-Reply-To: <525E5EB6.4070305@broadcom.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-10/txt/msg00482.txt.bz2 On 10/16/2013 10:39 AM, Andrew Burgess wrote: > The following seems confusing to me: > > $ gdb -q watch.x > Reading symbols from /some/path/to/watch.x...done. > (gdb) set can-use-hw-watchpoints 0 > (gdb) watch -l my_var > Hardware watchpoint 1: -location my_var > (gdb) > > Notice that despite turning hardware watchpoints off > the watchpoint created is reported to be a hardware > watchpoint. Once I actually start the inferior the > watchpoint is downgraded to a software watchpoint, > but still, this feels like it might cause confusion, > and is pretty easy to fix. It seems wrong to me to create it as bp_hardware_watchpoint in the first place. That's done in watch_command_1, with: if (accessflag == hw_read) bp_type = bp_read_watchpoint; else if (accessflag == hw_access) bp_type = bp_access_watchpoint; else bp_type = bp_hardware_watchpoint; If "can-use-hw-watchpoints" is off, then I think it'd be also better to prohibit creating read and access watchpoints around here. > @@ -1800,6 +1800,8 @@ update_watchpoint (struct watchpoint *b, int reparse) > /* Without execution, memory can't change. No use to try and > set watchpoint locations. The watchpoint will be reset when > the target gains execution, through breakpoint_re_set. */ > + if (!can_use_hw_watchpoints) > + b->base.type = bp_watchpoint; > } ... this change I think makes it so that access/read watchpoints get converted to software watchpoints, which is wrong. -- Pedro Alves