Log in

View Full Version : Software Memory Breakpoints ??


Emerson
January 23rd, 2004, 15:24
Hi guys,

I'm trying to find the technique used to detect memory access and I've not
found much by googling. I have written code for using the dbg regs but it's
limited to 4 BPM's. Are guard pages the way to go ?? Granularity of 4k means
I'll get alot of hits with the number of vars likely to be in a 4k block, and
quite a bit of overhead I guess !!

Any help or idea's at all would be cool

Cheerz,
Emerson

comrade
January 23rd, 2004, 15:32
That's only way I think...

AndreaGeddon
January 24th, 2004, 07:58
if you need ranged breakpoints (like bpr on 9x) you can emulate them changing page protections. Page_guard could be useful, but it is turned off every time the status_guard_page is raised, so if you need a harder control you can launch the process with debug_process flag and set the type of access you want to check with VirtualProtect, and trap every fault resulting by a memory access you want to check In this way for example being a debugger you can set a bp on a little range and filter with your exception_access_violation handler the faults that occur in the same page where the range is but that you are not interested on. For example if you want a bp on range 00401000 - 00401010, due to page boundary you will be notified at every access in the page 00401000 00402000 but your handler can filter unwanted > 00401010 accesses. You could also use conditional breakpoints! You should have to set page protection at every fault notify so this is *really* slow, however it works The page_guard is too limited i think, its useful only in few cases, when you dont need a deep control of memory ranges.
Having a hardware support like in 9x would be great!
Bye!!!
AndreaGeddon