[PATCH 2/4] Hardware accelerated watchpoint conditions

Jan Kratochvil jan.kratochvil@redhat.com
Thu Dec 24 18:41:00 GMT 2009


> --- 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).


Regards,
Jan



More information about the Gdb-patches mailing list