This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: Instruction address catching
- From: Kevin Buettner <kevinb at redhat dot com>
- To: Fredrik Tolf <fredrik at dolda2000 dot cjb dot net>, gdb at sources dot redhat dot com
- Date: Fri, 4 Oct 2002 17:11:05 -0700
- Subject: Re: Instruction address catching
- References: <1033774568.4573.2.camel@pc7>
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.
Kevin