>
>
>> Then how do they implement memory watch?
>>
>
> Got me, but even the ancient, in-tree gdb is able to do so.  Have you
> consulted the gdb source?
>

I read gdb sources and found an asnwer,  but later I read docs and here it
is:
https://sourceware.org/gdb/onlinedocs/gdb/Set-Watchpoints.html

"Depending on your system, watchpoints may be implemented in software or
hardware.
GDB does software watchpointing by single-stepping your program and testing
the variable’s value each time,
which is hundreds of times slower than normal execution. "

For bsd, configure script checks GETDBREGS in ptrace.h. It exists in
freebsd but not in openbsd.
Then, "target_can_use_hardware_watchpoint" returns 0, and
"breakpoint.c" checks it, and switches to software watchpoints.
Same happens when debug registers are full even on linux, I assume.

Reply via email to