This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] Fix hw watchpoint count in update_watchpoint


Hi,

update_watchpoint counts the number of existing hardware watchpoints to decide 
whether there is room for another one. The problem is that it miscounts the 
number of existing hardware watchpoints. The reason is that the given 
watchpoint can already be a hardware watchpoint and thus it will be counted as 
such by hw_watchpoint_used_count, which may make update_watchpoint decide that 
it should downgrade the hardware watchpoint to a software one.

Ok to commit?
-- 
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center


20090-12-30  Jan Kratochvil  <jan.kratochvil@redhat.com>
	     Thiago Jung Bauermann  <bauerman@br.ibm.com>

	* breakpoint.c (update_watchpoint): Change b->type to
	bp_watchpoint before calling hw_watchpoint_used_count.
Index: gdb.git/gdb/breakpoint.c
===================================================================
--- gdb.git.orig/gdb/breakpoint.c	2009-12-28 14:00:45.000000000 -0200
+++ gdb.git/gdb/breakpoint.c	2009-12-30 12:39:12.000000000 -0200
@@ -1152,6 +1152,10 @@ update_watchpoint (struct breakpoint *b,
 	  {
 	    int i, mem_cnt, other_type_used;
 
+	    /* Mark as software watchpoint to ensure that this watchpoint
+	       will not be counted in the hw_watchpoint_used_count call
+	       below.  */
+	    b->type = bp_watchpoint;
 	    i = hw_watchpoint_used_count (bp_hardware_watchpoint,
 					  &other_type_used);
 	    mem_cnt = can_use_hardware_watchpoint (val_chain);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]