Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: Re: [RFC] breakpoint.c: Don't let adjust_breakpoint_address() adjust watchpoints
Date: Fri, 19 Mar 2004 00:09:00 -0000	[thread overview]
Message-ID: <20040315141800.33fb721d@saguaro> (raw)
In-Reply-To: <405614CB.7020708@gnu.org>

On Mon, 15 Mar 2004 15:40:43 -0500
Andrew Cagney <cagney@gnu.org> wrote:

> > 	* breakpoint.c (adjust_breakpoint_address): Don't adjust
> > 	breakpoint address for watchpoints or the catch eventpoints.
> > 	Add new paramter bptype.  Adjust all callers.
> 
> Is this intended?
> 
> > -#if !defined(TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT)
> > -#define TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT(BYTE_SIZE) \
> > -    ((BYTE_SIZE) <= (DEPRECATED_REGISTER_SIZE))
> > -#endif
> > -
> 

Oops!  Good catch.  That bit was not intended for this patch.  I'll
submit that separately as an obvious fix.  (Since the macro in question
is now defined in target.h.)

Here's the patch again with that bit removed...

	* breakpoint.c (adjust_breakpoint_address): Don't adjust
	breakpoint address for watchpoints or the catch eventpoints.
	Add new paramter bptype.  Adjust all callers.

Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.162
diff -u -p -r1.162 breakpoint.c
--- breakpoint.c	28 Feb 2004 16:56:12 -0000	1.162
+++ breakpoint.c	15 Mar 2004 21:12:45 -0000
@@ -99,7 +99,8 @@ static void check_duplicates (struct bre
 
 static void breakpoint_adjustment_warning (CORE_ADDR, CORE_ADDR, int, int);
 
-static CORE_ADDR adjust_breakpoint_address (CORE_ADDR bpaddr);
+static CORE_ADDR adjust_breakpoint_address (CORE_ADDR bpaddr,
+                                            enum bptype bptype);
 
 static void describe_other_breakpoints (CORE_ADDR, asection *);
 
@@ -3947,13 +3948,25 @@ breakpoint_adjustment_warning (CORE_ADDR
    this function is simply the identity function.  */
 
 static CORE_ADDR
-adjust_breakpoint_address (CORE_ADDR bpaddr)
+adjust_breakpoint_address (CORE_ADDR bpaddr, enum bptype bptype)
 {
   if (!gdbarch_adjust_breakpoint_address_p (current_gdbarch))
     {
       /* Very few targets need any kind of breakpoint adjustment.  */
       return bpaddr;
     }
+  else if (bptype == bp_watchpoint
+           || bptype == bp_hardware_watchpoint
+           || bptype == bp_read_watchpoint
+           || bptype == bp_access_watchpoint
+           || bptype == bp_catch_fork
+           || bptype == bp_catch_vfork
+           || bptype == bp_catch_exec)
+    {
+      /* Watchpoints and the various bp_catch_* eventpoints should not
+         have their addresses modified.  */
+      return bpaddr;
+    }
   else
     {
       CORE_ADDR adjusted_bpaddr;
@@ -4062,7 +4075,8 @@ set_raw_breakpoint (struct symtab_and_li
   memset (b, 0, sizeof (*b));
   b->loc = allocate_bp_location (b, bptype);
   b->loc->requested_address = sal.pc;
-  b->loc->address = adjust_breakpoint_address (b->loc->requested_address);
+  b->loc->address = adjust_breakpoint_address (b->loc->requested_address,
+                                               bptype);
   if (sal.symtab == NULL)
     b->source_file = NULL;
   else
@@ -4622,7 +4636,8 @@ set_longjmp_resume_breakpoint (CORE_ADDR
     if (b->type == bp_longjmp_resume)
     {
       b->loc->requested_address = pc;
-      b->loc->address = adjust_breakpoint_address (b->loc->requested_address);
+      b->loc->address = adjust_breakpoint_address (b->loc->requested_address,
+                                                   b->type);
       b->enable_state = bp_enabled;
       b->frame_id = frame_id;
       check_duplicates (b);
@@ -5879,7 +5894,8 @@ watch_command_1 (char *arg, int accessfl
 	  scope_breakpoint->loc->requested_address
 	    = get_frame_pc (prev_frame);
 	  scope_breakpoint->loc->address
-	    = adjust_breakpoint_address (scope_breakpoint->loc->requested_address);
+	    = adjust_breakpoint_address (scope_breakpoint->loc->requested_address,
+	                                 scope_breakpoint->type);
 
 	  /* The scope breakpoint is related to the watchpoint.  We
 	     will need to act on them together.  */
@@ -7190,7 +7206,8 @@ breakpoint_re_set_one (void *bint)
 	      b->line_number = sals.sals[i].line;
 	      b->loc->requested_address = sals.sals[i].pc;
 	      b->loc->address
-	        = adjust_breakpoint_address (b->loc->requested_address);
+	        = adjust_breakpoint_address (b->loc->requested_address,
+		                             b->type);
 
 	      /* Used to check for duplicates here, but that can
 	         cause trouble, as it doesn't check for disabled


WARNING: multiple messages have this Message-ID
From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: Re: [RFC] breakpoint.c: Don't let adjust_breakpoint_address() adjust watchpoints
Date: Mon, 15 Mar 2004 21:18:00 -0000	[thread overview]
Message-ID: <20040315141800.33fb721d@saguaro> (raw)
Message-ID: <20040315211800.FR6cQ8k_0or7kv3ghDHCH81UFzE9YpbRdCq9pZtJxgU@z> (raw)
In-Reply-To: <405614CB.7020708@gnu.org>

On Mon, 15 Mar 2004 15:40:43 -0500
Andrew Cagney <cagney@gnu.org> wrote:

> > 	* breakpoint.c (adjust_breakpoint_address): Don't adjust
> > 	breakpoint address for watchpoints or the catch eventpoints.
> > 	Add new paramter bptype.  Adjust all callers.
> 
> Is this intended?
> 
> > -#if !defined(TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT)
> > -#define TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT(BYTE_SIZE) \
> > -    ((BYTE_SIZE) <= (DEPRECATED_REGISTER_SIZE))
> > -#endif
> > -
> 

Oops!  Good catch.  That bit was not intended for this patch.  I'll
submit that separately as an obvious fix.  (Since the macro in question
is now defined in target.h.)

Here's the patch again with that bit removed...

	* breakpoint.c (adjust_breakpoint_address): Don't adjust
	breakpoint address for watchpoints or the catch eventpoints.
	Add new paramter bptype.  Adjust all callers.

Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.162
diff -u -p -r1.162 breakpoint.c
--- breakpoint.c	28 Feb 2004 16:56:12 -0000	1.162
+++ breakpoint.c	15 Mar 2004 21:12:45 -0000
@@ -99,7 +99,8 @@ static void check_duplicates (struct bre
 
 static void breakpoint_adjustment_warning (CORE_ADDR, CORE_ADDR, int, int);
 
-static CORE_ADDR adjust_breakpoint_address (CORE_ADDR bpaddr);
+static CORE_ADDR adjust_breakpoint_address (CORE_ADDR bpaddr,
+                                            enum bptype bptype);
 
 static void describe_other_breakpoints (CORE_ADDR, asection *);
 
@@ -3947,13 +3948,25 @@ breakpoint_adjustment_warning (CORE_ADDR
    this function is simply the identity function.  */
 
 static CORE_ADDR
-adjust_breakpoint_address (CORE_ADDR bpaddr)
+adjust_breakpoint_address (CORE_ADDR bpaddr, enum bptype bptype)
 {
   if (!gdbarch_adjust_breakpoint_address_p (current_gdbarch))
     {
       /* Very few targets need any kind of breakpoint adjustment.  */
       return bpaddr;
     }
+  else if (bptype == bp_watchpoint
+           || bptype == bp_hardware_watchpoint
+           || bptype == bp_read_watchpoint
+           || bptype == bp_access_watchpoint
+           || bptype == bp_catch_fork
+           || bptype == bp_catch_vfork
+           || bptype == bp_catch_exec)
+    {
+      /* Watchpoints and the various bp_catch_* eventpoints should not
+         have their addresses modified.  */
+      return bpaddr;
+    }
   else
     {
       CORE_ADDR adjusted_bpaddr;
@@ -4062,7 +4075,8 @@ set_raw_breakpoint (struct symtab_and_li
   memset (b, 0, sizeof (*b));
   b->loc = allocate_bp_location (b, bptype);
   b->loc->requested_address = sal.pc;
-  b->loc->address = adjust_breakpoint_address (b->loc->requested_address);
+  b->loc->address = adjust_breakpoint_address (b->loc->requested_address,
+                                               bptype);
   if (sal.symtab == NULL)
     b->source_file = NULL;
   else
@@ -4622,7 +4636,8 @@ set_longjmp_resume_breakpoint (CORE_ADDR
     if (b->type == bp_longjmp_resume)
     {
       b->loc->requested_address = pc;
-      b->loc->address = adjust_breakpoint_address (b->loc->requested_address);
+      b->loc->address = adjust_breakpoint_address (b->loc->requested_address,
+                                                   b->type);
       b->enable_state = bp_enabled;
       b->frame_id = frame_id;
       check_duplicates (b);
@@ -5879,7 +5894,8 @@ watch_command_1 (char *arg, int accessfl
 	  scope_breakpoint->loc->requested_address
 	    = get_frame_pc (prev_frame);
 	  scope_breakpoint->loc->address
-	    = adjust_breakpoint_address (scope_breakpoint->loc->requested_address);
+	    = adjust_breakpoint_address (scope_breakpoint->loc->requested_address,
+	                                 scope_breakpoint->type);
 
 	  /* The scope breakpoint is related to the watchpoint.  We
 	     will need to act on them together.  */
@@ -7190,7 +7206,8 @@ breakpoint_re_set_one (void *bint)
 	      b->line_number = sals.sals[i].line;
 	      b->loc->requested_address = sals.sals[i].pc;
 	      b->loc->address
-	        = adjust_breakpoint_address (b->loc->requested_address);
+	        = adjust_breakpoint_address (b->loc->requested_address,
+		                             b->type);
 
 	      /* Used to check for duplicates here, but that can
 	         cause trouble, as it doesn't check for disabled


  parent reply	other threads:[~2004-03-15 21:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-15 20:30 Kevin Buettner
2004-03-15 21:08 ` Eli Zaretskii
2004-03-15 21:35   ` Kevin Buettner
2004-03-19  0:09     ` Kevin Buettner
2004-03-19  0:09     ` Eli Zaretskii
2004-03-16 19:32       ` Eli Zaretskii
2004-03-19  0:09   ` Eli Zaretskii
2004-03-19  0:09 ` Andrew Cagney
2004-03-15 20:40   ` Andrew Cagney
2004-03-19  0:09   ` Kevin Buettner [this message]
2004-03-15 21:18     ` Kevin Buettner
2004-03-19 20:50     ` Kevin Buettner
2004-03-19  0:09 ` Kevin Buettner

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=20040315141800.33fb721d@saguaro \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sources.redhat.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