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

Pedro Alves
2011-05-05T15:27:42Z

On Thursday 05 May 2011 11:28:06, Eli Zaretskii wrote:
> > From: Pedro Alves <pedro@codesourcery.com>
> > Date: Thu, 5 May 2011 09:15:18 +0100
> > Cc: Eli Zaretskii <eliz@gnu.org>,
> > gdb-patches@sourceware.org,
> > uweigand@de.ibm.com
> >
> > On Wednesday 04 May 2011 23:20:48, Thiago Jung Bauermann wrote:
> > > 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.
> >
> > Either that or try keep hardware breakpoints and watchpoints uninserted,
> > and insert them just before 4.
>
> If you really meant "before 4", then I must say I don't understand
> what are the 2 alternative suggestions.

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.

vs

1. The inferior is stopped and all sw/hw breakpoints/watchpoints are removed,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
as currently.
2. The user asks for a new watchpoint.
3. GDB evaluates the expression and creates the bp_locations.
4. GDB inserts the hw bp_locations of already existing
hardware watchpoints/breakpoints. This shouldn't fail,
unless there's a bug, because otherwise, they wouldn't have
been created in the first place. This is a nop if
"breakpoint always-inserted" is on.
5. GDB tries to insert the new bp_locations as hw watches. If that fails,
remove any leftovers, and convert to sw.
6. If "breakpoint always-inserted" is off, remove all breakpoints.
7. The user asks the inferior to be continued.
8. GDB inserts all breakpoints/watchpoints as usualy.

--
Pedro Alves