Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Write watchpoints
@ 2008-03-06  7:09 Guillaume MENANT
  2008-03-06  9:24 ` Vladimir Prus
  2008-03-06 20:24 ` Jie Zhang
  0 siblings, 2 replies; 6+ messages in thread
From: Guillaume MENANT @ 2008-03-06  7:09 UTC (permalink / raw)
  To: gdb


Hello,

I'm currently working with a modified version of GDB (sparc-elf-gdb
delivered by Gaisler). I'm creating a software which makes the link between
this GDB and an Sparc evaluation board. I'm also working with Eclipse (my
toolchain is : Eclipse <-> sparc-elf-gdb <-> My software <-> Evaluation
board.

I'm trying to implement watchpoints management in my software but it doesn't
works. For a write watchpoint at 0x800000A4,  GDB sets it (Z2) and then the
watchpoint triggers on my board (just before executing the asm instruction
which modifies the 0x800000A4 address), so I send back the answer
T05watch800000A4 to GDB before effectively writing to the 0x800000A4
address. Then GDB reads the system registers (G), reads at the 0x800000A4
address, unsets the watchpoint, reads at the 0x800000A4 address, re-sets the
watchpoint (at the same address) and make a continue. Then the watchpoint
triggers again immediately  because the instruction modifying the 0x800000A4
address has not been executed before.

What is the problem with this GDB flow ? What can I do ?

Thanks.
-- 
View this message in context: http://www.nabble.com/Write-watchpoints-tp15867705p15867705.html
Sent from the Sourceware - gdb list mailing list archive at Nabble.com.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Write watchpoints
  2008-03-06  7:09 Write watchpoints Guillaume MENANT
@ 2008-03-06  9:24 ` Vladimir Prus
  2008-03-06 16:19   ` Daniel Jacobowitz
  2008-03-06 20:24 ` Jie Zhang
  1 sibling, 1 reply; 6+ messages in thread
From: Vladimir Prus @ 2008-03-06  9:24 UTC (permalink / raw)
  To: gdb

Guillaume MENANT wrote:

> 
> Hello,
> 
> I'm currently working with a modified version of GDB (sparc-elf-gdb
> delivered by Gaisler). I'm creating a software which makes the link between
> this GDB and an Sparc evaluation board. I'm also working with Eclipse (my
> toolchain is : Eclipse <-> sparc-elf-gdb <-> My software <-> Evaluation
> board.
> 
> I'm trying to implement watchpoints management in my software but it doesn't
> works. For a write watchpoint at 0x800000A4,  GDB sets it (Z2) and then the
> watchpoint triggers on my board (just before executing the asm instruction
> which modifies the 0x800000A4 address), so I send back the answer
> T05watch800000A4 to GDB before effectively writing to the 0x800000A4
> address. 
[...]
> Then the watchpoint
> triggers again immediately  because the instruction modifying the 0x800000A4
> address has not been executed before.

So, 
1. Does the board stop at the instruction that accessed the memory, or at
the next instruction?
2. What does "effectively writing to the 0x800000A4 address" mean? It sounds like
both the write to memory happens, and that instruction is not executed, which
I cannot understand.

If your target actually stops at the instruction accessing memory,
before the write happens, then you need to tell GDB to step over
the instruction. There are two mechanisms in current GDB, as far as I can tell:

1. HAVE_STEPPABLE_WATCHPOINT tells that you can just single-step over the
watchpoint, while it's set, and it won't fire during single-stepping.
The macro basically looks at to_have_steppable_watchpoint field in target.
2. gdbarch_have_nonsteppable_watchpoint tells that we have to single-step
over watchpoint, while it's disabled. 

It appears that you need to arrange for exactly one of those to return true.

- Volodya





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Write watchpoints
  2008-03-06  9:24 ` Vladimir Prus
@ 2008-03-06 16:19   ` Daniel Jacobowitz
  2008-03-06 16:45     ` Vladimir Prus
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2008-03-06 16:19 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: gdb

On Thu, Mar 06, 2008 at 11:00:40AM +0300, Vladimir Prus wrote:
> 1. HAVE_STEPPABLE_WATCHPOINT tells that you can just single-step over the
> watchpoint, while it's set, and it won't fire during single-stepping.
> The macro basically looks at to_have_steppable_watchpoint field in target.
> 2. gdbarch_have_nonsteppable_watchpoint tells that we have to single-step
> over watchpoint, while it's disabled. 
> 
> It appears that you need to arrange for exactly one of those to return true.

Yes, this sounds like a nonsteppable watchpoint.  The default, if
neither of those is set, is for continuable watchpoints - ones we can
continue through once they've been hit.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Write watchpoints
  2008-03-06 16:19   ` Daniel Jacobowitz
@ 2008-03-06 16:45     ` Vladimir Prus
  2008-03-06 16:52       ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Vladimir Prus @ 2008-03-06 16:45 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb

On Thursday 06 March 2008 16:13:25 Daniel Jacobowitz wrote:
> On Thu, Mar 06, 2008 at 11:00:40AM +0300, Vladimir Prus wrote:
> > 1. HAVE_STEPPABLE_WATCHPOINT tells that you can just single-step over the
> > watchpoint, while it's set, and it won't fire during single-stepping.
> > The macro basically looks at to_have_steppable_watchpoint field in target.
> > 2. gdbarch_have_nonsteppable_watchpoint tells that we have to single-step
> > over watchpoint, while it's disabled. 
> > 
> > It appears that you need to arrange for exactly one of those to return true.
> 
> Yes, this sounds like a nonsteppable watchpoint.  The default, if
> neither of those is set, is for continuable watchpoints - ones we can
> continue through once they've been hit.

I noticed that HAVE_CONTINUABLE_WATCHPOINT macro has some definitions,
but is never checked. Should we kill it?

- Volodya

 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Write watchpoints
  2008-03-06 16:45     ` Vladimir Prus
@ 2008-03-06 16:52       ` Daniel Jacobowitz
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2008-03-06 16:52 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: gdb

On Thu, Mar 06, 2008 at 07:45:20PM +0300, Vladimir Prus wrote:
> I noticed that HAVE_CONTINUABLE_WATCHPOINT macro has some definitions,
> but is never checked. Should we kill it?

Yes, probably.  I thought I'd cleaned that up; if I had a reason to
leave the definitions, I've forgotten what it was.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Write watchpoints
  2008-03-06  7:09 Write watchpoints Guillaume MENANT
  2008-03-06  9:24 ` Vladimir Prus
@ 2008-03-06 20:24 ` Jie Zhang
  1 sibling, 0 replies; 6+ messages in thread
From: Jie Zhang @ 2008-03-06 20:24 UTC (permalink / raw)
  To: Guillaume MENANT; +Cc: gdb

Guillaume MENANT wrote:
> I'm trying to implement watchpoints management in my software but it doesn't
> works. For a write watchpoint at 0x800000A4,  GDB sets it (Z2) and then the
> watchpoint triggers on my board (just before executing the asm instruction
> which modifies the 0x800000A4 address), so I send back the answer
> T05watch800000A4 to GDB before effectively writing to the 0x800000A4
> address. Then GDB reads the system registers (G), reads at the 0x800000A4
> address, unsets the watchpoint, reads at the 0x800000A4 address, re-sets the
> watchpoint (at the same address) and make a continue. Then the watchpoint
> triggers again immediately  because the instruction modifying the 0x800000A4
> address has not been executed before.
> 
> What is the problem with this GDB flow ? What can I do ?
> 
It seems that gdb expects the address of the next instruction to
watchpoint when watchpoint is triggered. Blackfin is similar to your
target: the watchpoint is triggered just when the address appears on the
address bus and before the write happens. We just do a single step and
send the address of the next instruction of the one which triggers the 
watchpoint to gdb.


Jie




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-03-06 19:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-06  7:09 Write watchpoints Guillaume MENANT
2008-03-06  9:24 ` Vladimir Prus
2008-03-06 16:19   ` Daniel Jacobowitz
2008-03-06 16:45     ` Vladimir Prus
2008-03-06 16:52       ` Daniel Jacobowitz
2008-03-06 20:24 ` Jie Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox