Sven
Sven

Reputation: 7645

Remove all hardware watchpoints in Linux kernel 3.0.0

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).

Upvotes: 8

Views: 34172

Answers (2)

debug
debug

Reputation: 1079

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.

Upvotes: 15

Employed Russian
Employed Russian

Reputation: 213829

After setting the first (and only possible) hardware watchpoint via watch varname in gdb it's not possible to remove it via delete.

The statement above is false. What led you to conclude it is true?

Is there a tool or a syscall to remove this (or all) hardware watchpoint?

No such tool is necessary. Simply quit GDB, and all breakpoints and watchpoints will be gone. Or do (gdb) delete (without specifying a break point), and confirm that you want to delete all.

Upvotes: 2

Related Questions