Re: [RFA 2/3] Demote to sw watchpoint only in update_watchpoint

Ulrich Weigand
2011-05-05T11:04:42Z

Thiago Jung Bauermann wrote:

> On the other hand, the current code is already broken in that regard,
> and creating several read and access watchpoints on today's GDB will
> confuse it and allow creating more hardware watchpoints (read, access or
> regular) than possible. Thus, this patch doesn't make the situation any
> worse. So now I just use b->type.
>
> The real fix IMHO would be to make the -tdep code manage the creation
> and deletion of bp_locations, so that it could always make an informed
> decision about what can and cannot be done with the available hardware
> debug resources. But that's out of the scope of this patch series.

Yes, I'd agree with Eli and Pedro that this really ought to be fixed.
I also agree that this is independent of this patch (and in fact I'd
consider the patch a (small) step in the right direction anyway,
since it reduced the number of locations in the code where resource
accounting is done) ...

> 2011-05-03 Thiago Jung Bauermann <bauerman@br.ibm.com>
>
> * breakpoint.c (update_watchpoint): Change between software and
> hardware watchpoint for all kinds of watchpoints, not just
> read/write ones. Determine b->exact value here instead of
> in watch_command_1. Error out if there are not enough resources
> for a read or access hardware watchpoint.
> (watch_command_1): Remove logic of checking whether there are
> enough resources available, since update_watchpoint will do that
> work now. Don't set b->exact here. Catch exceptions thrown by
> update_watchpoint and delete the watchpoint.
> (can_use_hardware_watchpoint): Remove exact_watchpoints argument.
> Use target_exact_watchpoints instead.
> (delete_breakpoint): Notify observers only if deleted watchpoint
> has a breakpoint number assigned to it.

As Eli has withdrawn objections to the patch, this is OK.

Thanks,
Ulrich

--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com