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]

Save the length of inserted breakpoints


This nasty, mechanical patch adds "len" arguments to
target_remove_breakpoint and target_remove_hw_breakpoint.  The goal is
to allow BREAKPOINT_FROM_PC to include heuristics, which may possibly
change between when a breakpoint is inserted and when it is removed;
in order to stay in sync, we need to always remove breakpoints in the
same way that we inserted them.

There's not much more to say about this patch.  It's big, obvious, and
pretty ugly.  Any comments on this?  Does it look OK?

Tested on x86_64-pc-linux-gnu, and by hand on an ARM target with
the use-CPSR patch.

-- 
Daniel Jacobowitz
CodeSourcery

2006-03-02  Daniel Jacobowitz  <dan@codesourcery.com>

	* breakpoint.c (insert_bp_location): Set placed_address and
	placed_size.
	(delete_breakpoint): Likewise.
	(remove_breakpoint): Use placed_address and placed_size.
	* breakpoint.h (struct bp_location): Add placed_address and
	placed_size.
	* gdbarch.sh (memory_remove_breakpoint): Add len argument.
	* mem-break.c (default_memory_remove_breakpoint): Add LEN argument.
	Don't use BREAKPOINT_FROM_PC.
	(memory_remove_breakpoint): Add len argument.
	* target.c (update_current_target): Update prototype.
	(debug_to_remove_breakpoint): Add len argument.
	(debug_to_remove_hw_breakpoint): Likewise.
	* target.h (struct target_ops): Add len argument to
	to_remove_breakpoint and to_remove_hw_breakpoint.
	(target_remove_breakpoint, target_remove_hw_breakpoint)
	(memory_remove_breakpoint, default_memory_remove_breakpoint): Add
	len argument.
	* wince.c (struct thread_info_struct): Add bp_pc and bp_len.
	(undoSStep): Use them.
	(wince_software_single_step): Set them.
	* config/i386/nm-i386.h (i386_remove_hw_breakpoint): Add len
	argument.
	(target_remove_hw_breakpoint): Likewise.

	* gdbarch.c, gdbarch.h: Regenerated.

	* alpha-tdep.c (alpha_software_single_step): Save breakpoint
	size for use when removing the breakpoint.
	* arm-tdep.c (arm_software_single_step): Likewise.  Add a note.
	* cris-tdep.c (cris_software_single_step): Likewise.
	* mips-tdep.c (mips_software_single_step): Likewise.
	* rs6000-nat.c (exec_one_dummy_insn): Likewise.
	* rs6000-tdep.c (rs6000_software_single_step): Likewise.
	* sparc-tdep.c (sparc_software_single_step):

	* corelow.c (ignore_remove): New.
	(init_core_ops): Use it.
	* exec.c (ignore_remove): New.
	(init_exec_ops): Use it.
	* sol-thread.c (ignore_remove): New.
	(init_sol_core_ops): Use it.
	* procfs.c (dbx_link_bpt_size): New.
	(remove_dbx_link_breakpoint): Use it.
	(insert_dbx_link_bpt_in_file): Set it.
	* solib-irix.c (breakpoint_len): New.
	(disable_break): Use it.
	(enable_break): Set it.

	* i386-nat.c (i386_remove_hw_breakpoint): Add len argument.
	* ia64-tdep.c (ia64_memory_remove_breakpoint): Likewise.
	* m32r-tdep.c (m32r_memory_remove_breakpoint): Likewise.
	* monitor.c (monitor_remove_breakpoint): Likewise.
	* nto-procfs.c (procfs_remove_breakpoint): Likewise.
	(procfs_remove_hw_breakpoint): Likewise.
	* ocd.c (ocd_remove_breakpoint): Likewise.
	* ocd.h (ocd_remove_breakpoint): Likewise.
	* ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint): Likewise.
	Don't use BREAKPOINT_FROM_PC.
	* ppc-tdep.h (ppc_linux_memory_remove_breakpoint): Likewise.
	* remote-e7000.c (e7000_remove_breakpoint): Likewise.
	* remote-m32r-sdi.c (m32r_remove_breakpoint): Likewise.
	* remote-mips.c (mips_remove_breakpoint): Likewise.
	* remote-rdp.c (remote_rdp_remove_breakpoint): Likewise.
	(rdp_step): Update.
	* remote-sds.c (sds_remove_breakpoint): Likewise.
	* remote-sim.c (gdbsim_remove_breakpoint): Likewise.
	* remote-st.c (st2000_remove_breakpoint): Likewise.
	* remote.c (remote_remove_breakpoint): Likewise.
	(remote_remove_hw_breakpoint): Likewise.  Don't use
	BREAKPOINT_FROM_PC.

2006-03-02  Daniel Jacobowitz  <dan@codesourcery.com>

	* gdbint.texinfo (Watchpoints, Target Conditionals): Update remove
	breakpoint prototypes.

Index: alpha-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/alpha-tdep.c,v
retrieving revision 1.153
diff -u -p -r1.153 alpha-tdep.c
--- alpha-tdep.c	15 Jan 2006 20:53:32 -0000	1.153
+++ alpha-tdep.c	2 Mar 2006 20:40:50 -0000
@@ -1496,17 +1496,21 @@ alpha_software_single_step (enum target_
   typedef char binsn_quantum[BREAKPOINT_MAX];
   static binsn_quantum break_mem;
   CORE_ADDR pc;
+  static CORE_ADDR bp_pc;
+  static int bp_size;
 
   if (insert_breakpoints_p)
     {
       pc = read_pc ();
       next_pc = alpha_next_pc (pc);
 
+      bp_pc = next_pc;
+      BREAKPOINT_FROM_PC (&bp_pc, &bp_size);
       target_insert_breakpoint (next_pc, break_mem);
     }
   else
     {
-      target_remove_breakpoint (next_pc, break_mem);
+      target_remove_breakpoint (bp_pc, bp_size, break_mem);
       write_pc (next_pc);
     }
 }
Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.205
diff -u -p -r1.205 arm-tdep.c
--- arm-tdep.c	15 Feb 2006 17:36:11 -0000	1.205
+++ arm-tdep.c	2 Mar 2006 20:40:51 -0000
@@ -1845,14 +1845,22 @@ arm_software_single_step (enum target_si
 {
   static int next_pc;		 /* State between setting and unsetting.  */
   static char break_mem[BREAKPOINT_MAX]; /* Temporary storage for mem@bpt */
+  static CORE_ADDR bp_pc;
+  static int bp_size;
+
+  /* NOTE: This may insert the wrong breakpoint instruction when
+     single-stepping over a mode-changing instruction.  */
 
   if (insert_bpt)
     {
       next_pc = arm_get_next_pc (read_register (ARM_PC_REGNUM));
+
+      bp_pc = next_pc;
+      BREAKPOINT_FROM_PC (&bp_pc, &bp_size);
       target_insert_breakpoint (next_pc, break_mem);
     }
   else
-    target_remove_breakpoint (next_pc, break_mem);
+    target_remove_breakpoint (bp_pc, bp_size, break_mem);
 }
 
 #include "bfd-in2.h"
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.223
diff -u -p -r1.223 breakpoint.c
--- breakpoint.c	9 Feb 2006 11:24:46 -0000	1.223
+++ breakpoint.c	2 Mar 2006 20:40:51 -0000
@@ -803,6 +803,9 @@ insert_bp_location (struct bp_location *
 	{
 	  /* No overlay handling: just set the breakpoint.  */
 
+	  bpt->placed_address = bpt->address;
+	  BREAKPOINT_FROM_PC (&bpt->placed_address, &bpt->placed_size);
+
 	  if (bpt->loc_type == bp_loc_hardware_breakpoint)
 	    val = target_insert_hw_breakpoint (bpt->address, 
 					       bpt->shadow_contents);
@@ -827,6 +830,8 @@ insert_bp_location (struct bp_location *
 		  CORE_ADDR addr = overlay_unmapped_address (bpt->address,
 							     bpt->section);
 		  /* Set a software (trap) breakpoint at the LMA.  */
+		  bpt->placed_address = addr;
+		  BREAKPOINT_FROM_PC (&bpt->placed_address, &bpt->placed_size);
 		  val = target_insert_breakpoint (addr, bpt->shadow_contents);
 		  if (val != 0)
 		    fprintf_unfiltered (tmp_error_stream, 
@@ -838,6 +843,9 @@ insert_bp_location (struct bp_location *
 	  if (section_is_mapped (bpt->section))
 	    {
 	      /* Yes.  This overlay section is mapped into memory.  */
+	      bpt->placed_address = bpt->address;
+	      BREAKPOINT_FROM_PC (&bpt->placed_address, &bpt->placed_size);
+
 	      if (bpt->loc_type == bp_loc_hardware_breakpoint)
 		val = target_insert_hw_breakpoint (bpt->address, 
 						   bpt->shadow_contents);
@@ -1045,6 +1053,8 @@ in which its expression is valid.\n"),
       /* If we get here, we must have a callback mechanism for exception
 	 events -- with g++ style embedded label support, we insert
 	 ordinary breakpoints and not catchpoints. */
+      bpt->placed_address = bpt->address;
+      BREAKPOINT_FROM_PC (&bpt->placed_address, &bpt->placed_size);
       val = target_insert_breakpoint (bpt->address, bpt->shadow_contents);
       if (val)
 	{
@@ -1446,10 +1456,12 @@ remove_breakpoint (struct bp_location *b
 	  /* No overlay handling: just remove the breakpoint.  */
 
 	  if (b->loc_type == bp_loc_hardware_breakpoint)
-	    val = target_remove_hw_breakpoint (b->address, 
+	    val = target_remove_hw_breakpoint (b->placed_address,
+					       b->placed_size,
 					       b->shadow_contents);
 	  else
-	    val = target_remove_breakpoint (b->address, b->shadow_contents);
+	    val = target_remove_breakpoint (b->placed_address, b->placed_size,
+					    b->shadow_contents);
 	}
       else
 	{
@@ -1465,9 +1477,13 @@ remove_breakpoint (struct bp_location *b
 		/* Ignore any failures: if the LMA is in ROM, we will
 		   have already warned when we failed to insert it.  */
 		if (b->loc_type == bp_loc_hardware_breakpoint)
-		  target_remove_hw_breakpoint (addr, b->shadow_contents);
+		  target_remove_hw_breakpoint (b->placed_address,
+					       b->placed_size,
+					       b->shadow_contents);
 		else
-		  target_remove_breakpoint (addr, b->shadow_contents);
+		  target_remove_breakpoint (b->placed_address,
+					    b->placed_size,
+					    b->shadow_contents);
 	      }
 	  /* Did we set a breakpoint at the VMA? 
 	     If so, we will have marked the breakpoint 'inserted'.  */
@@ -1478,10 +1494,12 @@ remove_breakpoint (struct bp_location *b
 		 unmapped, but let's not rely on that being safe.  We
 		 don't know what the overlay manager might do.  */
 	      if (b->loc_type == bp_loc_hardware_breakpoint)
-		val = target_remove_hw_breakpoint (b->address, 
+		val = target_remove_hw_breakpoint (b->placed_address,
+						   b->placed_size,
 						   b->shadow_contents);
 	      else
-		val = target_remove_breakpoint (b->address,
+		val = target_remove_breakpoint (b->placed_address,
+						b->placed_size,
 						b->shadow_contents);
 	    }
 	  else
@@ -1570,8 +1588,8 @@ remove_breakpoint (struct bp_location *b
 	   && breakpoint_enabled (b->owner)
 	   && !b->duplicate)
     {
-
-      val = target_remove_breakpoint (b->address, b->shadow_contents);
+      val = target_remove_breakpoint (b->placed_address, b->placed_size,
+				      b->shadow_contents);
       if (val)
 	return val;
       b->inserted = (is == mark_inserted);
@@ -1581,8 +1599,8 @@ remove_breakpoint (struct bp_location *b
 	   && breakpoint_enabled (b->owner)
 	   && !b->duplicate)
     {
-
-      val = target_remove_breakpoint (b->address, b->shadow_contents);
+      val = target_remove_breakpoint (b->placed_address, b->placed_size,
+				      b->shadow_contents);
       if (val)
 	return val;
 
@@ -6852,6 +6870,9 @@ delete_breakpoint (struct breakpoint *bp
 			    _("another breakpoint was inserted on top of "
 			    "a permanent breakpoint"));
 
+	  bpt->loc->placed_address = b->loc->address;
+	  BREAKPOINT_FROM_PC (&b->loc->placed_address, &b->loc->placed_size);
+
 	  if (b->type == bp_hardware_breakpoint)
 	    val = target_insert_hw_breakpoint (b->loc->address, b->loc->shadow_contents);
 	  else
Index: breakpoint.h
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.h,v
retrieving revision 1.36
diff -u -p -r1.36 breakpoint.h
--- breakpoint.h	17 Dec 2005 22:33:59 -0000	1.36
+++ breakpoint.h	2 Mar 2006 20:40:52 -0000
@@ -256,6 +256,15 @@ struct bp_location
      which to place the breakpoint in order to comply with a
      processor's architectual constraints.  */
   CORE_ADDR requested_address;
+
+  /* Address at which the breakpoint was placed.  This is normally the same
+     as "address", above, except when adjustment happens in
+     BREAKPOINT_FROM_PC, usually stripping an alternate ISA marker
+     from the PC which is used to determine the correct breakpoint.  */
+  CORE_ADDR placed_address;
+
+  /* Size of the placed breakpoint, according to BREAKPOINT_FROM_PC.  */
+  int placed_size;
 };
 
 /* This structure is a collection of function pointers that, if available,
Index: corelow.c
===================================================================
RCS file: /cvs/src/src/gdb/corelow.c,v
retrieving revision 1.55
diff -u -p -r1.55 corelow.c
--- corelow.c	25 Feb 2006 04:36:39 -0000	1.55
+++ corelow.c	2 Mar 2006 20:40:52 -0000
@@ -608,6 +608,12 @@ ignore (CORE_ADDR addr, bfd_byte *conten
   return 0;
 }
 
+static int
+ignore_remove (CORE_ADDR addr, int len, bfd_byte *contents)
+{
+  return 0;
+}
+
 
 /* Okay, let's be honest: threads gleaned from a core file aren't
    exactly lively, are they?  On the other hand, if we don't claim
@@ -639,7 +645,7 @@ init_core_ops (void)
   core_ops.deprecated_xfer_memory = xfer_memory;
   core_ops.to_files_info = core_files_info;
   core_ops.to_insert_breakpoint = ignore;
-  core_ops.to_remove_breakpoint = ignore;
+  core_ops.to_remove_breakpoint = ignore_remove;
   core_ops.to_create_inferior = find_default_create_inferior;
   core_ops.to_thread_alive = core_file_thread_alive;
   core_ops.to_stratum = core_stratum;
Index: cris-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/cris-tdep.c,v
retrieving revision 1.134
diff -u -p -r1.134 cris-tdep.c
--- cris-tdep.c	15 Jan 2006 18:28:58 -0000	1.134
+++ cris-tdep.c	2 Mar 2006 20:40:52 -0000
@@ -2129,6 +2129,8 @@ static void
 cris_software_single_step (enum target_signal ignore, int insert_breakpoints)
 {
   inst_env_type inst_env;
+  static CORE_ADDR bp_pc, branch_bp_pc;
+  static int bp_size, branch_bp_size;
   
   if (insert_breakpoints)
     {
@@ -2146,12 +2148,16 @@ cris_software_single_step (enum target_s
           /* Insert at most two breakpoints.  One for the next PC content
              and possibly another one for a branch, jump, etc.  */
           next_pc = (CORE_ADDR) inst_env.reg[PC_REGNUM];
+          bp_pc = next_pc;
+          BREAKPOINT_FROM_PC (&bp_pc, &bp_size);
           target_insert_breakpoint (next_pc, break_mem[0]);
           if (inst_env.branch_found 
               && (CORE_ADDR) inst_env.branch_break_address != next_pc)
             {
               branch_target_address = 
                 (CORE_ADDR) inst_env.branch_break_address;
+              branch_bp_pc = branch_target_address;
+              BREAKPOINT_FROM_PC (&branch_bp_pc, &branch_bp_size);
               target_insert_breakpoint (branch_target_address, break_mem[1]);
               branch_break_inserted = 1;
             }
@@ -2160,10 +2166,11 @@ cris_software_single_step (enum target_s
   else
     {
       /* Remove breakpoints.  */
-      target_remove_breakpoint (next_pc, break_mem[0]);
+      target_remove_breakpoint (bp_pc, bp_size, break_mem[0]);
       if (branch_break_inserted)
         {
-          target_remove_breakpoint (branch_target_address, break_mem[1]);
+          target_remove_breakpoint (branch_bp_pc, branch_bp_size,
+                                    break_mem[1]);
           branch_break_inserted = 0;
         }
     }
Index: exec.c
===================================================================
RCS file: /cvs/src/src/gdb/exec.c,v
retrieving revision 1.60
diff -u -p -r1.60 exec.c
--- exec.c	25 Feb 2006 04:36:39 -0000	1.60
+++ exec.c	2 Mar 2006 20:40:52 -0000
@@ -696,6 +696,12 @@ ignore (CORE_ADDR addr, bfd_byte *conten
   return 0;
 }
 
+static int
+ignore_remove (CORE_ADDR addr, int len, bfd_byte *contents)
+{
+  return 0;
+}
+
 /* Find mapped memory. */
 
 extern void
@@ -726,7 +732,7 @@ Specify the filename of the executable f
   exec_ops.deprecated_xfer_memory = xfer_memory;
   exec_ops.to_files_info = exec_files_info;
   exec_ops.to_insert_breakpoint = ignore;
-  exec_ops.to_remove_breakpoint = ignore;
+  exec_ops.to_remove_breakpoint = ignore_remove;
   exec_ops.to_create_inferior = find_default_create_inferior;
   exec_ops.to_stratum = file_stratum;
   exec_ops.to_has_memory = 1;
Index: gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.328
diff -u -p -r1.328 gdbarch.c
--- gdbarch.c	17 Dec 2005 22:33:59 -0000	1.328
+++ gdbarch.c	2 Mar 2006 20:40:52 -0000
@@ -1259,8 +1259,8 @@ gdbarch_dump (struct gdbarch *current_gd
 #ifdef MEMORY_REMOVE_BREAKPOINT
   fprintf_unfiltered (file,
                       "gdbarch_dump: %s # %s\n",
-                      "MEMORY_REMOVE_BREAKPOINT(addr, contents_cache)",
-                      XSTRING (MEMORY_REMOVE_BREAKPOINT (addr, contents_cache)));
+                      "MEMORY_REMOVE_BREAKPOINT(addr, len, contents_cache)",
+                      XSTRING (MEMORY_REMOVE_BREAKPOINT (addr, len, contents_cache)));
 #endif
   fprintf_unfiltered (file,
                       "gdbarch_dump: memory_remove_breakpoint = <0x%lx>\n",
@@ -2951,13 +2951,13 @@ set_gdbarch_memory_insert_breakpoint (st
 }
 
 int
-gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, gdb_byte *contents_cache)
+gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, int len, gdb_byte *contents_cache)
 {
   gdb_assert (gdbarch != NULL);
   gdb_assert (gdbarch->memory_remove_breakpoint != NULL);
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_memory_remove_breakpoint called\n");
-  return gdbarch->memory_remove_breakpoint (addr, contents_cache);
+  return gdbarch->memory_remove_breakpoint (addr, len, contents_cache);
 }
 
 void
Index: gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.284
diff -u -p -r1.284 gdbarch.h
--- gdbarch.h	17 Dec 2005 22:34:00 -0000	1.284
+++ gdbarch.h	2 Mar 2006 20:40:53 -0000
@@ -909,14 +909,14 @@ extern void set_gdbarch_memory_insert_br
 #define MEMORY_INSERT_BREAKPOINT(addr, contents_cache) (gdbarch_memory_insert_breakpoint (current_gdbarch, addr, contents_cache))
 #endif
 
-typedef int (gdbarch_memory_remove_breakpoint_ftype) (CORE_ADDR addr, gdb_byte *contents_cache);
-extern int gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, gdb_byte *contents_cache);
+typedef int (gdbarch_memory_remove_breakpoint_ftype) (CORE_ADDR addr, int len, gdb_byte *contents_cache);
+extern int gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, int len, gdb_byte *contents_cache);
 extern void set_gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint);
 #if !defined (GDB_TM_FILE) && defined (MEMORY_REMOVE_BREAKPOINT)
 #error "Non multi-arch definition of MEMORY_REMOVE_BREAKPOINT"
 #endif
 #if !defined (MEMORY_REMOVE_BREAKPOINT)
-#define MEMORY_REMOVE_BREAKPOINT(addr, contents_cache) (gdbarch_memory_remove_breakpoint (current_gdbarch, addr, contents_cache))
+#define MEMORY_REMOVE_BREAKPOINT(addr, len, contents_cache) (gdbarch_memory_remove_breakpoint (current_gdbarch, addr, len, contents_cache))
 #endif
 
 extern CORE_ADDR gdbarch_decr_pc_after_break (struct gdbarch *gdbarch);
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.363
diff -u -p -r1.363 gdbarch.sh
--- gdbarch.sh	17 Dec 2005 22:34:00 -0000	1.363
+++ gdbarch.sh	2 Mar 2006 20:40:53 -0000
@@ -550,7 +550,7 @@ f:=:int:inner_than:CORE_ADDR lhs, CORE_A
 f:=:const gdb_byte *:breakpoint_from_pc:CORE_ADDR *pcptr, int *lenptr:pcptr, lenptr::0:
 M::CORE_ADDR:adjust_breakpoint_address:CORE_ADDR bpaddr:bpaddr
 f:=:int:memory_insert_breakpoint:CORE_ADDR addr, gdb_byte *contents_cache:addr, contents_cache:0:default_memory_insert_breakpoint::0
-f:=:int:memory_remove_breakpoint:CORE_ADDR addr, gdb_byte *contents_cache:addr, contents_cache:0:default_memory_remove_breakpoint::0
+f:=:int:memory_remove_breakpoint:CORE_ADDR addr, int len, gdb_byte *contents_cache:addr, len, contents_cache:0:default_memory_remove_breakpoint::0
 v:=:CORE_ADDR:decr_pc_after_break:::0:::0
 
 # A function can be addressed by either it's "pointer" (possibly a
Index: i386-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-nat.c,v
retrieving revision 1.13
diff -u -p -r1.13 i386-nat.c
--- i386-nat.c	17 Dec 2005 22:34:01 -0000	1.13
+++ i386-nat.c	2 Mar 2006 20:40:53 -0000
@@ -639,11 +639,11 @@ i386_insert_hw_breakpoint (CORE_ADDR add
   return retval;
 }
 
-/* Remove a hardware-assisted breakpoint at address ADDR.  SHADOW is
-   unused.  Return 0 on success, -1 on failure.  */
+/* Remove a hardware-assisted breakpoint at address ADDR.  LEN and
+   SHADOW are unused.  Return 0 on success, -1 on failure.  */
 
 int
-i386_remove_hw_breakpoint (CORE_ADDR addr, void *shadow)
+i386_remove_hw_breakpoint (CORE_ADDR addr, int len, void *shadow)
 {
   unsigned len_rw = i386_length_and_rw_bits (1, hw_execute);
   int retval = i386_remove_aligned_watchpoint (addr, len_rw);
Index: ia64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ia64-tdep.c,v
retrieving revision 1.137
diff -u -p -r1.137 ia64-tdep.c
--- ia64-tdep.c	17 Dec 2005 22:34:01 -0000	1.137
+++ ia64-tdep.c	2 Mar 2006 20:40:53 -0000
@@ -583,7 +583,8 @@ ia64_memory_insert_breakpoint (CORE_ADDR
 }
 
 static int
-ia64_memory_remove_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
+ia64_memory_remove_breakpoint (CORE_ADDR addr, int len,
+			       bfd_byte *contents_cache)
 {
   char bundle[BUNDLE_LEN];
   int slotnum = (addr & 0x0f) / SLOT_MULTIPLIER;
Index: m32r-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/m32r-tdep.c,v
retrieving revision 1.40
diff -u -p -r1.40 m32r-tdep.c
--- m32r-tdep.c	17 Dec 2005 22:34:01 -0000	1.40
+++ m32r-tdep.c	2 Mar 2006 20:40:53 -0000
@@ -134,7 +134,8 @@ m32r_memory_insert_breakpoint (CORE_ADDR
 }
 
 static int
-m32r_memory_remove_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
+m32r_memory_remove_breakpoint (CORE_ADDR addr, int len,
+			       bfd_byte *contents_cache)
 {
   int val;
   gdb_byte buf[4];
Index: mem-break.c
===================================================================
RCS file: /cvs/src/src/gdb/mem-break.c,v
retrieving revision 1.11
diff -u -p -r1.11 mem-break.c
--- mem-break.c	17 Dec 2005 22:34:01 -0000	1.11
+++ mem-break.c	2 Mar 2006 20:40:53 -0000
@@ -65,17 +65,10 @@ default_memory_insert_breakpoint (CORE_A
 
 
 int
-default_memory_remove_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
+default_memory_remove_breakpoint (CORE_ADDR addr, int len,
+				  bfd_byte *contents_cache)
 {
-  const bfd_byte *bp;
-  int bplen;
-
-  /* Determine appropriate breakpoint contents and size for this address.  */
-  bp = BREAKPOINT_FROM_PC (&addr, &bplen);
-  if (bp == NULL)
-    error (_("Software breakpoints not implemented for this target."));
-
-  return target_write_memory (addr, contents_cache, bplen);
+  return target_write_memory (addr, contents_cache, len);
 }
 
 
@@ -86,7 +79,7 @@ memory_insert_breakpoint (CORE_ADDR addr
 }
 
 int
-memory_remove_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
+memory_remove_breakpoint (CORE_ADDR addr, int len, bfd_byte *contents_cache)
 {
-  return MEMORY_REMOVE_BREAKPOINT(addr, contents_cache);
+  return MEMORY_REMOVE_BREAKPOINT(addr, len, contents_cache);
 }
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.385
diff -u -p -r1.385 mips-tdep.c
--- mips-tdep.c	17 Dec 2005 22:34:01 -0000	1.385
+++ mips-tdep.c	2 Mar 2006 20:40:54 -0000
@@ -2192,16 +2192,20 @@ mips_software_single_step (enum target_s
   typedef char binsn_quantum[BREAKPOINT_MAX];
   static binsn_quantum break_mem;
   CORE_ADDR pc;
+  static CORE_ADDR bp_pc;
+  static int bp_size;
 
   if (insert_breakpoints_p)
     {
       pc = read_register (mips_regnum (current_gdbarch)->pc);
       next_pc = mips_next_pc (pc);
 
+      bp_pc = next_pc;
+      BREAKPOINT_FROM_PC (&bp_pc, &bp_size);
       target_insert_breakpoint (next_pc, break_mem);
     }
   else
-    target_remove_breakpoint (next_pc, break_mem);
+    target_remove_breakpoint (bp_pc, bp_size, break_mem);
 }
 
 /* Test whether the PC points to the return instruction at the
Index: monitor.c
===================================================================
RCS file: /cvs/src/src/gdb/monitor.c,v
retrieving revision 1.63
diff -u -p -r1.63 monitor.c
--- monitor.c	24 Jan 2006 22:09:28 -0000	1.63
+++ monitor.c	2 Mar 2006 20:40:54 -0000
@@ -2071,7 +2071,7 @@ monitor_insert_breakpoint (CORE_ADDR add
 /* Tell the monitor to remove a breakpoint.  */
 
 static int
-monitor_remove_breakpoint (CORE_ADDR addr, gdb_byte *shadow)
+monitor_remove_breakpoint (CORE_ADDR addr, int len, gdb_byte *shadow)
 {
   int i;
 
Index: nto-procfs.c
===================================================================
RCS file: /cvs/src/src/gdb/nto-procfs.c,v
retrieving revision 1.17
diff -u -p -r1.17 nto-procfs.c
--- nto-procfs.c	24 Jan 2006 22:09:28 -0000	1.17
+++ nto-procfs.c	2 Mar 2006 20:40:54 -0000
@@ -78,7 +78,7 @@ static int procfs_can_use_hw_breakpoint 
 
 static int procfs_insert_hw_breakpoint (CORE_ADDR, char *);
 
-static int procfs_remove_hw_breakpoint (CORE_ADDR addr, char *);
+static int procfs_remove_hw_breakpoint (CORE_ADDR addr, int len, char *);
 
 static int procfs_insert_hw_watchpoint (CORE_ADDR addr, int len, int type);
 
@@ -818,7 +818,7 @@ procfs_insert_breakpoint (CORE_ADDR addr
 }
 
 static int
-procfs_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
+procfs_remove_breakpoint (CORE_ADDR addr, int len, char *contents_cache)
 {
   return procfs_breakpoint (addr, _DEBUG_BREAK_EXEC, -1);
 }
@@ -830,7 +830,7 @@ procfs_insert_hw_breakpoint (CORE_ADDR a
 }
 
 static int
-procfs_remove_hw_breakpoint (CORE_ADDR addr, char *contents_cache)
+procfs_remove_hw_breakpoint (CORE_ADDR addr, int len, char *contents_cache)
 {
   return procfs_breakpoint (addr, _DEBUG_BREAK_EXEC | _DEBUG_BREAK_HW, -1);
 }
Index: ocd.c
===================================================================
RCS file: /cvs/src/src/gdb/ocd.c,v
retrieving revision 1.43
diff -u -p -r1.43 ocd.c
--- ocd.c	24 Jan 2006 22:09:28 -0000	1.43
+++ ocd.c	2 Mar 2006 20:40:54 -0000
@@ -1062,7 +1062,7 @@ ocd_insert_breakpoint (CORE_ADDR addr, c
 }
 
 int
-ocd_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
+ocd_remove_breakpoint (CORE_ADDR addr, int len, char *contents_cache)
 {
   static char break_insn[] = BDM_BREAKPOINT;
   int val;
Index: ocd.h
===================================================================
RCS file: /cvs/src/src/gdb/ocd.h,v
retrieving revision 1.8
diff -u -p -r1.8 ocd.h
--- ocd.h	17 Dec 2005 22:34:01 -0000	1.8
+++ ocd.h	2 Mar 2006 20:40:54 -0000
@@ -136,7 +136,7 @@ void ocd_write_bdm_register (int bdm_reg
 int ocd_wait (void);
 
 int ocd_insert_breakpoint (CORE_ADDR addr, char *contents_cache);
-int ocd_remove_breakpoint (CORE_ADDR addr, char *contents_cache);
+int ocd_remove_breakpoint (CORE_ADDR addr, int len, char *contents_cache);
 
 int ocd_write_bytes (CORE_ADDR memaddr, char *myaddr, int len);
 
Index: ppc-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ppc-linux-tdep.c,v
retrieving revision 1.77
diff -u -p -r1.77 ppc-linux-tdep.c
--- ppc-linux-tdep.c	15 Jan 2006 18:28:58 -0000	1.77
+++ ppc-linux-tdep.c	2 Mar 2006 20:40:54 -0000
@@ -457,16 +457,13 @@ ppc_linux_skip_trampoline_code (CORE_ADD
    regard to removing breakpoints in some potentially self modifying
    code.  */
 int
-ppc_linux_memory_remove_breakpoint (CORE_ADDR addr,
+ppc_linux_memory_remove_breakpoint (CORE_ADDR addr, int bplen,
 				    gdb_byte *contents_cache)
 {
   const unsigned char *bp;
   int val;
-  int bplen;
   gdb_byte old_contents[BREAKPOINT_MAX];
 
-  /* Determine appropriate breakpoint contents and size for this address.  */
-  bp = BREAKPOINT_FROM_PC (&addr, &bplen);
   if (bp == NULL)
     error (_("Software breakpoints not implemented for this target."));
 
Index: ppc-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/ppc-tdep.h,v
retrieving revision 1.50
diff -u -p -r1.50 ppc-tdep.h
--- ppc-tdep.h	17 Jan 2006 22:21:13 -0000	1.50
+++ ppc-tdep.h	2 Mar 2006 20:40:54 -0000
@@ -56,7 +56,7 @@ CORE_ADDR ppc64_sysv_abi_push_dummy_call
 					  CORE_ADDR struct_addr);
 CORE_ADDR ppc64_sysv_abi_adjust_breakpoint_address (struct gdbarch *gdbarch,
 						    CORE_ADDR bpaddr);
-int ppc_linux_memory_remove_breakpoint (CORE_ADDR addr,
+int ppc_linux_memory_remove_breakpoint (CORE_ADDR addr, int len,
 					gdb_byte *contents_cache);
 struct link_map_offsets *ppc_linux_svr4_fetch_link_map_offsets (void);
 void ppc_linux_supply_gregset (struct regcache *regcache,
Index: procfs.c
===================================================================
RCS file: /cvs/src/src/gdb/procfs.c,v
retrieving revision 1.68
diff -u -p -r1.68 procfs.c
--- procfs.c	24 Jan 2006 22:09:28 -0000	1.68
+++ procfs.c	2 Mar 2006 20:40:55 -0000
@@ -3371,11 +3371,12 @@ static int insert_dbx_link_breakpoint (p
 static void remove_dbx_link_breakpoint (void);
 
 /* On mips-irix, we need to insert a breakpoint at __dbx_link during
-   the startup phase.  The following two variables are used to record
-   the address of the breakpoint, and the code that was replaced by
-   a breakpoint.  */
+   the startup phase.  The following three variables are used to record
+   the address of the breakpoint, the code that was replaced by
+   a breakpoint, and the size of the breakpoint.  */
 static int dbx_link_bpt_addr = 0;
 static char dbx_link_shadow_contents[BREAKPOINT_MAX];
+static int dbx_link_bpt_size;
 
 /*
  * Function: procfs_debug_inferior
@@ -5571,7 +5572,7 @@ remove_dbx_link_breakpoint (void)
   if (dbx_link_bpt_addr == 0)
     return;
 
-  if (memory_remove_breakpoint (dbx_link_bpt_addr,
+  if (memory_remove_breakpoint (dbx_link_bpt_addr, dbx_link_bpt_size,
                                 dbx_link_shadow_contents) != 0)
     warning (_("Unable to remove __dbx_link breakpoint."));
 
@@ -5643,6 +5644,7 @@ insert_dbx_link_bpt_in_file (int fd, COR
     {
       /* Insert the breakpoint.  */
       dbx_link_bpt_addr = sym_addr;
+      BREAKPOINT_FROM_PC (&dbx_link_bpt_addr, &dbx_link_bpt_size);
       if (target_insert_breakpoint (sym_addr, dbx_link_shadow_contents) != 0)
         {
           warning (_("Failed to insert dbx_link breakpoint."));
Index: remote-e7000.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-e7000.c,v
retrieving revision 1.57
diff -u -p -r1.57 remote-e7000.c
--- remote-e7000.c	24 Jan 2006 22:09:28 -0000	1.57
+++ remote-e7000.c	2 Mar 2006 20:40:55 -0000
@@ -1745,7 +1745,7 @@ e7000_insert_breakpoint (CORE_ADDR addr,
 }
 
 static int
-e7000_remove_breakpoint (CORE_ADDR addr, bfd_byte *shadow)
+e7000_remove_breakpoint (CORE_ADDR addr, int len, bfd_byte *shadow)
 {
   int i;
   char buf[200];
Index: remote-m32r-sdi.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-m32r-sdi.c,v
retrieving revision 1.17
diff -u -p -r1.17 remote-m32r-sdi.c
--- remote-m32r-sdi.c	24 Jan 2006 22:09:28 -0000	1.17
+++ remote-m32r-sdi.c	2 Mar 2006 20:40:55 -0000
@@ -1183,7 +1183,7 @@ m32r_insert_breakpoint (CORE_ADDR addr, 
 }
 
 static int
-m32r_remove_breakpoint (CORE_ADDR addr, bfd_byte *shadow)
+m32r_remove_breakpoint (CORE_ADDR addr, int len, bfd_byte *shadow)
 {
   int i;
 
Index: remote-mips.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-mips.c,v
retrieving revision 1.68
diff -u -p -r1.68 remote-mips.c
--- remote-mips.c	24 Jan 2006 22:09:28 -0000	1.68
+++ remote-mips.c	2 Mar 2006 20:40:56 -0000
@@ -2231,12 +2231,12 @@ mips_insert_breakpoint (CORE_ADDR addr, 
 }
 
 static int
-mips_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
+mips_remove_breakpoint (CORE_ADDR addr, int len, char *contents_cache)
 {
   if (monitor_supports_breakpoints)
     return clear_breakpoint (addr, MIPS_INSN32_SIZE, BREAK_FETCH);
   else
-    return memory_remove_breakpoint (addr, contents_cache);
+    return memory_remove_breakpoint (addr, len, contents_cache);
 }
 
 /* Tell whether this target can support a hardware breakpoint.  CNT
Index: remote-rdp.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-rdp.c,v
retrieving revision 1.48
diff -u -p -r1.48 remote-rdp.c
--- remote-rdp.c	25 Feb 2006 04:36:39 -0000	1.48
+++ remote-rdp.c	2 Mar 2006 20:40:56 -0000
@@ -1074,7 +1074,7 @@ remote_rdp_insert_breakpoint (CORE_ADDR 
 }
 
 static int
-remote_rdp_remove_breakpoint (CORE_ADDR addr, bfd_byte *save)
+remote_rdp_remove_breakpoint (CORE_ADDR addr, int len, bfd_byte *save)
 {
   int res;
   if (ds.rdi_level > 0)
@@ -1109,11 +1109,15 @@ rdp_step (void)
   else
     {
       char handle[4];
+      CORE_ADDR bp_pc;
+      int bp_len;
       CORE_ADDR pc = read_register (ARM_PC_REGNUM);
       pc = arm_get_next_pc (pc);
+      bp_pc = pc;
+      BREAKPOINT_FROM_PC (&bp_pc, &bp_len);
       remote_rdp_insert_breakpoint (pc, handle);
       rdp_execute ();
-      remote_rdp_remove_breakpoint (pc, handle);
+      remote_rdp_remove_breakpoint (bp_pc, bp_len, handle);
     }
 }
 
Index: remote-sds.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-sds.c,v
retrieving revision 1.42
diff -u -p -r1.42 remote-sds.c
--- remote-sds.c	24 Jan 2006 22:09:28 -0000	1.42
+++ remote-sds.c	2 Mar 2006 20:40:56 -0000
@@ -101,7 +101,7 @@ static int read_frame (char *);
 
 static int sds_insert_breakpoint (CORE_ADDR, char *);
 
-static int sds_remove_breakpoint (CORE_ADDR, char *);
+static int sds_remove_breakpoint (CORE_ADDR, int, char *);
 
 static void init_sds_ops (void);
 
@@ -1026,7 +1026,7 @@ sds_insert_breakpoint (CORE_ADDR addr, c
 }
 
 static int
-sds_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
+sds_remove_breakpoint (CORE_ADDR addr, int len, char *contents_cache)
 {
   int i, retlen;
   unsigned char *p, buf[PBUFSIZ];
Index: remote-sim.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-sim.c,v
retrieving revision 1.53
diff -u -p -r1.53 remote-sim.c
--- remote-sim.c	21 Feb 2006 18:22:26 -0000	1.53
+++ remote-sim.c	2 Mar 2006 20:40:56 -0000
@@ -812,9 +812,9 @@ gdbsim_insert_breakpoint (CORE_ADDR addr
 }
 
 static int
-gdbsim_remove_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
+gdbsim_remove_breakpoint (CORE_ADDR addr, int len, bfd_byte *contents_cache)
 {
-  return memory_remove_breakpoint (addr, contents_cache);
+  return memory_remove_breakpoint (addr, len, contents_cache);
 }
 
 /* Pass the command argument through to the simulator verbatim.  The
Index: remote-st.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-st.c,v
retrieving revision 1.30
diff -u -p -r1.30 remote-st.c
--- remote-st.c	10 Feb 2006 22:01:43 -0000	1.30
+++ remote-st.c	2 Mar 2006 20:40:56 -0000
@@ -623,7 +623,7 @@ st2000_insert_breakpoint (CORE_ADDR addr
 }
 
 static int
-st2000_remove_breakpoint (CORE_ADDR addr, char *shadow)
+st2000_remove_breakpoint (CORE_ADDR addr, int len, char *shadow)
 {
   int i;
 
Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.202
diff -u -p -r1.202 remote.c
--- remote.c	20 Feb 2006 15:19:06 -0000	1.202
+++ remote.c	2 Mar 2006 20:40:56 -0000
@@ -136,7 +136,7 @@ static long read_frame (char *buf, long 
 
 static int remote_insert_breakpoint (CORE_ADDR, bfd_byte *);
 
-static int remote_remove_breakpoint (CORE_ADDR, bfd_byte *);
+static int remote_remove_breakpoint (CORE_ADDR, int, bfd_byte *);
 
 static int hexnumlen (ULONGEST num);
 
@@ -4369,7 +4369,7 @@ remote_insert_breakpoint (CORE_ADDR addr
 }
 
 static int
-remote_remove_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
+remote_remove_breakpoint (CORE_ADDR addr, int len, bfd_byte *contents_cache)
 {
   struct remote_state *rs = get_remote_state ();
   int bp_size;
@@ -4397,7 +4397,7 @@ remote_remove_breakpoint (CORE_ADDR addr
 #ifdef DEPRECATED_REMOTE_BREAKPOINT
   return target_write_memory (addr, contents_cache, sizeof big_break_insn);
 #else
-  return memory_remove_breakpoint (addr, contents_cache);
+  return memory_remove_breakpoint (addr, len, contents_cache);
 #endif /* DEPRECATED_REMOTE_BREAKPOINT */
 }
 
@@ -4585,9 +4585,8 @@ remote_insert_hw_breakpoint (CORE_ADDR a
 
 
 static int
-remote_remove_hw_breakpoint (CORE_ADDR addr, gdb_byte *shadow)
+remote_remove_hw_breakpoint (CORE_ADDR addr, int len, gdb_byte *shadow)
 {
-  int len;
   struct remote_state *rs = get_remote_state ();
   char *buf = alloca (rs->remote_packet_size);
   char *p = buf;
@@ -4595,8 +4594,6 @@ remote_remove_hw_breakpoint (CORE_ADDR a
   /* The length field should be set to the size of a breakpoint
      instruction.  */
 
-  BREAKPOINT_FROM_PC (&addr, &len);
-
   if (remote_protocol_packets[PACKET_Z1].support == PACKET_DISABLE)
     error (_("Can't clear hardware breakpoint without the '%s' (%s) packet."),
 	   remote_protocol_packets[PACKET_Z1].name,
Index: rs6000-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-nat.c,v
retrieving revision 1.60
diff -u -p -r1.60 rs6000-nat.c
--- rs6000-nat.c	17 Dec 2005 22:34:02 -0000	1.60
+++ rs6000-nat.c	2 Mar 2006 20:40:57 -0000
@@ -530,11 +530,15 @@ exec_one_dummy_insn (void)
   char shadow_contents[BREAKPOINT_MAX];		/* Stash old bkpt addr contents */
   int ret, status, pid;
   CORE_ADDR prev_pc;
+  CORE_ADDR bp_pc,
+  int bp_len;
 
   /* We plant one dummy breakpoint into DUMMY_INSN_ADDR address. We
      assume that this address will never be executed again by the real
      code. */
 
+  bp_pc = DUMMY_INSN_ADDR;
+  BREAKPOINT_FROM_PC (&bp_pc, &bp_len);
   target_insert_breakpoint (DUMMY_INSN_ADDR, shadow_contents);
 
   /* You might think this could be done with a single ptrace call, and
@@ -559,7 +563,7 @@ exec_one_dummy_insn (void)
   while (pid != PIDGET (inferior_ptid));
 
   write_pc (prev_pc);
-  target_remove_breakpoint (DUMMY_INSN_ADDR, shadow_contents);
+  target_remove_breakpoint (bp_pc, bp_len, shadow_contents);
 }
 
 /* Fetch registers from the register section in core bfd. */
Index: rs6000-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
retrieving revision 1.256
diff -u -p -r1.256 rs6000-tdep.c
--- rs6000-tdep.c	10 Feb 2006 20:56:14 -0000	1.256
+++ rs6000-tdep.c	2 Mar 2006 20:40:57 -0000
@@ -727,6 +727,8 @@ rs6000_software_single_step (enum target
   CORE_ADDR loc;
   CORE_ADDR breaks[2];
   int opcode;
+  static CORE_ADDR bp_pc[2];
+  static int bp_size[2];
 
   if (insert_breakpoints_p)
     {
@@ -751,6 +753,8 @@ rs6000_software_single_step (enum target
 	  /* ignore invalid breakpoint. */
 	  if (breaks[ii] == -1)
 	    continue;
+	  bp_pc[ii] = breaks[ii];
+	  BREAKPOINT_FROM_PC (&bp_pc[ii], &bp_size[ii]);
 	  target_insert_breakpoint (breaks[ii], stepBreaks[ii].data);
 	  stepBreaks[ii].address = breaks[ii];
 	}
@@ -762,7 +766,7 @@ rs6000_software_single_step (enum target
       /* remove step breakpoints. */
       for (ii = 0; ii < 2; ++ii)
 	if (stepBreaks[ii].address != 0)
-	  target_remove_breakpoint (stepBreaks[ii].address,
+	  target_remove_breakpoint (bp_pc[ii], bp_size[ii],
 				    stepBreaks[ii].data);
     }
   errno = 0;			/* FIXME, don't ignore errors! */
Index: sol-thread.c
===================================================================
RCS file: /cvs/src/src/gdb/sol-thread.c,v
retrieving revision 1.51
diff -u -p -r1.51 sol-thread.c
--- sol-thread.c	17 Dec 2005 22:34:02 -0000	1.51
+++ sol-thread.c	2 Mar 2006 20:40:57 -0000
@@ -1529,6 +1529,12 @@ ignore (CORE_ADDR addr, gdb_byte *conten
   return 0;
 }
 
+static int
+ignore_remove (CORE_ADDR addr, int len, gdb_byte *contents)
+{
+  return 0;
+}
+
 static void
 init_sol_thread_ops (void)
 {
@@ -1590,7 +1596,7 @@ init_sol_core_ops (void)
   sol_core_ops.to_xfer_partial = sol_thread_xfer_partial;
   sol_core_ops.to_files_info = sol_core_files_info;
   sol_core_ops.to_insert_breakpoint = ignore;
-  sol_core_ops.to_remove_breakpoint = ignore;
+  sol_core_ops.to_remove_breakpoint = ignore_remove;
   sol_core_ops.to_create_inferior = sol_thread_create_inferior;
   sol_core_ops.to_stratum = core_stratum;
   sol_core_ops.to_has_memory = 1;
Index: solib-irix.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-irix.c,v
retrieving revision 1.9
diff -u -p -r1.9 solib-irix.c
--- solib-irix.c	17 Dec 2005 22:34:02 -0000	1.9
+++ solib-irix.c	2 Mar 2006 20:40:57 -0000
@@ -231,6 +231,7 @@ char shadow_contents[BREAKPOINT_MAX];	/*
 
 static CORE_ADDR debug_base;	/* Base of dynamic linker structures */
 static CORE_ADDR breakpoint_addr;	/* Address where end bkpt is set */
+static int breakpoint_len;
 
 /*
 
@@ -319,7 +320,8 @@ disable_break (void)
   /* Note that breakpoint address and original contents are in our address
      space, so we just need to write the original contents back. */
 
-  if (memory_remove_breakpoint (breakpoint_addr, shadow_contents) != 0)
+  if (memory_remove_breakpoint (breakpoint_addr, breakpoint_len,
+				shadow_contents) != 0)
     {
       status = 0;
     }
@@ -357,6 +359,7 @@ enable_break (void)
 				   shadow_contents) == 0)
     {
       breakpoint_addr = entry_point_address ();
+      BREAKPOINT_FROM_PC (&breakpoint_addr, &breakpoint_len);
       return 1;
     }
 
Index: sparc-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-tdep.c,v
retrieving revision 1.168
diff -u -p -r1.168 sparc-tdep.c
--- sparc-tdep.c	22 Jan 2006 20:07:38 -0000	1.168
+++ sparc-tdep.c	2 Mar 2006 20:40:57 -0000
@@ -1087,6 +1087,8 @@ sparc_software_single_step (enum target_
   struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
   static CORE_ADDR npc, nnpc;
   static gdb_byte npc_save[4], nnpc_save[4];
+  static CORE_ADDR bp_npc, bp_nnpc;
+  static int bp_nsize, bp_nnsize;
 
   if (insert_breakpoints_p)
     {
@@ -1098,9 +1100,17 @@ sparc_software_single_step (enum target_
       /* Analyze the instruction at PC.  */
       nnpc = sparc_analyze_control_transfer (arch, pc, &npc);
       if (npc != 0)
-	target_insert_breakpoint (npc, npc_save);
+	{
+	  bp_npc = npc;
+	  BREAKPOINT_FROM_PC (&bp_npc, &bp_nsize);
+	  target_insert_breakpoint (npc, npc_save);
+	}
       if (nnpc != 0)
-	target_insert_breakpoint (nnpc, nnpc_save);
+	{
+	  bp_npc = npc;
+	  BREAKPOINT_FROM_PC (&bp_npc, &bp_nsize);
+	  target_insert_breakpoint (nnpc, nnpc_save);
+	}
 
       /* Assert that we have set at least one breakpoint, and that
 	 they're not set at the same spot - unless we're going
@@ -1111,9 +1121,9 @@ sparc_software_single_step (enum target_
   else
     {
       if (npc != 0)
-	target_remove_breakpoint (npc, npc_save);
+	target_remove_breakpoint (bp_npc, bp_nsize, npc_save);
       if (nnpc != 0)
-	target_remove_breakpoint (nnpc, nnpc_save);
+	target_remove_breakpoint (bp_nnpc, bp_nnsize, nnpc_save);
     }
 }
 
Index: target.c
===================================================================
RCS file: /cvs/src/src/gdb/target.c,v
retrieving revision 1.116
diff -u -p -r1.116 target.c
--- target.c	8 Feb 2006 06:43:00 -0000	1.116
+++ target.c	2 Mar 2006 20:40:58 -0000
@@ -113,13 +113,13 @@ static void debug_to_files_info (struct 
 
 static int debug_to_insert_breakpoint (CORE_ADDR, gdb_byte *);
 
-static int debug_to_remove_breakpoint (CORE_ADDR, gdb_byte *);
+static int debug_to_remove_breakpoint (CORE_ADDR, int, gdb_byte *);
 
 static int debug_to_can_use_hw_breakpoint (int, int, int);
 
 static int debug_to_insert_hw_breakpoint (CORE_ADDR, gdb_byte *);
 
-static int debug_to_remove_hw_breakpoint (CORE_ADDR, gdb_byte *);
+static int debug_to_remove_hw_breakpoint (CORE_ADDR, int, gdb_byte *);
 
 static int debug_to_insert_watchpoint (CORE_ADDR, int, int);
 
@@ -518,7 +518,7 @@ update_current_target (void)
 	    (int (*) (CORE_ADDR, gdb_byte *))
 	    return_minus_one);
   de_fault (to_remove_hw_breakpoint,
-	    (int (*) (CORE_ADDR, gdb_byte *))
+	    (int (*) (CORE_ADDR, int, gdb_byte *))
 	    return_minus_one);
   de_fault (to_insert_watchpoint,
 	    (int (*) (CORE_ADDR, int, int))
@@ -2089,15 +2089,15 @@ debug_to_insert_breakpoint (CORE_ADDR ad
 }
 
 static int
-debug_to_remove_breakpoint (CORE_ADDR addr, gdb_byte *save)
+debug_to_remove_breakpoint (CORE_ADDR addr, int len, gdb_byte *save)
 {
   int retval;
 
-  retval = debug_target.to_remove_breakpoint (addr, save);
+  retval = debug_target.to_remove_breakpoint (addr, len, save);
 
   fprintf_unfiltered (gdb_stdlog,
-		      "target_remove_breakpoint (0x%lx, xxx) = %ld\n",
-		      (unsigned long) addr,
+		      "target_remove_breakpoint (0x%lx, %d, xxx) = %ld\n",
+		      (unsigned long) addr, len,
 		      (unsigned long) retval);
   return retval;
 }
@@ -2175,15 +2175,15 @@ debug_to_insert_hw_breakpoint (CORE_ADDR
 }
 
 static int
-debug_to_remove_hw_breakpoint (CORE_ADDR addr, gdb_byte *save)
+debug_to_remove_hw_breakpoint (CORE_ADDR addr, int len, gdb_byte *save)
 {
   int retval;
 
-  retval = debug_target.to_remove_hw_breakpoint (addr, save);
+  retval = debug_target.to_remove_hw_breakpoint (addr, len, save);
 
   fprintf_unfiltered (gdb_stdlog,
-		      "target_remove_hw_breakpoint (0x%lx, xxx) = %ld\n",
-		      (unsigned long) addr,
+		      "target_remove_hw_breakpoint (0x%lx, %d, xxx) = %ld\n",
+		      (unsigned long) addr, len,
 		      (unsigned long) retval);
   return retval;
 }
Index: target.h
===================================================================
RCS file: /cvs/src/src/gdb/target.h,v
retrieving revision 1.81
diff -u -p -r1.81 target.h
--- target.h	21 Feb 2006 18:22:26 -0000	1.81
+++ target.h	2 Mar 2006 20:40:58 -0000
@@ -337,10 +337,10 @@ struct target_ops
 
     void (*to_files_info) (struct target_ops *);
     int (*to_insert_breakpoint) (CORE_ADDR, gdb_byte *);
-    int (*to_remove_breakpoint) (CORE_ADDR, gdb_byte *);
+    int (*to_remove_breakpoint) (CORE_ADDR, int, gdb_byte *);
     int (*to_can_use_hw_breakpoint) (int, int, int);
     int (*to_insert_hw_breakpoint) (CORE_ADDR, gdb_byte *);
-    int (*to_remove_hw_breakpoint) (CORE_ADDR, gdb_byte *);
+    int (*to_remove_hw_breakpoint) (CORE_ADDR, int, gdb_byte *);
     int (*to_remove_watchpoint) (CORE_ADDR, int, int);
     int (*to_insert_watchpoint) (CORE_ADDR, int, int);
     int (*to_stopped_by_watchpoint) (void);
@@ -624,10 +624,13 @@ extern void print_section_info (struct t
 /* Remove a breakpoint at address ADDR in the target machine.
    SAVE is a pointer to the same save area
    that was previously passed to target_insert_breakpoint.
+   LEN is the size of the breakpoint as indicated by
+   BREAKPOINT_FROM_PC.
+
    Result is 0 for success, or an errno value.  */
 
-#define	target_remove_breakpoint(addr, save)	\
-     (*current_target.to_remove_breakpoint) (addr, save)
+#define	target_remove_breakpoint(addr, len, save)	\
+     (*current_target.to_remove_breakpoint) (addr, len, save)
 
 /* Initialize the terminal settings we record for the inferior,
    before we actually run the inferior.  */
@@ -1060,8 +1063,8 @@ extern void (*deprecated_target_new_objf
 #define target_insert_hw_breakpoint(addr, save) \
      (*current_target.to_insert_hw_breakpoint) (addr, save)
 
-#define target_remove_hw_breakpoint(addr, save) \
-     (*current_target.to_remove_hw_breakpoint) (addr, save)
+#define target_remove_hw_breakpoint(addr, len, save) \
+     (*current_target.to_remove_hw_breakpoint) (addr, len, save)
 #endif
 
 extern int target_stopped_data_address_p (struct target_ops *);
@@ -1142,11 +1145,11 @@ struct section_table *target_section_by_
 
 /* From mem-break.c */
 
-extern int memory_remove_breakpoint (CORE_ADDR, gdb_byte *);
+extern int memory_remove_breakpoint (CORE_ADDR, int, gdb_byte *);
 
 extern int memory_insert_breakpoint (CORE_ADDR, gdb_byte *);
 
-extern int default_memory_remove_breakpoint (CORE_ADDR, gdb_byte *);
+extern int default_memory_remove_breakpoint (CORE_ADDR, int, gdb_byte *);
 
 extern int default_memory_insert_breakpoint (CORE_ADDR, gdb_byte *);
 
Index: wince.c
===================================================================
RCS file: /cvs/src/src/gdb/wince.c,v
retrieving revision 1.44
diff -u -p -r1.44 wince.c
--- wince.c	24 Jan 2006 22:09:28 -0000	1.44
+++ wince.c	2 Mar 2006 20:40:58 -0000
@@ -146,6 +146,8 @@ typedef struct thread_info_struct
     int suspend_count;
     int stepped;		/* True if stepped.  */
     CORE_ADDR step_pc;
+    CORE_ADDR bp_pc;
+    int bp_len;
     unsigned long step_prev;
     CONTEXT context;
   }
@@ -834,7 +836,8 @@ undoSStep (thread_info * th)
 {
   if (th->stepped)
     {
-      memory_remove_breakpoint (th->step_pc, (void *) &th->step_prev);
+      memory_remove_breakpoint (th->bp_pc, th->bp_len,
+				(void *) &th->step_prev);
       th->stepped = 0;
     }
 }
@@ -858,6 +861,8 @@ wince_software_single_step (enum target_
   pc = read_register (PC_REGNUM);
   th->step_pc = mips_next_pc (pc);
   th->step_prev = 0;
+  th->bp_pc = th->step_pc;
+  BREAKPOINT_FROM_PC (&th->bp_pc, &th->bp_len);
   memory_insert_breakpoint (th->step_pc, (void *) &th->step_prev);
   return;
 }
@@ -971,7 +976,8 @@ undoSStep (thread_info * th)
 {
   if (th->stepped)
     {
-      memory_remove_breakpoint (th->step_pc, (void *) &th->step_prev);
+      memory_remove_breakpoint (th->bp_pc, th->bp_len,
+				(void *) &th->step_prev);
       th->stepped = 0;
     }
   return;
@@ -997,6 +1003,8 @@ wince_software_single_step (enum target_
   th->stepped = 1;
   th->step_pc = sh_get_next_pc (&th->context);
   th->step_prev = 0;
+  th->bp_pc = th->step_pc;
+  BREAKPOINT_FROM_PC (&th->bp_pc, &th->bp_len);
   memory_insert_breakpoint (th->step_pc, (void *) &th->step_prev);
   return;
 }
@@ -1024,7 +1032,8 @@ undoSStep (thread_info * th)
 {
   if (th->stepped)
     {
-      memory_remove_breakpoint (th->step_pc, (void *) &th->step_prev);
+      memory_remove_breakpoint (th->bp_pc, th->bp_len,
+				(void *) &th->step_prev);
       th->stepped = 0;
     }
 }
@@ -1048,6 +1057,8 @@ wince_software_single_step (enum target_
   pc = read_register (PC_REGNUM);
   th->step_pc = arm_get_next_pc (pc);
   th->step_prev = 0;
+  th->bp_pc = th->step_pc;
+  BREAKPOINT_FROM_PC (&th->bp_pc, &th->bp_len);
   memory_insert_breakpoint (th->step_pc, (void *) &th->step_prev);
   return;
 }
Index: config/i386/nm-i386.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nm-i386.h,v
retrieving revision 1.7
diff -u -p -r1.7 nm-i386.h
--- config/i386/nm-i386.h	8 Oct 2004 17:30:48 -0000	1.7
+++ config/i386/nm-i386.h	2 Mar 2006 20:40:58 -0000
@@ -58,7 +58,7 @@ extern int i386_insert_hw_breakpoint (CO
 
 /* Remove a hardware-assisted breakpoint at address ADDR.  SHADOW is
    unused. Return 0 on success, -1 on failure.  */
-extern int  i386_remove_hw_breakpoint (CORE_ADDR addr, void *shadow);
+extern int  i386_remove_hw_breakpoint (CORE_ADDR addr, int len, void *shadow);
 
 /* Returns the number of hardware watchpoints of type TYPE that we can
    set.  Value is positive if we can set CNT watchpoints, zero if
@@ -108,8 +108,8 @@ extern int i386_stopped_by_watchpoint (v
 #define target_insert_hw_breakpoint(addr, shadow) \
   i386_insert_hw_breakpoint (addr, shadow)
 
-#define target_remove_hw_breakpoint(addr, shadow) \
-  i386_remove_hw_breakpoint (addr, shadow)
+#define target_remove_hw_breakpoint(addr, len, shadow) \
+  i386_remove_hw_breakpoint (addr, len, shadow)
 
 /* child_post_startup_inferior used to
    reset all debug registers by calling i386_cleanup_dregs ().  */ 
Index: doc/gdbint.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
retrieving revision 1.239
diff -u -p -r1.239 gdbint.texinfo
--- doc/gdbint.texinfo	13 Feb 2006 08:34:11 -0000	1.239
+++ doc/gdbint.texinfo	2 Mar 2006 20:40:59 -0000
@@ -491,9 +491,10 @@ These two macros should return 0 for suc
 @cindex insert or remove hardware breakpoint
 @findex target_remove_hw_breakpoint
 @findex target_insert_hw_breakpoint
-@item target_remove_hw_breakpoint (@var{addr}, @var{shadow})
+@item target_remove_hw_breakpoint (@var{addr}, @var{len}, @var{shadow})
 @itemx target_insert_hw_breakpoint (@var{addr}, @var{shadow})
 Insert or remove a hardware-assisted breakpoint at address @var{addr}.
+@var{len} is the size of breakpoint that was inserted, if known.
 Returns zero for success, non-zero for failure.  @var{shadow} is the
 real contents of the byte where the breakpoint has been inserted; it
 is generally not valid when hardware breakpoints are used, but since
@@ -690,7 +691,7 @@ the count goes to zero.
 @findex i386_insert_hw_breakpoint
 @findex i386_remove_hw_breakpoint
 @item i386_insert_hw_breakpoint (@var{addr}, @var{shadow}
-@itemx i386_remove_hw_breakpoint (@var{addr}, @var{shadow})
+@itemx i386_remove_hw_breakpoint (@var{addr}, @var{len}, @var{shadow})
 These functions insert and remove hardware-assisted breakpoints.  The
 macros @code{target_insert_hw_breakpoint} and
 @code{target_remove_hw_breakpoint} are set to call these functions.
@@ -3061,7 +3062,7 @@ instruction of the architecture.
 Replaces all the other @var{BREAKPOINT} macros.
 
 @item MEMORY_INSERT_BREAKPOINT (@var{addr}, @var{contents_cache})
-@itemx MEMORY_REMOVE_BREAKPOINT (@var{addr}, @var{contents_cache})
+@itemx MEMORY_REMOVE_BREAKPOINT (@var{addr}, @var{len}, @var{contents_cache})
 @findex MEMORY_REMOVE_BREAKPOINT
 @findex MEMORY_INSERT_BREAKPOINT
 Insert or remove memory based breakpoints.  Reasonable defaults


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