Re: Watchpoints with condition

Daniel Jacobowitz
2007-11-30T16:37:54Z

On Fri, Nov 30, 2007 at 07:25:19PM +0300, Vladimir Prus wrote:
>
> GDB presently allow a watchpoint to have a condition, and I wonder
> what are the use-cases for that.
>
> If anybody has used watchpoint in condition in practice when debugging
> real problem (as opposed to just playing with gdb, or making up
> possible uses), can he share why it was needed?

I haven't, but here's a use case: if the condition is something you
couldn't set a watchpoint on or would take too many hardware resources
to watch. E.g.

set $name = "my_function"
watch global_variable if strcmp (cfun->name, $name) == 0

--
Daniel Jacobowitz
CodeSourcery