From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19758 invoked by alias); 21 Oct 2006 15:51:32 -0000 Received: (qmail 19748 invoked by uid 22791); 21 Oct 2006 15:51:31 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Sat, 21 Oct 2006 15:51:28 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1GbJ89-0002P5-ST; Sat, 21 Oct 2006 11:51:26 -0400 Date: Sat, 21 Oct 2006 15:51:00 -0000 From: Daniel Jacobowitz To: Eli Zaretskii Cc: "Rodney M. Bates" , gdb@sourceware.org Subject: Re: breakpoint for accessing memory location Message-ID: <20061021155125.GA9177@nevyn.them.org> Mail-Followup-To: Eli Zaretskii , "Rodney M. Bates" , gdb@sourceware.org References: <4537DBC6.1030807@hccnet.nl> <20061019201214.GA32332@nevyn.them.org> <4537DEDC.5000008@hccnet.nl> <453A3758.5090602@wichita.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.13 (2006-08-11) X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-10/txt/msg00177.txt.bz2 On Sat, Oct 21, 2006 at 05:29:11PM +0200, Eli Zaretskii wrote: > > Date: Sat, 21 Oct 2006 10:06:00 -0500 > > From: "Rodney M. Bates" > > CC: gdb@sourceware.org > > > > But while this subject is open, I would like to see more explanation on just > > what the semantics of evaluating a watchpoint expression are. An expression > > always is evaluated in a particular context that can affect the legality/result, > > but in the case of a watchpoint, execution is proceeding and changing the > > context. I have never been sure what the rules are. > > For example, I sometimes want to watch p->f, where p is local variable that > > I know perfectly well will soon cease to exist, but I also know *p will > > remain. I've long since learned that watching p->f doesn't work. Instead, > > I print the address of p->f and then watch the contents of that address. > > Does "watch *(f> *)&p->f" work as well? I'm pretty sure it won't. Because "p" is still in the expression, we consider the expression dependent on the value of p, so it goes out of scope when p does. I use: p &p->f watch *$ -- Daniel Jacobowitz CodeSourcery