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: Write watchpoints


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





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