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

Eli Zaretskii
2011-05-05T03:09:00Z

> From: Thiago Jung Bauermann <bauerman@br.ibm.com>
> Cc: pedro@codesourcery.com, gdb-patches@sourceware.org, uweigand@de.ibm.com
> Date: Wed, 04 May 2011 19:20:48 -0300
>
> Current scheme:
>
> 1. The inferior is stopped and all bp_locations are removed.
> 2. The user asks for a new watchpoint.
> 3. GDB evaluates the expression and creates the bp_locations.
> 4. GDB counts all existing watchpoint bp_locations and asks the target
> whether there's room for one more. Depending on the answer, decides
> for a hw or sw watch.
> 5. GDB registers the new watchpoint for insertion.
> 6. The user asks the inferior to be continued.
> 7. GDB inserts all breakpoints and watchpoints and resumes the inferior.

Yes.

> Pedro's suggestion:
>
> 1. The inferior is stopped and software bp_locations (both breakpoints
> and watchpoints) are removed. Hardware ones stay in place.
> 2. The user asks for a new watchpoint.
> 3. GDB evaluates the expression and creates the bp_locations.
> 4. GDB tries to insert the bp_locations as hw watches. If that fails,
> then converts to sw and registers the watchpoint for insertion.
> 5. The user asks the inferior to be continued.
> 6. GDB inserts sw breakpoints and watchpoints and resumes the inferior.

That's my understanding, yes.