Friday, January 7, 2011

Setting a Processor Breakpoint in WinDbg

If you have a variable like a pointer or a ref count that seems to be getting clobbered or incorrectly accessed, the ba (break on access) command can be a life saver. Setting a break on the memory address allows you to break in with windbg, inspect the stack, or do whatever else you need to do the moment the memory is accessed.

The basic usage is:
ba address access memory_size

Ex. Tracking write access of a pointer on an AMD64 machine:
ba 0000000070540018 w8

Ex. Tracking read/write of a DWORD ref count on x86:
ba 7124220 r4

Look at the windbg documentation for info.

No comments:

Post a Comment