Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you want to badly enough, you can use the debug API to set a breakpoint on your own data, which will be triggered on a write, just like the VS API does.</p> <p>The basics of this are to start a thread to do the "debugging". It will: </p> <ol> <li>temporarily stop the primary thread.</li> <li>Get that thread's registers with GetThreadContext</li> <li>set the address to break on in one of DR0 through DR 3.</li> <li>Set the size of the data in question in DR 6.</li> <li>Set the type of breakpoint (data write, in this case) in DR 7.</li> <li>Use SetThreadContext to tell the primary thread to use the modified registers.</li> <li>Restart execution of the primary thread.</li> </ol> <p>That's going from memory, so although I believe it's pretty close to the basic idea, I may have gotten a detail or two wrong, or (more likely) left out a few steps.</p> <p>In most cases, it's going to be easier to do something at the source level, where you overload <code>operator=</code> for the target in question, so you get some code executed during assignment to the data. Then in that operator you can (for example) set an Event that code in another thread waits on (and reacts appropriately).</p> <p>Another possibility (especially if you want to break on any access to a whole range of addresses) is to use <code>VirtualProtect</code> to force an exception on any access to that block of memory. Like a debug exception, this will be triggered synchronously, so if you want asynchronous execution you'll have to accomplish it by setting an Event (or whatever) and having another thread waiting on that so it'll execute when the Event is set.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload