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... I thought about making the following change. It's not clear that it is a step in the right direction or not. Pragmatically, I think it gives more accurate results. In terms of implementation, if we eventually decide to store the mem_cnt in the breakpoint, then we'll have to go back to iterating over all breakpoints (not bp_locations)... When in doubt, do nothing? * breakpoint.c (hw_watchpoint_used_count): Compute the number of hardware watchpoints by iterating over all bp_locations instead of all breakpoints. Tested on x86_64-linux. No regression... -- Joel