Re: Why no hwatch command in gdb ?

robert song
2011-03-10T10:09:30Z

Hi, Jan,

On 3/10/11, Jan Kratochvil <jan.kratochvil@redhat.com> wrote:
> Watchpoints are normally created by default as hardware ones. They should
> fallback to their software variants when you get out of the number of debug
> registers but that does not work well now.
>
"does not work well now" means ?

> You can request hardware vs. software watchpoints by using:
> (gdb) help set can-use-hw-watchpoints
> Set debugger's willingness to use watchpoint hardware.
> If zero, gdb will not use hardware for new watchpoints, even if
> such is available. (However, any hardware watchpoints that were
> created before setting this to nonzero, will continue to use watchpoint
> hardware.)
>
> The difference is that software breakpoints are very cheap so GDB does not
> even
> attempt to create hardware breakpoints. While software watchpoints are very
> expensive so - in fact GDB does not normally try to fallback to software
> ones.
> When you have to use software watchpoints it is commonly even not viable to
> wait for so long.

The problem is that sometimes I just want to set only hardware
watchpoints, and don't want to set software watchpoints. But the
watchpoint will be changed to software ones if hardware watchpoints
are exceeded, and if I have command like hwatch, I can avoid it.

Regards,
robert