Re: Why no hwatch command in gdb ?

Jan Kratochvil
2011-03-10T11:55:54Z

On Thu, 10 Mar 2011 12:26:41 +0100, Eli Zaretskii wrote:
> > You may have requested too many hardware breakpoints/watchpoints.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Well, you did, didn't you?

I did request _any_ watchpoint. `watch' sometimes creates hardware ones,
sometimes software ones. In fact on some arches (ppc?) it even works AFAIK.
It is GDB's fault it did not choose the right wathcpoint kind.

> If you expect GDB to know up front that they are too many, this is
> hard to impossible with today's architecture, because only when the
> watchpoints are inserted by the target, it is possible to know whether
> there are enough resources for that.

You are right the watchpoints infrastructure is very broken now. But it is
being discussed for upstream kernel that the DR registers access via
PTRACE_POKEUSER is broken anyway and GDB should use the existing hardware
watchpoints support in Linux kernel perf via some higher level interface
(still probably through the ptrace syscall).

Thanks,
Jan