[PATCH 2/4] Hardware accelerated watchpoint conditions

Thiago Jung Bauermann bauerman@br.ibm.com
Wed Dec 30 03:23:00 GMT 2009


On Thu 24 Dec 2009 16:40:56 Jan Kratochvil wrote:
> > --- gdb.orig/gdb/breakpoint.c	2009-12-23 15:14:03.000000000 -0200
> > +++ gdb/gdb/breakpoint.c	2009-12-23 17:07:34.000000000 -0200
> > @@ -1151,6 +1151,13 @@ update_watchpoint (struct breakpoint *b,
> > +	    enum enable_state e;
> > +
> > +	    /* We have to temporary disable this watchpoint, otherwise
> > +	       we will count it twice (once as being inserted, and once
> > +	       as a watchpoint that we want to insert).  */
> > +	    e = b->enable_state;
> > +	    b->enable_state = bp_disabled;
> >
> >  	    i = hw_watchpoint_used_count (bp_hardware_watchpoint,
> >  					  &other_type_used);
> > @@ -1167,6 +1174,8 @@ update_watchpoint (struct breakpoint *b,
> >  		else
> >  		  b->type = bp_hardware_watchpoint;
> >  	      }
> > +	    /* Restoring the original state.  */
> > +	    b->enable_state = e;
> >  	  }
> >
> >        frame_pspace = get_frame_program_space (get_selected_frame
> > (NULL));
> 
> Isn't it enough to just reset it before calling hw_watchpoint_used_count
>  by: b->type = bp_watchpoint;
> 
> (It is safer wrt hypothetical error() in the meantime.)
> 
> Had such local patch for ppc (this is a code by me but it was a regression,
>  it was broken before and my fix was just incomplete).

Indeed, that worked too and looks cleaner. I'll post this fix as a separate 
patch, since it is a bug that affects GDB's counting of hardware watchpoint 
resources regardless of the features we are introducing here.

Thanks!
-- 
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center



More information about the Gdb-patches mailing list