Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Thiago Jung Bauermann <bauerman@br.ibm.com>
To: gdb-patches@sourceware.org
Subject: [RFA] Fix hw watchpoint count in update_watchpoint
Date: Wed, 30 Dec 2009 16:47:00 -0000	[thread overview]
Message-ID: <200912301446.48771.bauerman@br.ibm.com> (raw)

[-- Attachment #1: Type: Text/Plain, Size: 752 bytes --]

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.

[-- Attachment #2: watchpoint-count-fix.diff --]
[-- Type: text/x-patch, Size: 675 bytes --]

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

             reply	other threads:[~2009-12-30 16:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-30 16:47 Thiago Jung Bauermann [this message]
2009-12-30 17:44 ` Thiago Jung Bauermann
2009-12-30 19:07 ` Joel Brobecker
2009-12-30 20:14   ` Thiago Jung Bauermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200912301446.48771.bauerman@br.ibm.com \
    --to=bauerman@br.ibm.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox