Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / CodeWarrior / July 2004



Tip: Looking for answers? Try searching our database.

Setting Watchpoint on memory range of 1 MB CW9

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kirk Haderlie - 23 Jul 2004 19:48 GMT
I want to set a watchpoint on a 1MB memory range.  Is this possible?  I
have been able to set one for a smaller range in the view memory window.  
Can a watchpoint be set by hand on an address and range?
Miro Jurisic - 23 Jul 2004 22:23 GMT
> 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.

meeroh

Signature

If this message helped you, consider buying an item
from my wish list: <http://web.meeroh.org/wishlist>

Brad Oliver - 24 Jul 2004 06:51 GMT
> > 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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.