From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28482 invoked by alias); 8 Aug 2008 13:48:47 -0000 Received: (qmail 28437 invoked by uid 22791); 8 Aug 2008 13:48:46 -0000 X-Spam-Check-By: sourceware.org Received: from aussmtpmrkps320.us.dell.com (HELO aussmtpmrkps320.us.dell.com) (143.166.224.254) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 08 Aug 2008 13:48:05 +0000 X-IronPort-AV: E=Sophos;i="4.31,327,1215406800"; d="scan'208";a="368924639" Received: from unknown (HELO M31.equallogic.com) ([12.110.134.31]) by aussmtpmrkps320.us.dell.com with SMTP; 08 Aug 2008 08:48:04 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18588.20108.351032.425751@rrenna-us-nas.equallogic.com> Date: Tue, 12 Aug 2008 14:34:00 -0000 From: Paul Koning To: schwab@suse.de Cc: eliz@gnu.org, gdb@sourceware.org, gdb@sources.redhat.com Subject: Re: How to watch for changes in a location of memory References: <20080808081041.GA32701@geppetto> <20080808091156.GA8935@geppetto> X-Mailer: VM 7.17 under 21.4 (patch 19) "Constant Variable" XEmacs Lucid 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: 2008-08/txt/msg00156.txt.bz2 >>>>> "Andreas" == Andreas Schwab writes: Andreas> Eli Zaretskii writes: >>> From: Andreas Schwab Cc: gdb Mailing List >>> Date: Fri, 08 Aug 2008 13:55:47 +0200 >>> >>> Stefano Sabatini writes: >>> >>> > Thank you for the good pointer, yes indeed it seems it does >>> what I > want, which is basically: > watch &ctx->foo; >>> >>> This is equivalent to `watch ctx', since the address of ctx->foo >>> can only change if ctx changes. Watching an address of something >>> is generally not usefull. >> And "watch ctx" is also not generally useful, because most >> platforms cannot watch large structures. Andreas> In this example, ctx is a pointer (otherwise ctx->foo Andreas> wouldn't work), which is small enough on all platforms. Right. But from the original note it seems that the requester is interested in catching changes to field foo of the structure that ctx points to. The thing that confuses lots of people when they first use the "watch" command is that the intuitive meaning is "watch this address" but the actual meaning is "watch this expression". So Stefano wrote "watch &ctx->foo" but to get the effect that I believe was intended you'd want "watch ctx->foo". Similarly, to watch a specific numeric address, you have to say "watch *(T*)0x123454" as opposed to "watch 0x123454" or something like that. paul From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28138 invoked by alias); 8 Aug 2008 13:48:45 -0000 Received: (qmail 28128 invoked by uid 22791); 8 Aug 2008 13:48:44 -0000 X-Spam-Check-By: sourceware.org Received: from aussmtpmrkps320.us.dell.com (HELO aussmtpmrkps320.us.dell.com) (143.166.224.254) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 08 Aug 2008 13:48:05 +0000 X-IronPort-AV: E=Sophos;i="4.31,327,1215406800"; d="scan'208";a="368924639" Received: from unknown (HELO M31.equallogic.com) ([12.110.134.31]) by aussmtpmrkps320.us.dell.com with SMTP; 08 Aug 2008 08:48:04 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18588.20108.351032.425751@rrenna-us-nas.equallogic.com> Date: Sun, 10 Aug 2008 21:02:00 -0000 From: Paul Koning To: schwab@suse.de Cc: eliz@gnu.org, gdb@sourceware.org, gdb@sources.redhat.com Subject: Re: How to watch for changes in a location of memory References: <20080808081041.GA32701@geppetto> <20080808091156.GA8935@geppetto> X-Mailer: VM 7.17 under 21.4 (patch 19) "Constant Variable" XEmacs Lucid 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: 2008-08/txt/msg00155.txt.bz2 Message-ID: <20080810210200.NBTZn6tV-F0eFSojVk23PMBT_mOkIFKQHdS5OjTnGQM@z> >>>>> "Andreas" == Andreas Schwab writes: Andreas> Eli Zaretskii writes: >>> From: Andreas Schwab Cc: gdb Mailing List >>> Date: Fri, 08 Aug 2008 13:55:47 +0200 >>> >>> Stefano Sabatini writes: >>> >>> > Thank you for the good pointer, yes indeed it seems it does >>> what I > want, which is basically: > watch &ctx->foo; >>> >>> This is equivalent to `watch ctx', since the address of ctx->foo >>> can only change if ctx changes. Watching an address of something >>> is generally not usefull. >> And "watch ctx" is also not generally useful, because most >> platforms cannot watch large structures. Andreas> In this example, ctx is a pointer (otherwise ctx->foo Andreas> wouldn't work), which is small enough on all platforms. Right. But from the original note it seems that the requester is interested in catching changes to field foo of the structure that ctx points to. The thing that confuses lots of people when they first use the "watch" command is that the intuitive meaning is "watch this address" but the actual meaning is "watch this expression". So Stefano wrote "watch &ctx->foo" but to get the effect that I believe was intended you'd want "watch ctx->foo". Similarly, to watch a specific numeric address, you have to say "watch *(T*)0x123454" as opposed to "watch 0x123454" or something like that. paul