Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jeff Johnston <jjohnstn@redhat.com>
To: gdb-patches@sources.redhat.com
Cc: uweigand@de.ibm.com
Subject: [RFA]: Fix for watchpoint regressions
Date: Mon, 21 Jun 2004 15:40:00 -0000	[thread overview]
Message-ID: <40D7016F.1070406@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 470 bytes --]

The attached patch fixes the recent watchpoint regressions in ia64.  Tested on 
ia64 and x86.

Ok to commit?

-- Jeff J.

2004-06-18  Jeff Johnston  <jjohnstn@redhat.com>

         * infrun.c (handle_inferior_event): Initialize stopped_by_watchpoint
         to -1.
         * breakpoint.c (bpstat_stop_status): Move check for ignoring
         untriggered watchpoints to a separate if clause.  Update function
         comment regarding STOPPED_BY_WATCHPOINT argument.

[-- Attachment #2: watchpoint-fix.patch --]
[-- Type: text/plain, Size: 3113 bytes --]

Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.174
diff -u -p -r1.174 breakpoint.c
--- breakpoint.c	7 Jun 2004 17:58:32 -0000	1.174
+++ breakpoint.c	18 Jun 2004 22:47:01 -0000
@@ -2559,8 +2559,9 @@ which its expression is valid.\n");     
 }
 
 /* Get a bpstat associated with having just stopped at address
-   BP_ADDR in thread PTID.  STOPPED_BY_WATCHPOINT is true if the
-   target thinks we stopped due to a hardware watchpoint.  */
+   BP_ADDR in thread PTID.  STOPPED_BY_WATCHPOINT is 1 if the
+   target thinks we stopped due to a hardware watchpoint, 0 if we
+   know we did not trigger a hardware watchpoint, and -1 if we do not know.  */
 
 /* Determine whether we stopped at a breakpoint, etc, or whether we
    don't understand this stop.  Result is a chain of bpstat's such that:
@@ -2593,15 +2594,10 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
     if (!breakpoint_enabled (b) && b->enable_state != bp_permanent)
       continue;
 
-    /* Hardware watchpoints are treated as non-existent if the reason we 
-       stopped wasn't a hardware watchpoint (we didn't stop on some data 
-       address).  Otherwise gdb won't stop on a break instruction in the code
-       (not from a breakpoint) when a hardware watchpoint has been defined.  */
     if (b->type != bp_watchpoint
-	&& !((b->type == bp_hardware_watchpoint
-	      || b->type == bp_read_watchpoint
-	      || b->type == bp_access_watchpoint)
-	     && stopped_by_watchpoint)
+	&& b->type != bp_hardware_watchpoint
+	&& b->type != bp_read_watchpoint
+	&& b->type != bp_access_watchpoint
 	&& b->type != bp_hardware_breakpoint
 	&& b->type != bp_catch_fork
 	&& b->type != bp_catch_vfork
@@ -2617,6 +2613,18 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
 	  continue;
       }
 
+    /* Continuable hardware watchpoints are treated as non-existent if the 
+       reason we stopped wasn't a hardware watchpoint (we didn't stop on 
+       some data address).  Otherwise gdb won't stop on a break instruction 
+       in the code (not from a breakpoint) when a hardware watchpoint has 
+       been defined.  */
+
+    if ((b->type == bp_hardware_watchpoint
+	 || b->type == bp_read_watchpoint
+	 || b->type == bp_access_watchpoint)
+	&& !stopped_by_watchpoint)
+      continue;
+
     if (b->type == bp_hardware_breakpoint)
       {
 	if (b->loc->address != bp_addr)
Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.166
diff -u -p -r1.166 infrun.c
--- infrun.c	11 Jun 2004 23:39:51 -0000	1.166
+++ infrun.c	18 Jun 2004 22:47:02 -0000
@@ -1252,7 +1252,7 @@ handle_inferior_event (struct execution_
      defined in the file "config/pa/nm-hppah.h", accesses the variable
      indirectly.  Mutter something rude about the HP merge.  */
   int sw_single_step_trap_p = 0;
-  int stopped_by_watchpoint = 0;
+  int stopped_by_watchpoint = -1;  /* Mark as unknown.  */
 
   /* Cache the last pid/waitstatus. */
   target_last_wait_ptid = ecs->ptid;

             reply	other threads:[~2004-06-21 15:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-21 15:40 Jeff Johnston [this message]
2004-06-21 19:07 ` Eli Zaretskii
2004-06-21 19:57   ` Jeff Johnston
2004-06-22  4:24     ` Eli Zaretskii
2004-06-22 19:47       ` Jeff Johnston
2004-06-21 20:18 Ulrich Weigand

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=40D7016F.1070406@redhat.com \
    --to=jjohnstn@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=uweigand@de.ibm.com \
    /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