Re: Why no hwatch command in gdb ?

Philippe Waroquiers
2011-03-10T14:47:19Z

On the side of 'hardware' watchpoints limitations:
I am busy embedding a gdbserver inside Valgrind (target is
to integrate it in April, but more review activity is still needed).

As part of this work, unlimited "simulated hardware watchpoints"
have been implemented on top of the "address access/validity bits"
of Valgrind memcheck tool.

These simulated hardware watchpoints are of course a lot
slower than real hardware watchpoint, but they are faster
than gdb "single stepping" watchpoints (and more over,
you have unlimited "read watchpoints").

I only encountered a small problem with gdb "remote":
There is a gdb command to configure the nr of remote hardware watchpoint
but there is no command to configure the length for an hardware
watchpoint: e.g. for i386, gdb remote "hardcodes" the length to 4 bytes
(which looks wrong btw, as the real hw can go up to 8 bytes I believe).

So, I have in a corner a patch implementing
'set remote hardware-watchpoint-length-limit'
to configure the max length limit of an hw watchpoint.

With this patch + Valgrind gdbserver, you can e.g. read or write or access
watch many and/or big memory ranges, paying "only" the "limited"
Valgrind memcheck overhead (still big overhead, but significantly
faster than pure gdb software watchpoint).

I believe it would be nice to add this new command in gdb.

If you want more info about the gdbserver in Valgrind, I can give more
(I expect to output a new improved beta version of the Valgrind gdbserver
patch in the coming days).

Philippe