> I want to set a watchpoint on a 1MB memory range.

Signature
If this message helped you, consider buying an item
from my wish list: <http://web.meeroh.org/wishlist>
> > I want to set a watchpoint on a 1MB memory range.
>
> No, you don't. Watchpoints are slow as molasses. A watchpoint that big would
> not
> get tripped before the Sun goes nova. Sorry.
As I understand it, the current watchpoint implementation uses vm
mapping to mark blocks as read-only and then generate an exception when
the block is written to. The blocks are the standard 4k size on OSX, so
there is some hackery behind the scenes to be sure that writes to
non-relevant data in that 4k block are not responsible for the exception.
I would think that if you could set watchpoints on blocks that are
multiples of 4k in size, you wouldn't have as dramatic a performance
hit, since the exception in that case would always be a "good" one.
Or am I missing something?

Signature
Brad Oliver
bradman@pobox.com.AM_SPAY
Miro Jurisic - 24 Jul 2004 07:02 GMT
> > > I want to set a watchpoint on a 1MB memory range.
> >
[quoted text clipped - 12 lines]
>
> Or am I missing something?
I agree that's how it would work in theory, but I am not sure that the gdb
interface permits that efficient implementation of gigantic watchpoints.
meeroh

Signature
If this message helped you, consider buying an item
from my wish list: <http://web.meeroh.org/wishlist>
Mikl?s Fazekas - 25 Jul 2004 09:39 GMT
> > > > I want to set a watchpoint on a 1MB memory range.
> > >
[quoted text clipped - 15 lines]
> I agree that's how it would work in theory, but I am not sure that the gdb
> interface permits that efficient implementation of gigantic watchpoints.
You can use the vm_protect mach API, to set the 1 MB range as read-only.
vm_protect (mach_task_self(), addr, 1024*1024 , 0, VM_PROT_READ);
Then the app will crash for the first write.
Miklos