This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
How to watch for changes in a location of memory
- From: Stefano Sabatini <stefano dot sabatini-lala at poste dot it>
- To: gdb Mailing List <gdb at sources dot redhat dot com>
- Date: Fri, 8 Aug 2008 10:10:41 +0200
- Subject: How to watch for changes in a location of memory
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.