▲ | yakshaving_jgt 5 days ago | |||||||
Is there somewhere where this approach is described in more detail? | ||||||||
▲ | jesse__ 5 days ago | parent | next [-] | |||||||
Very roughly, hardware watchpoints are memory addresses you ask the processor to issue an "event" for when they're read from, written to, or executed. This event is processed by the kernel, and passed through to the debugger, which breaks execution of the program on the instruction that issued the read/write/exec. A concrete use case for this is catching memory corruption. If your program corrupts a known piece of memory, just set a hardware watchpoint on that memory address and BOOM, the debugger breaks execution on exactly the line that's responsible for the corruption. It's a fucking godsend sometimes. | ||||||||
▲ | lock1 5 days ago | parent | prev [-] | |||||||
Search for "watchpoint debugging". Usually in most garbage-collected environments, it just observes & breaks on symbols though, not raw addresses. Vscode (or an editor with ADP support) supports unconditional breakpoints, watchpoints, and logpoints (observe & log values to the debug console). | ||||||||
|