Breaking On Access
Related Topics:
You can set an On Access breakpoint to stop program execution when the contents of a variable or memory address is either read or written. On Access is a generalized version of On Modify that can detect accesses in the stack or in system calls.
To set an On Access breakpoint:
- 1. In the Debugging Window, choose Windows
Breakpoints. Or, choose Execute
Set Breakpoints.
- 2. If the Details pane of the Breakpoints window is not displayed, click the Add/Change Breakpoint button (the Add/Change Breakpoint button toggles to Hide Details).
- 3. Choose Event
On Access. In the Event text box, type `r' 'to break on read access, 'w' to break on write access, or 'x' to break on execute memory accesses. You can type any combination of these three letters. Then type 'b' to break before the access or ''a' to break after the access. Finally, type the address you want to watch. For example:
rwa &var
wa &var + 40
Note - If you want to watch changes in a variable, be sure to include an ampersand (&) before the variable name. This is required for C and C++.
- 4. If you are using a hexadecimal address or are using the address of a variable with an unknown type, enter the size of the memory area you want to watch, preceded by a comma. For example:
rb 0x1234, 4
- 5. Choose Action
Stop.
- 6. Click Add.