This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to watch for changes in a location of memory


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
<stefano.sabatini-lala@poste.it> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]