After setting the first (and only possible) hardware watchpoint via watch varname
in GDB, it's not possible to remove it via delete.
Even if I just exit GDB, this watchpoint seems to be enabled till the next reboot. When I try to set another hardware watchpoint after GDB is restarted, a kernel message appears in logs telling me, all hardware watchpoints are already taken. It seems like it's the same problem as in Setting GDB hardware watchpoint/how to set software watchpoint, but because I need a hardware watchpoint, the solution does not apply.
Is there a tool or a syscall to remove this (or all) hardware watchpoint? The CPU is an Core i5 and the Linux kernel is 3.0.0-17-generic from Ubuntu 11.10 (Oneiric Ocelot).
Use watchpoints (sometimes called data breakpoints). It can handle it as normal breakpoints, as follows:
(gdb) info watchpoints
Num Type Disp Enb Address What
2 acc watchpoint keep y x
(gdb) delete 2
(gdb) info watchpoints
No watchpoints.
(gdb)
A good reference is Setting Watchpoints.