From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22663 invoked by alias); 8 Aug 2008 08:38:29 -0000 Received: (qmail 22654 invoked by uid 22791); 8 Aug 2008 08:38:28 -0000 X-Spam-Check-By: sourceware.org Received: from wf-out-1314.google.com (HELO wf-out-1314.google.com) (209.85.200.170) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 08 Aug 2008 08:37:52 +0000 Received: by wf-out-1314.google.com with SMTP id 26so738436wfd.26 for ; Fri, 08 Aug 2008 01:37:50 -0700 (PDT) Received: by 10.142.222.21 with SMTP id u21mr849057wfg.67.1218184670460; Fri, 08 Aug 2008 01:37:50 -0700 (PDT) Received: by 10.142.13.10 with HTTP; Fri, 8 Aug 2008 01:37:50 -0700 (PDT) Message-ID: Date: Fri, 08 Aug 2008 08:38:00 -0000 From: "Eran Ifrah" To: "gdb Mailing List" Subject: Re: How to watch for changes in a location of memory In-Reply-To: <20080808081041.GA32701@geppetto> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20080808081041.GA32701@geppetto> 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/msg00146.txt.bz2 You might want to try the 'watch' command which will causes gdb to break whenever the memory at a given addr has been modified Read here for more details: http://sources.redhat.com/gdb/current/onlinedocs/gdb_6.html#SEC34 Eran On Fri, Aug 8, 2008 at 10:10 AM, Stefano Sabatini wrote: > Hi all, > > I would like to check a variable in memory, I don't know in which > function is modified, so I can't do a simple watch on a variable name. > > So I wonder if it is possible (gdb 6.8) to watch for a variable using > the location rather than the var name. > > I'll try to express it more clearly: for example if I have a struct: > FooCtx* ctx; > > containing a field foo, ctx is defined somewhere in the code, and may > be accessed from different contexts, for example: > > trash->junk->ctx->foo; > bar->ctx->foo; > > etc. > > How can I monitor for changes in ctx->foo simply specifying its > location in memory (&ctx->foo), is it currently possible with gdb at > all? > > Sorry if I overlooked something obvious. > > Thanks in advance, regards. > -- Eran Ifrah eran.ifrah@gmail.com