Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Eran Ifrah" <eran.ifrah@gmail.com>
To: "gdb Mailing List" <gdb@sources.redhat.com>
Subject: Re: How to watch for changes in a location of memory
Date: Fri, 08 Aug 2008 08:38:00 -0000	[thread overview]
Message-ID: <d557d0790808080137i56dfeabai6a4ab6c1abcf7a95@mail.gmail.com> (raw)
In-Reply-To: <20080808081041.GA32701@geppetto>

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


  reply	other threads:[~2008-08-08  8:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-08  8:13 Stefano Sabatini
2008-08-08  8:38 ` Eran Ifrah [this message]
2008-08-08  9:13   ` Stefano Sabatini
2008-08-08 11:56     ` Stefano Sabatini
2008-08-08 12:42     ` Andreas Schwab
2008-08-08 12:48       ` Andreas Schwab
2008-08-09 12:03       ` Eli Zaretskii
2008-08-08 13:48         ` Eli Zaretskii
2008-08-09 12:20         ` Andreas Schwab
2008-08-09 13:49           ` Andreas Schwab
2008-08-12 14:34           ` Paul Koning
2008-08-10 21:02             ` Paul Koning

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d557d0790808080137i56dfeabai6a4ab6c1abcf7a95@mail.gmail.com \
    --to=eran.ifrah@gmail.com \
    --cc=gdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox