Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: Fredrik Tolf <fredrik@dolda2000.cjb.net>
Cc: gdb@sources.redhat.com
Subject: Re: Instruction address catching
Date: Fri, 04 Oct 2002 17:52:00 -0000	[thread overview]
Message-ID: <1021005005246.ZM13581@localhost.localdomain> (raw)
In-Reply-To: Fredrik Tolf <fredrik@dolda2000.cjb.net> "Re: Instruction address catching" (Oct  5,  2:21am)

On Oct 5,  2:21am, Fredrik Tolf wrote:

> On Sat, 2002-10-05 at 02:11, Kevin Buettner wrote:
> > On Oct 5,  1:36am, Fredrik Tolf wrote:
> > 
> > > Is it possible, with the current version of gdb, to make it detect every
> > > time an address is written to, and to make it stop only if the address
> > > of the instruction that wrote to that address isn't equal to a specific
> > > value.
> > 
> > Do it like this:
> > 
> >     (gdb) watch foo
> >     Hardware watchpoint 1: foo
> >     (gdb) condition 1 $pc != 0x80484c8
> > 
> > The address to compare $pc against should be the address of the
> > instruction *after* the one that writes to ``foo''.  It's probably
> > easier to figure this out by simply setting a watchpoint on foo,
> > running 'til it's hit, and if that's not the one you're interested
> > in, add a condition so that it won't stop there again.
> > 
> > > If it's possible, does it work in a multithreaded application?
> > 
> > It should.  If it doesn't, it's a bug.
>
> Are you sure? Wouldn't the pc it compares to be that of the selected
> thread and not that of the thread that wrote?

The thread that triggers the watchpoint becomes the selected thread
for the purposes of checking the condition.  (At least, I think that's
the way it works.)  I've just tried it with a simple (threaded) example
and it seems to work as expected...

Kevin


  reply	other threads:[~2002-10-05  0:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-04 16:36 Fredrik Tolf
2002-10-04 17:11 ` Kevin Buettner
2002-10-04 17:21   ` Fredrik Tolf
2002-10-04 17:52     ` Kevin Buettner [this message]
2002-10-04 18:09       ` Fredrik Tolf
2002-10-04 18:37         ` Fredrik Tolf
2002-10-08 13:09           ` Kevin Buettner

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=1021005005246.ZM13581@localhost.localdomain \
    --to=kevinb@redhat.com \
    --cc=fredrik@dolda2000.cjb.net \
    --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