From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13688 invoked by alias); 28 Dec 2010 16:10:00 -0000 Received: (qmail 13670 invoked by uid 22791); 28 Dec 2010 16:09:58 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 28 Dec 2010 16:09:53 +0000 Received: (qmail 11885 invoked from network); 28 Dec 2010 16:09:51 -0000 Received: from unknown (HELO orlando.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 28 Dec 2010 16:09:51 -0000 From: Pedro Alves To: Joel Brobecker Subject: Re: [patch 2/3] Implement support for PowerPC BookE ranged watchpoints Date: Tue, 28 Dec 2010 16:42:00 -0000 User-Agent: KMail/1.13.5 (Linux/2.6.33-29-realtime; KDE/4.4.5; x86_64; ; ) Cc: Thiago Jung Bauermann , gdb-patches@sourceware.org, Jan Kratochvil , Eli Zaretskii References: <1290549100.3164.47.camel@hactar> <1293484743.1544.78.camel@hactar> <20101228050042.GB2596@adacore.com> In-Reply-To: <20101228050042.GB2596@adacore.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201012281609.49044.pedro@codesourcery.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: 2010-12/txt/msg00514.txt.bz2 On Tuesday 28 December 2010 05:00:42, Joel Brobecker wrote: > > +/* Return true if TYPE is scalar. */ > > + > > +int > > +is_scalar_type (struct type *type) > > +{ > > + CHECK_TYPEDEF (type); > > + > > + while (TYPE_CODE (type) == TYPE_CODE_REF) > > + { > > + type = TYPE_TARGET_TYPE (type); > > + CHECK_TYPEDEF (type); > > + } > > I suggest you make it explicit how TYPE_CODE_REF types are handled. > In certain cases, I think it might be making a difference (a REF > to a struct might have a different classification than the struct > in terms of argument passing, for instance). Yeah. For watching purposes, you want to consider the reference, or really, its underlying pointer representation as a scalar, nomatter what the reference is bound to. Let me try to clarify: int i; int &ref = i; Currently, a watchpoint on "ref" only monitors changes for the address stored in the reference-as-pointer. So, for exact-watchpoint's purposes, when considering individual pieces/locations of an expression to watch, the TYPE_CODE_REF alone is a scalar, even if its target type is a structure. I've just tried "watch ref" per above, and I'm surprised, since I thought a watchpoint on "ref" actually monitored two locations: the underlying address stored in "ref"; and its target value, similarly to watching '*ptr' in "int i; int *ptr= &i;". I think we can actually call this a bug... Contrast with valprint's purposes, where what matters is the reference's target type, what the user sees. -- Pedro Alves