I can set a DWORD
memory read/write access breakpoint in WinDbg with the following command:
ba r 4 0x0307F42C
But is there a way to set more than 4 of those?
Those are called hardware breakpoints and are related to debug registers in the CPU. There are usually 6 of them but only DR0-DR3 used to specify an address for hardware breakpoints.
Although windbg does not support memory breakpoints, memory breakpoints are another common approach to place breakpoints based on memory access instead of code execution.
Although most debuggers implement that internally, memory breakpoints work by setting the PAGE_GUARD
bit for all pages in the memory breakpoint address range, and then filtering any exceptions caught for the specific ranges within the pages, and then resetting the page guard.
You can do something similar by placing a page guard yourself using windbg, however that's a lot of effort.
It is important to note that memory breakpoints are detectable with little effort and may dramatically slow execution (even further down than debugging), when debugging a piece of software with anti-debugging protection make sure you pay attention.
ba
is a processor breakpoint (hardware breakpoints). usebp
instead. For more breakpoints in radare2, read here.bp
correctly. Say, I have a DWORD in memory that I want to track. I callbp 03DBF450
. I then dobl
and receive1 e 03dbf450 0001 (0001) 0:****
but then if I run the debuggee I get an exception from IDA pro:779A2228: The instruction at 0x779A2228 referenced memory at 0x14. The memory could not be written -> 00000014 (exc.code c0000005, tid 5928)
and the debuggee crashes. This doesn't happen if I don't usebp
command.