This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] Wrong hw_watchpoint_used_count? (multiple location watchpoints)
- From: Eli Zaretskii <eliz at gnu dot org>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 08 Jan 2010 11:56:10 +0200
- Subject: Re: [RFC] Wrong hw_watchpoint_used_count? (multiple location watchpoints)
- References: <20100108075701.GE4589@adacore.com>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> Date: Fri, 8 Jan 2010 11:57:01 +0400
> From: Joel Brobecker <brobecker@adacore.com>
>
> This is mostly from code inspection, while investigating something else,
> but I think that the current implementation of hw_watchpoint_used_count
> is inaccurate. It counts the number of breakpoints which match the given
> type. But in fact, when I looked at the way the watchpoint is created,
> watchpoints may have multiple bp_locations. So, a better approximation
> would be to count the number of bp_locations, no?
>
> Even so, this does not appear to be entirely accurate either. For
> instance, if the user tries to watch an entity that does not fit
> in one watchpoint, I think we can still end up with a situation
> where we have one bp_location needing 2 h/w watchpoints.
> In the end, it looks like the only way to really clean things up
> would be to store for each watchpoint the associated number of
> needed hardware watchpoints...
But this is something only the target knows. There's no way for
breakpoint.c to know that, unless we introduce an API through which
breakpoint.c can ask the target to provide that number.
Please note, for example, that some watchpoints can actually need
*zero* bp_locations, because some other watchpoint already watches the
same address. x86 uses reference counting to not waste hardware
resources for the same address.