]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Merge to branch:
authorDaniel Jacobowitz <drow@false.org>
Tue, 11 Apr 2006 21:58:25 +0000 (21:58 +0000)
committerDaniel Jacobowitz <drow@false.org>
Tue, 11 Apr 2006 21:58:25 +0000 (21:58 +0000)
  http://sourceware.org/ml/gdb-patches/2006-04/msg00139.html

41 files changed:
ChangeLog.csl
gdb/alpha-tdep.c
gdb/arm-tdep.c
gdb/breakpoint.c
gdb/breakpoint.h
gdb/config/i386/nm-i386.h
gdb/corelow.c
gdb/cris-tdep.c
gdb/doc/gdbint.texinfo
gdb/exec.c
gdb/gdbarch.c
gdb/gdbarch.h
gdb/gdbarch.sh
gdb/i386-nat.c
gdb/ia64-tdep.c
gdb/m32r-tdep.c
gdb/mem-break.c
gdb/mips-tdep.c
gdb/monitor.c
gdb/nto-procfs.c
gdb/ocd.c
gdb/ocd.h
gdb/ppc-linux-tdep.c
gdb/ppc-tdep.h
gdb/procfs.c
gdb/remote-e7000.c
gdb/remote-m32r-sdi.c
gdb/remote-mips.c
gdb/remote-rdp.c
gdb/remote-sds.c
gdb/remote-sim.c
gdb/remote-st.c
gdb/remote.c
gdb/rs6000-nat.c
gdb/rs6000-tdep.c
gdb/sol-thread.c
gdb/solib-irix.c
gdb/sparc-tdep.c
gdb/target.c
gdb/target.h
gdb/wince.c

index 05932fb0bd794ab2c87f8e30d350021e098b1be8..9dd5d08f978bec11bdd006127e56ed3a79951ad6 100644 (file)
@@ -1,3 +1,118 @@
+2006-04-11  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * gdb/breakpoint.c (insert_bp_location, reattach_breakpoints)
+       (remove_breakpoint, delete_breakpoint): Update calls to changed
+       methods.
+       (deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint)
+       (single_step_breakpoints, insert_single_step_breakpoint)
+       (remove_single_step_breakpoints): New.
+       * gdb/breakpoint.h (struct bp_location): Add placed_address and
+       placed_size.  Move shadow_contents below the new comment.
+       (deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint)
+       (insert_single_step_breakpoint, remove_single_step_breakpoints): New
+       prototypes.
+       * gdb/gdbarch.sh: Forward struct bp_location in gdbarch.h.
+       (memory_insert_breakpoint, memory_remove_breakpoint): Update second
+       argument.
+       * gdb/mem-break.c (default_memory_insert_breakpoint): Update.  Set
+       placed_address and placed_size.
+       (default_memory_remove_breakpoint): Update.  Don't use
+       BREAKPOINT_FROM_PC.
+       (memory_insert_breakpoint, memory_remove_breakpoint): Update.
+       * gdb/target.c (update_current_target): Update prototypes for changed
+       functions.
+       (debug_to_insert_breakpoint, debug_to_remove_breakpoint)
+       (debug_to_insert_hw_breakpoint, debug_to_remove_hw_breakpoint):
+       Update.
+       * gdb/target.h: Forward declare struct bp_location.
+       (struct target_ops): Use a bp_location argument for
+       to_insert_breakpoint, to_remove_breakpoint,
+       to_insert_hw_breakpoint, and to_remove_hw_breakpoint.
+       (target_insert_breakpoint, target_remove_breakpoint)
+       (target_insert_hw_breakpoint, target_remove_hw_breakpoint)
+       (memory_insert_breakpoint, memory_remove_breakpoint)
+       (default_memory_insert_breakpoint, default_memory_remove_breakpoint):
+       Update.
+       * gdb/config/i386/nm-i386.h: Forward declare struct bp_location.
+       (i386_insert_hw_breakpoint, i386_remove_hw_breakpoint): Update.
+       (target_insert_hw_breakpoint, target_remove_hw_breakpoint): Likewise.
+
+       * gdb/gdbarch.c, gdbarch.h: Regenerated.
+
+       * gdb/alpha-tdep.c (alpha_software_single_step): Use
+       insert_single_step_breakpoint and remove_single_step_breakpoints.
+       Remove unused statics.
+       * gdb/arm-tdep.c (arm_software_single_step): Likewise.  Add a note.
+       * gdb/cris-tdep.c (cris_software_single_step): Likewise.
+       * gdb/mips-tdep.c (mips_software_single_step): Likewise.
+       * gdb/rs6000-tdep.c (rs6000_software_single_step): Likewise.
+       * gdb/sparc-tdep.c (sparc_software_single_step): Likewise.
+       * gdb/wince.c (struct thread_info_struct): Remove step_prev.
+       (undoSStep): Use remove_single_step_breakpoints.
+       (wince_software_single_step): Use insert_single_step_breakpoint.
+
+       * gdb/corelow.c (ignore): Remove unneeded prototype.  Update second
+       argument.
+       * gdb/exec.c (ignore): Likewise.
+       * gdb/sol-thread.c (ignore): Likewise.
+
+       * gdb/procfs.c (dbx_link_bpt_addr, dbx_link_shadow_contents): Delete.
+       (dbx_link_bpt): New.
+       (procfs_wait): Check it.
+       (procfs_mourn_inferior): Remove it if necessary.
+       (remove_dbx_link_breakpoint): Use it.
+       (insert_dbx_link_bpt_in_file): Set it.
+       (procfs_init_inferior): Don't update dbx_link_bpt_addr.
+       * gdb/rs6000-nat.c (exec_one_dummy_insn): Use
+       deprecated_insert_raw_breakpoint and
+       deprecated_remove_raw_breakpoint.
+       * gdb/solib-irix.c (shadow_contents, breakpoint_addr): Delete.
+       (base_breakpoint): New.
+       (disable_break): Use it.
+       (enable_break): Set it.
+
+       * gdb/i386-nat.c (i386_insert_hw_breakpoint, i386_remove_hw_breakpoint):
+       Update.
+       * gdb/ia64-tdep.c (ia64_memory_insert_breakpoint)
+       (ia64_memory_remove_breakpoint): Likewise.
+       * gdb/m32r-tdep.c (m32r_memory_insert_breakpoint)
+       (m32r_memory_remove_breakpoint): Likewise.
+       * gdb/monitor.c (monitor_insert_breakpoint, monitor_remove_breakpoint):
+       Likewise.  Remove unnecessary prototypes.  Use placed_address
+       and placed_size.  Removed useless read from memory.
+       * gdb/nto-procfs.c (procfs_insert_breakpoint)
+       (procfs_remove_breakpoint, procfs_insert_hw_breakpoint)
+       (procfs_remove_hw_breakpoint): Update.
+       * gdb/ocd.c (ocd_insert_breakpoint, ocd_remove_breakpoint): Likewise.
+       * gdb/ocd.h (ocd_insert_breakpoint, ocd_remove_breakpoint): Likewise.
+       * gdb/ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint): Likewise.
+       * gdb/ppc-tdep.h (ppc_linux_memory_remove_breakpoint): Likewise.
+       * gdb/remote-e7000.c (e7000_insert_breakpoint)
+       (e7000_remove_breakpoint): Likewise.
+       * gdb/remote-m32r-sdi.c (m32r_insert_breakpoint)
+       (m32r_remove_breakpoint): Likewise.
+       * gdb/remote-mips.c (mips_insert_breakpoint)
+       (mips_remove_breakpoint): Likewise.
+       * gdb/remote-rdp.c (remote_rdp_insert_breakpoint)
+       (remote_rdp_remove_breakpoint): Likewise.
+       (rdp_step): Use deprecated_insert_raw_breakpoint and
+       deprecated_remove_raw_breakpoint.
+       * gdb/remote-sds.c (sds_insert_breakpoint, sds_remove_breakpoint):
+       Update.
+       * gdb/remote-sim.c (gdbsim_insert_breakpoint, gdbsim_remove_breakpoint):
+       Delete.
+       (init_gdbsim_ops): Use memory_insert_breakpoint and
+       memory_remove_breakpoint.
+       * gdb/remote-st.c (st2000_insert_breakpoint)
+       (st2000_remove_breakpoint): Update.  Remove unused
+       BREAKPOINT_FROM_PC.
+       * gdb/remote.c (remote_insert_breakpoint, remote_remove_breakpoint):
+       Update.  Use placed_address and placed_size.
+       (remote_insert_hw_breakpoint, remote_remove_hw_breakpoint): Likewise.
+
+       * gdb/doc/gdbint.texinfo (Watchpoints, Target Conditionals): Update insert
+       and remove breakpoint prototypes.
+
 2006-04-11  Daniel Jacobowitz  <dan@codesourcery.com>
 
        Backport:
index 960b0514907182c5468393fdf39db596e04ffe2c..4480b21164e3306454800657b53bcd725fc2dd40 100644 (file)
@@ -1493,8 +1493,6 @@ void
 alpha_software_single_step (enum target_signal sig, int insert_breakpoints_p)
 {
   static CORE_ADDR next_pc;
-  typedef char binsn_quantum[BREAKPOINT_MAX];
-  static binsn_quantum break_mem;
   CORE_ADDR pc;
 
   if (insert_breakpoints_p)
@@ -1502,11 +1500,11 @@ alpha_software_single_step (enum target_signal sig, int insert_breakpoints_p)
       pc = read_pc ();
       next_pc = alpha_next_pc (pc);
 
-      target_insert_breakpoint (next_pc, break_mem);
+      insert_single_step_breakpoint (next_pc);
     }
   else
     {
-      target_remove_breakpoint (next_pc, break_mem);
+      remove_single_step_breakpoints ();
       write_pc (next_pc);
     }
 }
index 25a5416c7e090e6b09f37ded2e85d4ce600e1a94..6142feb15a12cfe82846177ffa9f21a88d21607b 100644 (file)
@@ -1901,16 +1901,18 @@ arm_get_next_pc (CORE_ADDR pc)
 static void
 arm_software_single_step (enum target_signal sig, int insert_bpt)
 {
-  static int next_pc;           /* State between setting and unsetting.  */
-  static char break_mem[BREAKPOINT_MAX]; /* Temporary storage for mem@bpt */
+  /* NOTE: This may insert the wrong breakpoint instruction when
+     single-stepping over a mode-changing instruction, if the
+     CPSR heuristics are used.  */
 
   if (insert_bpt)
     {
-      next_pc = arm_get_next_pc (read_register (ARM_PC_REGNUM));
-      target_insert_breakpoint (next_pc, break_mem);
+      CORE_ADDR next_pc = arm_get_next_pc (read_register (ARM_PC_REGNUM));
+
+      insert_single_step_breakpoint (next_pc);
     }
   else
-    target_remove_breakpoint (next_pc, break_mem);
+    remove_single_step_breakpoints ();
 }
 
 #include "bfd-in2.h"
index 472d8d080547e0d4804b90498c44147aaad85396..ea73a12274e0f09e0fa50671a5a1a50b3ebbfeaf 100644 (file)
@@ -804,11 +804,9 @@ insert_bp_location (struct bp_location *bpt,
          /* No overlay handling: just set the breakpoint.  */
 
          if (bpt->loc_type == bp_loc_hardware_breakpoint)
-           val = target_insert_hw_breakpoint (bpt->address, 
-                                              bpt->shadow_contents);
+           val = target_insert_hw_breakpoint (bpt->address, bpt);
          else
-           val = target_insert_breakpoint (bpt->address,
-                                           bpt->shadow_contents);
+           val = target_insert_breakpoint (bpt->address, bpt);
        }
       else
        {
@@ -827,7 +825,7 @@ insert_bp_location (struct bp_location *bpt,
                  CORE_ADDR addr = overlay_unmapped_address (bpt->address,
                                                             bpt->section);
                  /* Set a software (trap) breakpoint at the LMA.  */
-                 val = target_insert_breakpoint (addr, bpt->shadow_contents);
+                 val = target_insert_breakpoint (addr, bpt);
                  if (val != 0)
                    fprintf_unfiltered (tmp_error_stream, 
                                        "Overlay breakpoint %d failed: in ROM?", 
@@ -839,11 +837,9 @@ insert_bp_location (struct bp_location *bpt,
            {
              /* Yes.  This overlay section is mapped into memory.  */
              if (bpt->loc_type == bp_loc_hardware_breakpoint)
-               val = target_insert_hw_breakpoint (bpt->address, 
-                                                  bpt->shadow_contents);
+               val = target_insert_hw_breakpoint (bpt->address, bpt);
              else
-               val = target_insert_breakpoint (bpt->address,
-                                               bpt->shadow_contents);
+               val = target_insert_breakpoint (bpt->address, bpt);
            }
          else
            {
@@ -1045,7 +1041,7 @@ 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. */
-      val = target_insert_breakpoint (bpt->address, bpt->shadow_contents);
+      val = target_insert_breakpoint (bpt->address, bpt);
       if (val)
        {
          /* Couldn't set breakpoint for some reason */
@@ -1240,9 +1236,9 @@ reattach_breakpoints (int pid)
       {
        remove_breakpoint (b, mark_inserted);
        if (b->loc_type == bp_loc_hardware_breakpoint)
-         val = target_insert_hw_breakpoint (b->address, b->shadow_contents);
+         val = target_insert_hw_breakpoint (b->address, b);
        else
-         val = target_insert_breakpoint (b->address, b->shadow_contents);
+         val = target_insert_breakpoint (b->address, b);
        /* FIXME drow/2003-10-07: This doesn't handle any other kinds of
           breakpoints.  It's wrong for watchpoints, for example.  */
        if (val != 0)
@@ -1446,10 +1442,9 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is)
          /* No overlay handling: just remove the breakpoint.  */
 
          if (b->loc_type == bp_loc_hardware_breakpoint)
-           val = target_remove_hw_breakpoint (b->address, 
-                                              b->shadow_contents);
+           val = target_remove_hw_breakpoint (b->address, b);
          else
-           val = target_remove_breakpoint (b->address, b->shadow_contents);
+           val = target_remove_breakpoint (b->address, b);
        }
       else
        {
@@ -1465,9 +1460,9 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is)
                /* 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 (addr, b);
                else
-                 target_remove_breakpoint (addr, b->shadow_contents);
+                 target_remove_breakpoint (addr, b);
              }
          /* Did we set a breakpoint at the VMA? 
             If so, we will have marked the breakpoint 'inserted'.  */
@@ -1478,11 +1473,9 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is)
                 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, 
-                                                  b->shadow_contents);
+               val = target_remove_hw_breakpoint (b->address, b);
              else
-               val = target_remove_breakpoint (b->address,
-                                               b->shadow_contents);
+               val = target_remove_breakpoint (b->address, b);
            }
          else
            {
@@ -1570,8 +1563,7 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is)
           && breakpoint_enabled (b->owner)
           && !b->duplicate)
     {
-
-      val = target_remove_breakpoint (b->address, b->shadow_contents);
+      val = target_remove_breakpoint (b->address, b);
       if (val)
        return val;
       b->inserted = (is == mark_inserted);
@@ -1581,8 +1573,7 @@ remove_breakpoint (struct bp_location *b, insertion_state_t is)
           && breakpoint_enabled (b->owner)
           && !b->duplicate)
     {
-
-      val = target_remove_breakpoint (b->address, b->shadow_contents);
+      val = target_remove_breakpoint (b->address, b);
       if (val)
        return val;
 
@@ -6853,9 +6844,9 @@ delete_breakpoint (struct breakpoint *bpt)
                            "a permanent breakpoint"));
 
          if (b->type == bp_hardware_breakpoint)
-           val = target_insert_hw_breakpoint (b->loc->address, b->loc->shadow_contents);
+           val = target_insert_hw_breakpoint (b->loc->address, b->loc);
          else
-           val = target_insert_breakpoint (b->loc->address, b->loc->shadow_contents);
+           val = target_insert_breakpoint (b->loc->address, b->loc);
 
          /* If there was an error in the insert, print a message, then stop execution.  */
          if (val != 0)
@@ -7658,6 +7649,109 @@ decode_line_spec_1 (char *string, int funfirstline)
     error (_("Junk at end of line specification: %s"), string);
   return sals;
 }
+
+/* Create and insert a raw software breakpoint at PC.  This is the only place
+   besides set_raw_breakpoint that allocates a breakpoint; it should be
+   eliminated someday.  */
+
+struct breakpoint *
+deprecated_insert_raw_breakpoint (CORE_ADDR pc)
+{
+  struct breakpoint *b;
+
+  b = xmalloc (sizeof (struct breakpoint));
+  memset (b, 0, sizeof (struct breakpoint));
+
+  b->loc = xmalloc (sizeof (struct bp_location));
+  memset (b->loc, 0, sizeof (struct bp_location));
+  b->loc->owner = b;
+  b->loc->loc_type = bp_loc_software_breakpoint;
+
+  /* We don't bother with adjust_breakpoint_address here, but it
+     would presumably be harmless to do so.  */
+  b->loc->requested_address = pc;
+  b->loc->address = b->loc->requested_address;
+
+  b->type = bp_breakpoint;
+  b->thread = -1;
+  b->enable_state = bp_enabled;
+
+  if (target_insert_breakpoint (b->loc->address, b->loc) != 0)
+    {
+      /* Could not insert the breakpoint.  */
+      xfree (b->loc);
+      xfree (b);
+      return NULL;
+    }
+
+  return b;
+}
+
+/* Remove a breakpoint B inserted by deprecated_insert_raw_breakpoint.  */
+
+int
+deprecated_remove_raw_breakpoint (struct breakpoint *b)
+{
+  int ret;
+
+  ret = target_remove_breakpoint (b->loc->address, b->loc);
+  xfree (b->loc);
+  xfree (b);
+
+  return ret;
+}
+
+/* One (or perhaps two) breakpoints used for software single stepping.  */
+
+static struct breakpoint *single_step_breakpoints[2];
+
+/* Create and insert a breakpoint for software single step.  */
+
+void
+insert_single_step_breakpoint (CORE_ADDR next_pc)
+{
+  struct breakpoint **bpt_p;
+
+  if (single_step_breakpoints[0] == NULL)
+    bpt_p = &single_step_breakpoints[0];
+  else
+    {
+      gdb_assert (single_step_breakpoints[1] == NULL);
+      bpt_p = &single_step_breakpoints[1];
+    }
+
+  /* NOTE drow/2006-04-11: A future improvement to this function would be
+     to only create the breakpoints once, and actually put them on the
+     breakpoint chain.  That would let us use set_raw_breakpoint.  We could
+     adjust the addresses each time they were needed.  Doing this requires
+     corresponding changes elsewhere where single step breakpoints are
+     handled, however.  So, for now, we use this.  */
+
+  *bpt_p = deprecated_insert_raw_breakpoint (next_pc);
+  if (*bpt_p == NULL)
+    warning (_("Could not insert single-step breakpoint at 0x%s"),
+            paddr_nz (next_pc));
+}
+
+/* Remove and delete any breakpoints used for software single step.  */
+
+void
+remove_single_step_breakpoints (void)
+{
+  gdb_assert (single_step_breakpoints[0] != NULL);
+
+  /* See insert_single_step_breakpoint for more about this deprecated
+     call.  */
+  deprecated_remove_raw_breakpoint (single_step_breakpoints[0]);
+  single_step_breakpoints[0] = NULL;
+
+  if (single_step_breakpoints[1] != NULL)
+    {
+      deprecated_remove_raw_breakpoint (single_step_breakpoints[1]);
+      single_step_breakpoints[1] = NULL;
+    }
+}
+
 \f
 /* This help string is used for the break, hbreak, tbreak and thbreak commands.
    It is defined as a macro to prevent duplication.
index d1e2fd8a484b35d83d07400b39e8f3b167493a44..8f6db77bf0dd366e88438ca75a58789cf50674e8 100644 (file)
@@ -242,13 +242,6 @@ struct bp_location
      associated with the address.  Used primarily for overlay debugging.  */
   asection *section;
 
-  /* "Real" contents of byte where breakpoint has been inserted.
-     Valid only when breakpoints are in the program.  Under the complete
-     control of the target insert_breakpoint and remove_breakpoint routines.
-     No other code should assume anything about the value(s) here.
-     Valid only for bp_loc_software_breakpoint.  */
-  gdb_byte shadow_contents[BREAKPOINT_MAX];
-
   /* Address at which breakpoint was requested, either by the user or
      by GDB for internal breakpoints.  This will usually be the same
      as ``address'' (above) except for cases in which
@@ -256,6 +249,27 @@ struct bp_location
      which to place the breakpoint in order to comply with a
      processor's architectual constraints.  */
   CORE_ADDR requested_address;
+
+  /* The members after this point are only set or read by the target's
+     insert and remove methods, for its own purposes.  Any which the
+     insert method does not set, the remove method should not read.
+     Nothing besides the target should access these!  */
+
+  /* "Real" contents of byte where breakpoint has been inserted.
+     Valid only when breakpoints are in the program.  Under the complete
+     control of the target insert_breakpoint and remove_breakpoint routines.
+     No other code should assume anything about the value(s) here.
+     Valid only for bp_loc_software_breakpoint.  */
+  gdb_byte shadow_contents[BREAKPOINT_MAX];
+
+  /* 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,
@@ -796,6 +810,16 @@ extern void delete_command (char *arg, int from_tty);
    remove fails. */
 extern int remove_hw_watchpoints (void);
 
+/* Manage a software single step breakpoint (or two).  Insert may be called
+   twice before remove is called.  */
+extern void insert_single_step_breakpoint (CORE_ADDR);
+extern void remove_single_step_breakpoints (void);
+
+/* Manage manual breakpoints, separate from the normal chain of
+   breakpoints.  These functions are used in murky target-specific
+   ways.  Please do not add more uses!  */
+extern struct breakpoint *deprecated_insert_raw_breakpoint (CORE_ADDR);
+extern int deprecated_remove_raw_breakpoint (struct breakpoint *);
 
 /* Indicator of whether exception catchpoints should be nuked between
    runs of a program.  */
index 265c8e04d367f957babd308edd85175eec524415..d74e0072a01c23850b0be675468f2119fbe4fc0a 100644 (file)
@@ -52,13 +52,16 @@ extern int i386_stopped_by_hwbp (void);
    true.  Otherwise, return false.  */
 extern int i386_stopped_data_address (CORE_ADDR *);
 
-/* Insert a hardware-assisted breakpoint at address ADDR.  SHADOW is
+/* Insert a hardware-assisted breakpoint at address ADDR.  BPT is
    unused.  Return 0 on success, EBUSY on failure.  */
-extern int i386_insert_hw_breakpoint (CORE_ADDR addr, void *shadow);
+struct bp_location;
+extern int i386_insert_hw_breakpoint (CORE_ADDR addr,
+                                     struct bp_location *bpt);
 
-/* Remove a hardware-assisted breakpoint at address ADDR.  SHADOW is
+/* Remove a hardware-assisted breakpoint at address ADDR.  BPT 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,
+                                      struct bp_location *bpt);
 
 /* Returns the number of hardware watchpoints of type TYPE that we can
    set.  Value is positive if we can set CNT watchpoints, zero if
@@ -105,11 +108,11 @@ extern int i386_stopped_by_watchpoint (void);
 #define target_remove_watchpoint(addr, len, type) \
   i386_remove_watchpoint (addr, len, type)
 
-#define target_insert_hw_breakpoint(addr, shadow) \
-  i386_insert_hw_breakpoint (addr, shadow)
+#define target_insert_hw_breakpoint(addr, bpt) \
+  i386_insert_hw_breakpoint (addr, bpt)
 
-#define target_remove_hw_breakpoint(addr, shadow) \
-  i386_remove_hw_breakpoint (addr, shadow)
+#define target_remove_hw_breakpoint(addr, bpt) \
+  i386_remove_hw_breakpoint (addr, bpt)
 
 /* child_post_startup_inferior used to
    reset all debug registers by calling i386_cleanup_dregs ().  */ 
index 226b48b50574b1ed62d4446130831e22e0abc64c..8fb6b1a28f19b55dc0391dbe421cd7c74637ea01 100644 (file)
@@ -86,8 +86,6 @@ static void get_core_registers (int);
 
 static void add_to_thread_list (bfd *, asection *, void *);
 
-static int ignore (CORE_ADDR, bfd_byte *);
-
 static int core_file_thread_alive (ptid_t tid);
 
 static void init_core_ops (void);
@@ -603,7 +601,7 @@ core_xfer_partial (struct target_ops *ops, enum target_object object,
    `gdb internal error' (since generic_mourn calls breakpoint_init_inferior).  */
 
 static int
-ignore (CORE_ADDR addr, bfd_byte *contents)
+ignore (CORE_ADDR addr, struct bp_location *bpt)
 {
   return 0;
 }
index 0664318d654477c31d2ad4d6adb10f831a97c30d..bb8eada3b6ba82e987f9cb23442a3626d4b12406 100644 (file)
@@ -558,15 +558,6 @@ struct instruction_environment
   int   disable_interrupt;
 } inst_env_type;
 
-/* Save old breakpoints in order to restore the state before a single_step. 
-   At most, two breakpoints will have to be remembered.  */
-typedef 
-char binsn_quantum[BREAKPOINT_MAX];
-static binsn_quantum break_mem[2];
-static CORE_ADDR next_pc = 0;
-static CORE_ADDR branch_target_address = 0;
-static unsigned char branch_break_inserted = 0;
-
 /* Machine-dependencies in CRIS for opcodes.  */
 
 /* Instruction sizes.  */
@@ -2129,7 +2120,7 @@ static void
 cris_software_single_step (enum target_signal ignore, int insert_breakpoints)
 {
   inst_env_type inst_env;
-  
+
   if (insert_breakpoints)
     {
       /* Analyse the present instruction environment and insert 
@@ -2145,28 +2136,19 @@ cris_software_single_step (enum target_signal ignore, int insert_breakpoints)
         {
           /* 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];
-          target_insert_breakpoint (next_pc, break_mem[0]);
+          CORE_ADDR next_pc = (CORE_ADDR) inst_env.reg[PC_REGNUM];
+          insert_single_step_breakpoint (next_pc);
           if (inst_env.branch_found 
               && (CORE_ADDR) inst_env.branch_break_address != next_pc)
             {
-              branch_target_address = 
-                (CORE_ADDR) inst_env.branch_break_address;
-              target_insert_breakpoint (branch_target_address, break_mem[1]);
-              branch_break_inserted = 1;
+              CORE_ADDR branch_target_address
+                = (CORE_ADDR) inst_env.branch_break_address;
+              insert_single_step_breakpoint (branch_target_address);
             }
         }
     }
   else
-    {
-      /* Remove breakpoints.  */
-      target_remove_breakpoint (next_pc, break_mem[0]);
-      if (branch_break_inserted)
-        {
-          target_remove_breakpoint (branch_target_address, break_mem[1]);
-          branch_break_inserted = 0;
-        }
-    }
+    remove_single_step_breakpoints ();
 }
 
 /* Calculates the prefix value for quick offset addressing mode.  */
index 8389f8fe9a89c79aeb8bdd6c9370eb7a115db226..ae3ea0cc42c486d7955d351068bbbea774d14aea 100644 (file)
@@ -491,10 +491,11 @@ These two macros should return 0 for success, non-zero for failure.
 @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})
-@itemx target_insert_hw_breakpoint (@var{addr}, @var{shadow})
+@item target_remove_hw_breakpoint (@var{addr}, @var{bpt})
+@itemx target_insert_hw_breakpoint (@var{addr}, @var{bpt})
 Insert or remove a hardware-assisted breakpoint at address @var{addr}.
-Returns zero for success, non-zero for failure.  @var{shadow} is the
+Returns zero for success, non-zero for failure.  @var{bpt} is the
+breakpoint location.  @code{@var{bpt}->shadow_contents} 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
 no other code touches these values, the implementations of the above
@@ -689,8 +690,8 @@ 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})
+@item i386_insert_hw_breakpoint (@var{addr}, @var{bpt})
+@itemx i386_remove_hw_breakpoint (@var{addr}, @var{bpt})
 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.
@@ -3060,8 +3061,8 @@ 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})
+@item MEMORY_INSERT_BREAKPOINT (@var{addr}, @var{bpt})
+@itemx MEMORY_REMOVE_BREAKPOINT (@var{addr}, @var{len}, @var{bpt})
 @findex MEMORY_REMOVE_BREAKPOINT
 @findex MEMORY_INSERT_BREAKPOINT
 Insert or remove memory based breakpoints.  Reasonable defaults
index 248f7ee22d7588b1ac9cc4e4f7303ea5a511c253..a919442632c1a11bc45c129912ac691fb2f4af86 100644 (file)
@@ -59,8 +59,6 @@ static void set_section_command (char *, int);
 
 static void exec_files_info (struct target_ops *);
 
-static int ignore (CORE_ADDR, bfd_byte *);
-
 static void init_exec_ops (void);
 
 void _initialize_exec (void);
@@ -691,7 +689,7 @@ exec_set_section_address (const char *filename, int index, CORE_ADDR address)
    breakpoint_init_inferior).  */
 
 static int
-ignore (CORE_ADDR addr, bfd_byte *contents)
+ignore (CORE_ADDR addr, struct bp_location *bpt)
 {
   return 0;
 }
index c3959db7c655fbf29a2e79d8f82aaeeee5cb4ead..d8aa12e6926be9bcd3b8395b92512721efd8d373 100644 (file)
@@ -1261,8 +1261,8 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file)
 #ifdef MEMORY_INSERT_BREAKPOINT
   fprintf_unfiltered (file,
                       "gdbarch_dump: %s # %s\n",
-                      "MEMORY_INSERT_BREAKPOINT(addr, contents_cache)",
-                      XSTRING (MEMORY_INSERT_BREAKPOINT (addr, contents_cache)));
+                      "MEMORY_INSERT_BREAKPOINT(addr, bpt)",
+                      XSTRING (MEMORY_INSERT_BREAKPOINT (addr, bpt)));
 #endif
   fprintf_unfiltered (file,
                       "gdbarch_dump: memory_insert_breakpoint = <0x%lx>\n",
@@ -1270,8 +1270,8 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file)
 #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, bpt)",
+                      XSTRING (MEMORY_REMOVE_BREAKPOINT (addr, bpt)));
 #endif
   fprintf_unfiltered (file,
                       "gdbarch_dump: memory_remove_breakpoint = <0x%lx>\n",
@@ -2953,13 +2953,13 @@ set_gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch,
 }
 
 int
-gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, gdb_byte *contents_cache)
+gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, struct bp_location *bpt)
 {
   gdb_assert (gdbarch != NULL);
   gdb_assert (gdbarch->memory_insert_breakpoint != NULL);
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_memory_insert_breakpoint called\n");
-  return gdbarch->memory_insert_breakpoint (addr, contents_cache);
+  return gdbarch->memory_insert_breakpoint (addr, bpt);
 }
 
 void
@@ -2970,13 +2970,13 @@ set_gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch,
 }
 
 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, struct bp_location *bpt)
 {
   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, bpt);
 }
 
 void
index dc1b1a99adf5c1ddf0ae10b2b065b3aa28394456..706b628e077e4212f41345042f2e78f54c58e3ae 100644 (file)
@@ -49,6 +49,7 @@ struct regset;
 struct disassemble_info;
 struct target_ops;
 struct obstack;
+struct bp_location;
 struct gdb_feature_set;
 
 extern struct gdbarch *current_gdbarch;
@@ -900,24 +901,24 @@ typedef CORE_ADDR (gdbarch_adjust_breakpoint_address_ftype) (struct gdbarch *gdb
 extern CORE_ADDR gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr);
 extern void set_gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, gdbarch_adjust_breakpoint_address_ftype *adjust_breakpoint_address);
 
-typedef int (gdbarch_memory_insert_breakpoint_ftype) (CORE_ADDR addr, gdb_byte *contents_cache);
-extern int gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, gdb_byte *contents_cache);
+typedef int (gdbarch_memory_insert_breakpoint_ftype) (CORE_ADDR addr, struct bp_location *bpt);
+extern int gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, struct bp_location *bpt);
 extern void set_gdbarch_memory_insert_breakpoint (struct gdbarch *gdbarch, gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint);
 #if !defined (GDB_TM_FILE) && defined (MEMORY_INSERT_BREAKPOINT)
 #error "Non multi-arch definition of MEMORY_INSERT_BREAKPOINT"
 #endif
 #if !defined (MEMORY_INSERT_BREAKPOINT)
-#define MEMORY_INSERT_BREAKPOINT(addr, contents_cache) (gdbarch_memory_insert_breakpoint (current_gdbarch, addr, contents_cache))
+#define MEMORY_INSERT_BREAKPOINT(addr, bpt) (gdbarch_memory_insert_breakpoint (current_gdbarch, addr, bpt))
 #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, struct bp_location *bpt);
+extern int gdbarch_memory_remove_breakpoint (struct gdbarch *gdbarch, CORE_ADDR addr, struct bp_location *bpt);
 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, bpt) (gdbarch_memory_remove_breakpoint (current_gdbarch, addr, bpt))
 #endif
 
 extern CORE_ADDR gdbarch_decr_pc_after_break (struct gdbarch *gdbarch);
index 39914dd88965f1ffd8d99befa824357d40cdb380..68b3fabcfba65bc7096678fcb845496f505a5b96 100755 (executable)
@@ -549,8 +549,8 @@ f:=:CORE_ADDR:skip_prologue:CORE_ADDR ip:ip:0:0
 f:=:int:inner_than:CORE_ADDR lhs, CORE_ADDR rhs:lhs, rhs:0:0
 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_insert_breakpoint:CORE_ADDR addr, struct bp_location *bpt:addr, bpt:0:default_memory_insert_breakpoint::0
+f:=:int:memory_remove_breakpoint:CORE_ADDR addr, struct bp_location *bpt:addr, bpt: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
@@ -777,6 +777,7 @@ struct regset;
 struct disassemble_info;
 struct target_ops;
 struct obstack;
+struct bp_location;
 struct gdb_feature_set;
 
 extern struct gdbarch *current_gdbarch;
index 770b66d3987109879c7a088521169322ef4d6a4c..f5b9f4672eb9ec06a376152135b69af3c3d6324c 100644 (file)
@@ -625,10 +625,10 @@ i386_stopped_by_hwbp (void)
   return 0;
 }
 
-/* Insert a hardware-assisted breakpoint at address ADDR.  SHADOW is
+/* Insert a hardware-assisted breakpoint at address ADDR.  BPT is
    unused.  Return 0 on success, EBUSY on failure.  */
 int
-i386_insert_hw_breakpoint (CORE_ADDR addr, void *shadow)
+i386_insert_hw_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   unsigned len_rw = i386_length_and_rw_bits (1, hw_execute);
   int retval = i386_insert_aligned_watchpoint (addr, len_rw) ? EBUSY : 0;
@@ -639,11 +639,11 @@ i386_insert_hw_breakpoint (CORE_ADDR addr, void *shadow)
   return retval;
 }
 
-/* Remove a hardware-assisted breakpoint at address ADDR.  SHADOW is
+/* Remove a hardware-assisted breakpoint at address ADDR.  BPT is
    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, struct bp_location *bpt)
 {
   unsigned len_rw = i386_length_and_rw_bits (1, hw_execute);
   int retval = i386_remove_aligned_watchpoint (addr, len_rw);
index f302142e9fec18c05382d1c58f59c199cea7df87..7ef7689f7ce9e4f25fe50656ad13f246350962ce 100644 (file)
@@ -550,7 +550,7 @@ fetch_instruction (CORE_ADDR addr, instruction_type *it, long long *instr)
 #define IA64_BREAKPOINT 0x00003333300LL
 
 static int
-ia64_memory_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
+ia64_memory_insert_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   char bundle[BUNDLE_LEN];
   int slotnum = (int) (addr & 0x0f) / SLOT_MULTIPLIER;
@@ -574,7 +574,7 @@ ia64_memory_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
     }
 
   instr = slotN_contents (bundle, slotnum);
-  memcpy(contents_cache, &instr, sizeof(instr));
+  memcpy (bpt->shadow_contents, &instr, sizeof (instr));
   replace_slotN_contents (bundle, IA64_BREAKPOINT, slotnum);
   if (val == 0)
     target_write_memory (addr, bundle, BUNDLE_LEN);
@@ -583,7 +583,7 @@ ia64_memory_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
 }
 
 static int
-ia64_memory_remove_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
+ia64_memory_remove_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   char bundle[BUNDLE_LEN];
   int slotnum = (addr & 0x0f) / SLOT_MULTIPLIER;
@@ -603,7 +603,7 @@ ia64_memory_remove_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
       slotnum = 2;
     }
 
-  memcpy (&instr, contents_cache, sizeof instr);
+  memcpy (&instr, bpt->shadow_contents, sizeof instr);
   replace_slotN_contents (bundle, instr, slotnum);
   if (val == 0)
     target_write_memory (addr, bundle, BUNDLE_LEN);
index c95dbd10c3b8e7b53d663bbdb629065fa0303715..ce5e392a442b760f0ca5126ebf3d21733ceec98a 100644 (file)
@@ -81,10 +81,11 @@ m32r_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
    The following functions take care of this behavior. */
 
 static int
-m32r_memory_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
+m32r_memory_insert_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   int val;
   gdb_byte buf[4];
+  gdb_byte *contents_cache = bpt->shadow_contents;
   gdb_byte bp_entry[] = { 0x10, 0xf1 };        /* dpt */
 
   /* Save the memory contents.  */
@@ -134,10 +135,11 @@ m32r_memory_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
 }
 
 static int
-m32r_memory_remove_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
+m32r_memory_remove_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   int val;
   gdb_byte buf[4];
+  gdb_byte *contents_cache = bpt->shadow_contents;
 
   buf[0] = contents_cache[0];
   buf[1] = contents_cache[1];
index 810f8ae7ce04a7510eff1078cdbfb080e7a5c6af..1bbdbe4914b6d16e70035e8a76f904da72f538cb 100644 (file)
 /* Insert a breakpoint on targets that don't have any better breakpoint
    support.  We read the contents of the target location and stash it,
    then overwrite it with a breakpoint instruction.  ADDR is the target
-   location in the target machine.  CONTENTS_CACHE is a pointer to 
-   memory allocated for saving the target contents.  It is guaranteed
-   by the caller to be long enough to save BREAKPOINT_LEN bytes (this
-   is accomplished via BREAKPOINT_MAX).  */
+   location in the target machine.  BPT is a pointer to the breakpoint
+   location being inserted, which contains some memory allocated for
+   saving the target contents.  It is guaranteed by the caller to be
+   long enough to save BREAKPOINT_LEN bytes (this is accomplished via
+   BREAKPOINT_MAX).  */
 
 int
-default_memory_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
+default_memory_insert_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   int val;
   const unsigned char *bp;
@@ -54,7 +55,9 @@ default_memory_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
     error (_("Software breakpoints not implemented for this target."));
 
   /* Save the memory contents.  */
-  val = target_read_memory (addr, contents_cache, bplen);
+  bpt->placed_address = addr;
+  bpt->placed_size = bplen;
+  val = target_read_memory (addr, bpt->shadow_contents, bplen);
 
   /* Write the breakpoint.  */
   if (val == 0)
@@ -65,28 +68,21 @@ default_memory_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
 
 
 int
-default_memory_remove_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
+default_memory_remove_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
-  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 (bpt->placed_address, bpt->shadow_contents,
+                             bpt->placed_size);
 }
 
 
 int
-memory_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
+memory_insert_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
-  return MEMORY_INSERT_BREAKPOINT(addr, contents_cache);
+  return MEMORY_INSERT_BREAKPOINT (addr, bpt);
 }
 
 int
-memory_remove_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
+memory_remove_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
-  return MEMORY_REMOVE_BREAKPOINT(addr, contents_cache);
+  return MEMORY_REMOVE_BREAKPOINT (addr, bpt);
 }
index 880dfcc34946c124a5abfc5c4d61ab5c6a8479b9..dcb440607180a5cd94cdb2b7310306c9c0c48317 100644 (file)
@@ -2188,20 +2188,17 @@ mips_addr_bits_remove (CORE_ADDR addr)
 void
 mips_software_single_step (enum target_signal sig, int insert_breakpoints_p)
 {
-  static CORE_ADDR next_pc;
-  typedef char binsn_quantum[BREAKPOINT_MAX];
-  static binsn_quantum break_mem;
-  CORE_ADDR pc;
+  CORE_ADDR pc, next_pc;
 
   if (insert_breakpoints_p)
     {
       pc = read_register (mips_regnum (current_gdbarch)->pc);
       next_pc = mips_next_pc (pc);
 
-      target_insert_breakpoint (next_pc, break_mem);
+      insert_single_step_breakpoint (next_pc);
     }
   else
-    target_remove_breakpoint (next_pc, break_mem);
+    remove_single_step_breakpoints ();
 }
 
 /* Test whether the PC points to the return instruction at the
index 3b7619e67a7fa87991c5d7503b20ce22a79a505f..0ce7a816fbea21dc453607d99889f3ccd3c6947c 100644 (file)
@@ -85,8 +85,6 @@ static int monitor_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
                                struct mem_attrib *attrib,
                                struct target_ops *target);
 static void monitor_files_info (struct target_ops *ops);
-static int monitor_insert_breakpoint (CORE_ADDR addr, gdb_byte *shadow);
-static int monitor_remove_breakpoint (CORE_ADDR addr, gdb_byte *shadow);
 static void monitor_kill (void);
 static void monitor_load (char *file, int from_tty);
 static void monitor_mourn_inferior (void);
@@ -2037,7 +2035,7 @@ monitor_mourn_inferior (void)
 /* Tell the monitor to add a breakpoint.  */
 
 static int
-monitor_insert_breakpoint (CORE_ADDR addr, gdb_byte *shadow)
+monitor_insert_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   int i;
   const unsigned char *bp;
@@ -2052,13 +2050,14 @@ monitor_insert_breakpoint (CORE_ADDR addr, gdb_byte *shadow)
 
   /* Determine appropriate breakpoint size for this address.  */
   bp = gdbarch_breakpoint_from_pc (current_gdbarch, &addr, &bplen);
+  bpt->placed_address = addr;
+  bpt->placed_size = bplen;
 
   for (i = 0; i < current_monitor->num_breakpoints; i++)
     {
       if (breakaddr[i] == 0)
        {
          breakaddr[i] = addr;
-         monitor_read_memory (addr, shadow, bplen);
          monitor_printf (current_monitor->set_break, addr);
          monitor_expect_prompt (NULL, 0);
          return 0;
@@ -2071,7 +2070,7 @@ monitor_insert_breakpoint (CORE_ADDR addr, gdb_byte *shadow)
 /* Tell the monitor to remove a breakpoint.  */
 
 static int
-monitor_remove_breakpoint (CORE_ADDR addr, gdb_byte *shadow)
+monitor_remove_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   int i;
 
@@ -2079,8 +2078,7 @@ monitor_remove_breakpoint (CORE_ADDR addr, gdb_byte *shadow)
   if (current_monitor->clr_break == NULL)
     error (_("No clr_break defined for this monitor"));
 
-  if (current_monitor->flags & MO_ADDR_BITS_REMOVE)
-    addr = ADDR_BITS_REMOVE (addr);
+  addr = bpt->placed_address;
 
   for (i = 0; i < current_monitor->num_breakpoints; i++)
     {
index 7854d2a987e698934b2114bb54ec767848e6d9c7..f95d78b88c84279229aac3613a52b995e11fcb45 100644 (file)
@@ -76,10 +76,6 @@ static ptid_t do_attach (ptid_t ptid);
 
 static int procfs_can_use_hw_breakpoint (int, int, int);
 
-static int procfs_insert_hw_breakpoint (CORE_ADDR, char *);
-
-static int procfs_remove_hw_breakpoint (CORE_ADDR addr, char *);
-
 static int procfs_insert_hw_watchpoint (CORE_ADDR addr, int len, int type);
 
 static int procfs_remove_hw_watchpoint (CORE_ADDR addr, int len, int type);
@@ -812,25 +808,25 @@ procfs_breakpoint (CORE_ADDR addr, int type, int size)
 }
 
 static int
-procfs_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
+procfs_insert_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   return procfs_breakpoint (addr, _DEBUG_BREAK_EXEC, 0);
 }
 
 static int
-procfs_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
+procfs_remove_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   return procfs_breakpoint (addr, _DEBUG_BREAK_EXEC, -1);
 }
 
 static int
-procfs_insert_hw_breakpoint (CORE_ADDR addr, char *contents_cache)
+procfs_insert_hw_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   return procfs_breakpoint (addr, _DEBUG_BREAK_EXEC | _DEBUG_BREAK_HW, 0);
 }
 
 static int
-procfs_remove_hw_breakpoint (CORE_ADDR addr, char *contents_cache)
+procfs_remove_hw_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   return procfs_breakpoint (addr, _DEBUG_BREAK_EXEC | _DEBUG_BREAK_HW, -1);
 }
index 79726d23011b406a6333abb1403df39e7a633289..d756276a7d16afc65e1dbf519659960db0e54c37 100644 (file)
--- a/gdb/ocd.c
+++ b/gdb/ocd.c
@@ -1048,12 +1048,12 @@ ocd_load (char *args, int from_tty)
 /* BDM (at least on CPU32) uses a different breakpoint */
 
 int
-ocd_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
+ocd_insert_breakpoint (CORE_ADDR addr, struct bpt_location *bpt)
 {
   static char break_insn[] = BDM_BREAKPOINT;
   int val;
 
-  val = target_read_memory (addr, contents_cache, sizeof (break_insn));
+  val = target_read_memory (addr, bpt->shadow_contents, sizeof (break_insn));
 
   if (val == 0)
     val = target_write_memory (addr, break_insn, sizeof (break_insn));
@@ -1062,12 +1062,12 @@ ocd_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
 }
 
 int
-ocd_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
+ocd_remove_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   static char break_insn[] = BDM_BREAKPOINT;
   int val;
 
-  val = target_write_memory (addr, contents_cache, sizeof (break_insn));
+  val = target_write_memory (addr, bpt->shadow_contents, sizeof (break_insn));
 
   return val;
 }
index 35b555b1b3208dd7c2d165852cbf2bd53c614d45..dc31b6b02accb7e12331de7bff5b9bd4f0bbfd5a 100644 (file)
--- a/gdb/ocd.h
+++ b/gdb/ocd.h
@@ -135,8 +135,8 @@ void ocd_write_bdm_register (int bdm_regno, CORE_ADDR 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_insert_breakpoint (CORE_ADDR addr, struct bp_location *bpt);
+int ocd_remove_breakpoint (CORE_ADDR addr, struct bp_location *bpt);
 
 int ocd_write_bytes (CORE_ADDR memaddr, char *myaddr, int len);
 
index 045208498269a41fed97135e4aaec27aac77ec63..398b38889ffec30041b138ddde6407fdf69a2ff4 100644 (file)
@@ -457,8 +457,7 @@ ppc_linux_skip_trampoline_code (CORE_ADDR pc)
    regard to removing breakpoints in some potentially self modifying
    code.  */
 int
-ppc_linux_memory_remove_breakpoint (CORE_ADDR addr,
-                                   gdb_byte *contents_cache)
+ppc_linux_memory_remove_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   const unsigned char *bp;
   int val;
@@ -476,7 +475,7 @@ ppc_linux_memory_remove_breakpoint (CORE_ADDR addr,
      program modified the code on us, so it is wrong to put back the
      old value */
   if (val == 0 && memcmp (bp, old_contents, bplen) == 0)
-    val = target_write_memory (addr, contents_cache, bplen);
+    val = target_write_memory (addr, bpt->shadow_contents, bplen);
 
   return val;
 }
index 1a25648c0f3d40d03710e6753b3648ae94c33ae0..0fb2672b6077b59b4b2380e1baaee09cfd663af1 100644 (file)
@@ -57,7 +57,7 @@ CORE_ADDR ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch,
 CORE_ADDR ppc64_sysv_abi_adjust_breakpoint_address (struct gdbarch *gdbarch,
                                                    CORE_ADDR bpaddr);
 int ppc_linux_memory_remove_breakpoint (CORE_ADDR addr,
-                                       gdb_byte *contents_cache);
+                                       struct bp_location *bpt);
 struct link_map_offsets *ppc_linux_svr4_fetch_link_map_offsets (void);
 void ppc_linux_supply_gregset (struct regcache *regcache,
                               int regnum, const void *gregs, size_t size,
index 143a63975dcc55eaa3111eb0e6f4d6b1b6324f68..67fcb92a4c67aef62795c9a023afe8d4bf9a5734 100644 (file)
@@ -3371,11 +3371,8 @@ static int insert_dbx_link_breakpoint (procinfo *pi);
 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.  */
-static int dbx_link_bpt_addr = 0;
-static char dbx_link_shadow_contents[BREAKPOINT_MAX];
+   the startup phase.  */
+static struct breakpoint *dbx_link_bpt;
 
 /*
  * Function: procfs_debug_inferior
@@ -4207,8 +4204,8 @@ wait_again:
                   /* If we hit our __dbx_link() internal breakpoint,
                      then remove it.  See comments in procfs_init_inferior()
                      for more details.  */
-                  if (dbx_link_bpt_addr != 0
-                      && dbx_link_bpt_addr == read_pc ())
+                 if (dbx_link_bpt != NULL
+                     && dbx_link_bpt->loc->address == read_pc ())
                     remove_dbx_link_breakpoint ();
 
                  wstat = (SIGTRAP << 8) | 0177;
@@ -4777,6 +4774,13 @@ procfs_mourn_inferior (void)
        destroy_procinfo (pi);
     }
   unpush_target (&procfs_ops);
+
+  if (dbx_link_bpt != NULL)
+    {
+      deprecated_remove_raw_breakpoint (dbx_link_bpt);
+      dbx_link_bpt = NULL;
+    }
+
   generic_mourn_inferior ();
 }
 
@@ -4886,7 +4890,6 @@ procfs_init_inferior (int pid)
      has been inserted, the syssgi() notifications are no longer necessary,
      so they should be canceled.  */
   proc_trace_syscalls_1 (pi, SYS_syssgi, PR_SYSEXIT, FLAG_SET, 0);
-  dbx_link_bpt_addr = 0;
 #endif
 }
 
@@ -5568,14 +5571,13 @@ proc_find_memory_regions (int (*func) (CORE_ADDR,
 static void
 remove_dbx_link_breakpoint (void)
 {
-  if (dbx_link_bpt_addr == 0)
+  if (dbx_link_bpt == NULL)
     return;
 
-  if (memory_remove_breakpoint (dbx_link_bpt_addr,
-                                dbx_link_shadow_contents) != 0)
+  if (deprecated_remove_raw_breakpoint (dbx_link_bpt) != 0)
     warning (_("Unable to remove __dbx_link breakpoint."));
 
-  dbx_link_bpt_addr = 0;
+  dbx_link_bpt = NULL;
 }
 
 /* Return the address of the __dbx_link() function in the file
@@ -5642,8 +5644,8 @@ insert_dbx_link_bpt_in_file (int fd, CORE_ADDR ignored)
   if (sym_addr != 0)
     {
       /* Insert the breakpoint.  */
-      dbx_link_bpt_addr = sym_addr;
-      if (target_insert_breakpoint (sym_addr, dbx_link_shadow_contents) != 0)
+      dbx_link_bpt = deprecated_insert_raw_breakpoint (sym_addr);
+      if (dbx_link_bpt == NULL)
         {
           warning (_("Failed to insert dbx_link breakpoint."));
           bfd_close (abfd);
index 09a9460669a93e8d7c221dfb939b13795d0570b9..88082f8cb0adc1213a578e6a87e0d40fc84cfa37 100644 (file)
@@ -1702,7 +1702,7 @@ static CORE_ADDR breakaddr[MAX_BREAKPOINTS] =
 {0};
 
 static int
-e7000_insert_breakpoint (CORE_ADDR addr, bfd_byte *shadow)
+e7000_insert_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   int i;
   char buf[200];
@@ -1728,7 +1728,7 @@ e7000_insert_breakpoint (CORE_ADDR addr, bfd_byte *shadow)
          }
 #else
 #if 0
-       e7000_read_inferior_memory (addr, shadow, 2);
+       e7000_read_inferior_memory (addr, bpt->shadow_contents, 2);
        e7000_write_inferior_memory (addr, nop, 2);
 #endif
 
@@ -1745,7 +1745,7 @@ e7000_insert_breakpoint (CORE_ADDR addr, bfd_byte *shadow)
 }
 
 static int
-e7000_remove_breakpoint (CORE_ADDR addr, bfd_byte *shadow)
+e7000_remove_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   int i;
   char buf[200];
@@ -1773,7 +1773,7 @@ e7000_remove_breakpoint (CORE_ADDR addr, bfd_byte *shadow)
 
 #if 0
        /* Replace the insn under the break */
-       e7000_write_inferior_memory (addr, shadow, 2);
+       e7000_write_inferior_memory (addr, bpt->shadow_contents, 2);
 #endif
 #endif
 
index 9ef526f43717400cc5d10cabaf0ba467646fbf05..3efdaf16a2f73aff523b79ad529269d9d79e23dc 100644 (file)
@@ -1141,15 +1141,15 @@ m32r_mourn_inferior (void)
 }
 
 static int
-m32r_insert_breakpoint (CORE_ADDR addr, bfd_byte *shadow)
+m32r_insert_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   int ib_breakpoints;
   unsigned char buf[13];
   int i, c;
 
   if (remote_debug)
-    fprintf_unfiltered (gdb_stdlog, "m32r_insert_breakpoint(%08lx,\"%s\")\n",
-                       addr, shadow);
+    fprintf_unfiltered (gdb_stdlog, "m32r_insert_breakpoint(%08lx,...)\n",
+                       addr);
 
   if (use_ib_breakpoints)
     ib_breakpoints = max_ib_breakpoints;
@@ -1183,13 +1183,13 @@ m32r_insert_breakpoint (CORE_ADDR addr, bfd_byte *shadow)
 }
 
 static int
-m32r_remove_breakpoint (CORE_ADDR addr, bfd_byte *shadow)
+m32r_remove_breakpoint (CORE_ADDR addr, int len, struct bp_location *bpt)
 {
   int i;
 
   if (remote_debug)
-    fprintf_unfiltered (gdb_stdlog, "m32r_remove_breakpoint(%08lx,\"%s\")\n",
-                       addr, shadow);
+    fprintf_unfiltered (gdb_stdlog, "m32r_remove_breakpoint(%08lx)\n",
+                       addr);
 
   for (i = 0; i < MAX_BREAKPOINTS; i++)
     {
index e47aa6e8c99e6271c5741fa9f2f92f89d009ede4..36e15aab067cb9ffe746bda554afb631ebcfe516 100644 (file)
@@ -2216,27 +2216,26 @@ mips_mourn_inferior (void)
 /* Insert a breakpoint.  On targets that don't have built-in
    breakpoint support, we read the contents of the target location and
    stash it, then overwrite it with a breakpoint instruction.  ADDR is
-   the target location in the target machine.  CONTENTS_CACHE is a
-   pointer to memory allocated for saving the target contents.  It is
-   guaranteed by the caller to be long enough to save the breakpoint
-   length returned by BREAKPOINT_FROM_PC.  */
+   the target location in the target machine.  BPT is the breakpoint
+   being inserted or removed, which contains memory for saving the
+   target contents.  */
 
 static int
-mips_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
+mips_insert_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   if (monitor_supports_breakpoints)
     return set_breakpoint (addr, MIPS_INSN32_SIZE, BREAK_FETCH);
   else
-    return memory_insert_breakpoint (addr, contents_cache);
+    return memory_insert_breakpoint (addr, bpt);
 }
 
 static int
-mips_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
+mips_remove_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   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, bpt);
 }
 
 /* Tell whether this target can support a hardware breakpoint.  CNT
index 695156d27c22b5a091509c29f8e11f776f0fc7e9..6fc32bc92b78b0db43a06b198655b0ab7fed5dcb 100644 (file)
@@ -1050,7 +1050,7 @@ rdp_execute (void)
 }
 
 static int
-remote_rdp_insert_breakpoint (CORE_ADDR addr, bfd_byte *save)
+remote_rdp_insert_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   int res;
   if (ds.rdi_level > 0)
@@ -1059,7 +1059,7 @@ remote_rdp_insert_breakpoint (CORE_ADDR addr, bfd_byte *save)
                RDP_SET_BREAK,
                addr,
                RDP_SET_BREAK_TYPE_PC_EQUAL | RDP_SET_BREAK_TYPE_GET_HANDLE,
-               save,
+               bpt->shadow_contents,
                &res);
     }
   else
@@ -1074,14 +1074,14 @@ remote_rdp_insert_breakpoint (CORE_ADDR addr, bfd_byte *save)
 }
 
 static int
-remote_rdp_remove_breakpoint (CORE_ADDR addr, bfd_byte *save)
+remote_rdp_remove_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   int res;
   if (ds.rdi_level > 0)
     {
       send_rdp ("b-p-S-B",
                RDP_CLEAR_BREAK,
-               save, 4,
+               bpt->shadow_contents, 4,
                &res);
     }
   else
@@ -1108,12 +1108,12 @@ rdp_step (void)
     }
   else
     {
-      char handle[4];
+      struct breakpoint *b;
       CORE_ADDR pc = read_register (ARM_PC_REGNUM);
       pc = arm_get_next_pc (pc);
-      remote_rdp_insert_breakpoint (pc, handle);
+      b = deprecated_insert_raw_breakpoint (pc);
       rdp_execute ();
-      remote_rdp_remove_breakpoint (pc, handle);
+      deprecated_remove_raw_breakpoint (b);
     }
 }
 
index 75331074f9b370bd6545f071d6e8a62be96e9a68..d91d2defbf69794ab1a140ac19b6395b4badca1e 100644 (file)
@@ -99,10 +99,6 @@ static void interrupt_query (void);
 
 static int read_frame (char *);
 
-static int sds_insert_breakpoint (CORE_ADDR, char *);
-
-static int sds_remove_breakpoint (CORE_ADDR, char *);
-
 static void init_sds_ops (void);
 
 static void sds_command (char *args, int from_tty);
@@ -1004,7 +1000,7 @@ sds_load (char *filename, int from_tty)
    replaced instruction back to the debugger.  */
 
 static int
-sds_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
+sds_insert_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   int i, retlen;
   unsigned char *p, buf[PBUFSIZ];
@@ -1020,13 +1016,13 @@ sds_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
   retlen = sds_send (buf, p - buf);
 
   for (i = 0; i < 4; ++i)
-    contents_cache[i] = buf[i + 2];
+    bpt->shadow_contents[i] = buf[i + 2];
 
   return 0;
 }
 
 static int
-sds_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
+sds_remove_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   int i, retlen;
   unsigned char *p, buf[PBUFSIZ];
@@ -1039,7 +1035,7 @@ sds_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
   *p++ = (int) (addr >> 8) & 0xff;
   *p++ = (int) (addr) & 0xff;
   for (i = 0; i < 4; ++i)
-    *p++ = contents_cache[i];
+    *p++ = bpt->shadow_contents[i];
 
   retlen = sds_send (buf, p - buf);
 
index e96018df7f8fec0dd395c84bc7f41f341d980dcb..4e36f54af9a538a8b0f66395dc68adcfee79e77a 100644 (file)
@@ -805,18 +805,6 @@ gdbsim_mourn_inferior (void)
   generic_mourn_inferior ();
 }
 
-static int
-gdbsim_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
-{
-  return memory_insert_breakpoint (addr, contents_cache);
-}
-
-static int
-gdbsim_remove_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
-{
-  return memory_remove_breakpoint (addr, contents_cache);
-}
-
 /* Pass the command argument through to the simulator verbatim.  The
    simulator must do any command interpretation work.  */
 
@@ -866,8 +854,8 @@ init_gdbsim_ops (void)
   gdbsim_ops.to_prepare_to_store = gdbsim_prepare_to_store;
   gdbsim_ops.deprecated_xfer_memory = gdbsim_xfer_inferior_memory;
   gdbsim_ops.to_files_info = gdbsim_files_info;
-  gdbsim_ops.to_insert_breakpoint = gdbsim_insert_breakpoint;
-  gdbsim_ops.to_remove_breakpoint = gdbsim_remove_breakpoint;
+  gdbsim_ops.to_insert_breakpoint = memory_insert_breakpoint;
+  gdbsim_ops.to_remove_breakpoint = memory_remove_breakpoint;
   gdbsim_ops.to_kill = gdbsim_kill;
   gdbsim_ops.to_load = gdbsim_load;
   gdbsim_ops.to_create_inferior = gdbsim_create_inferior;
index c7c39a1450d5dac91c7b497490696ff09d7dc4c5..e016c685c0cac872952567a3fbdbc8c2447aa784 100644 (file)
@@ -599,20 +599,15 @@ static CORE_ADDR breakaddr[MAX_STDEBUG_BREAKPOINTS] =
 {0};
 
 static int
-st2000_insert_breakpoint (CORE_ADDR addr, char *shadow)
+st2000_insert_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   int i;
-  CORE_ADDR bp_addr = addr;
-  int bp_size = 0;
-
-  BREAKPOINT_FROM_PC (&bp_addr, &bp_size);
 
   for (i = 0; i <= MAX_STDEBUG_BREAKPOINTS; i++)
     if (breakaddr[i] == 0)
       {
        breakaddr[i] = addr;
 
-       st2000_read_inferior_memory (bp_addr, shadow, bp_size);
        printf_stdebug ("BR %x H\r", addr);
        expect_prompt (1);
        return 0;
@@ -623,7 +618,7 @@ st2000_insert_breakpoint (CORE_ADDR addr, char *shadow)
 }
 
 static int
-st2000_remove_breakpoint (CORE_ADDR addr, char *shadow)
+st2000_remove_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   int i;
 
index 65ceac2cedbb68e795502fedfa03cba9d590cef8..88346b4a95339b88dc4cd74c476b2998ca305839 100644 (file)
@@ -135,10 +135,6 @@ static void get_offsets (void);
 
 static long read_frame (char *buf, long sizeof_buf);
 
-static int remote_insert_breakpoint (CORE_ADDR, bfd_byte *);
-
-static int remote_remove_breakpoint (CORE_ADDR, bfd_byte *);
-
 static int hexnumlen (ULONGEST num);
 
 static void init_remote_ops (void);
@@ -4539,19 +4535,17 @@ static unsigned char little_break_insn[] = DEPRECATED_LITTLE_REMOTE_BREAKPOINT;
 /* Insert a breakpoint on targets that don't have any better
    breakpoint support.  We read the contents of the target location
    and stash it, then overwrite it with a breakpoint instruction.
-   ADDR is the target location in the target machine.  CONTENTS_CACHE
-   is a pointer to memory allocated for saving the target contents.
-   It is guaranteed by the caller to be long enough to save the number
-   of bytes returned by BREAKPOINT_FROM_PC.  */
+   ADDR is the target location in the target machine.  BPT is the breakpoint
+   being inserted or removed, which contains memory for saving the
+   target contents.  */
 
 static int
-remote_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
+remote_insert_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   struct remote_state *rs = get_remote_state ();
 #ifdef DEPRECATED_REMOTE_BREAKPOINT
   int val;
 #endif
-  int bp_size;
 
   /* Try the "Z" s/w breakpoint packet if it is not already disabled.
      If it succeeds, then set the support to PACKET_ENABLE.  If it
@@ -4563,13 +4557,14 @@ remote_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
       char *buf = alloca (rs->remote_packet_size);
       char *p = buf;
 
-      addr = remote_address_masked (addr);
       *(p++) = 'Z';
       *(p++) = '0';
       *(p++) = ',';
-      p += hexnumstr (p, (ULONGEST) addr);
-      BREAKPOINT_FROM_PC (&addr, &bp_size);
-      sprintf (p, ",%d", bp_size);
+      bpt->placed_address = addr;
+      BREAKPOINT_FROM_PC (&bpt->placed_address, &bpt->placed_size);
+      addr = (ULONGEST) remote_address_masked (bpt->placed_address);
+      p += hexnumstr (p, addr);
+      sprintf (p, ",%d", bpt->placed_size);
 
       putpkt (buf);
       getpkt (buf, rs->remote_packet_size, 0);
@@ -4586,7 +4581,7 @@ remote_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
     }
 
 #ifdef DEPRECATED_REMOTE_BREAKPOINT
-  val = target_read_memory (addr, contents_cache, sizeof big_break_insn);
+  val = target_read_memory (addr, bpt->shadow_contents, sizeof big_break_insn);
 
   if (val == 0)
     {
@@ -4600,12 +4595,12 @@ remote_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
 
   return val;
 #else
-  return memory_insert_breakpoint (addr, contents_cache);
+  return memory_insert_breakpoint (addr, bpt);
 #endif /* DEPRECATED_REMOTE_BREAKPOINT */
 }
 
 static int
-remote_remove_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
+remote_remove_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   struct remote_state *rs = get_remote_state ();
   int bp_size;
@@ -4619,10 +4614,9 @@ remote_remove_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
       *(p++) = '0';
       *(p++) = ',';
 
-      addr = remote_address_masked (addr);
-      p += hexnumstr (p, (ULONGEST) addr);
-      BREAKPOINT_FROM_PC (&addr, &bp_size);
-      sprintf (p, ",%d", bp_size);
+      addr = (ULONGEST) remote_address_masked (bpt->placed_address);
+      p += hexnumstr (p, addr);
+      sprintf (p, ",%d", bpt->placed_size);
 
       putpkt (buf);
       getpkt (buf, rs->remote_packet_size, 0);
@@ -4631,9 +4625,9 @@ remote_remove_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
     }
 
 #ifdef DEPRECATED_REMOTE_BREAKPOINT
-  return target_write_memory (addr, contents_cache, sizeof big_break_insn);
+  return target_write_memory (addr, bpt->shadow_contents, sizeof big_break_insn);
 #else
-  return memory_remove_breakpoint (addr, contents_cache);
+  return memory_remove_breakpoint (addr, bpt);
 #endif /* DEPRECATED_REMOTE_BREAKPOINT */
 }
 
@@ -4779,9 +4773,8 @@ remote_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
 
 
 static int
-remote_insert_hw_breakpoint (CORE_ADDR addr, gdb_byte *shadow)
+remote_insert_hw_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
-  int len = 0;
   struct remote_state *rs = get_remote_state ();
   char *buf = alloca (rs->remote_packet_size);
   char *p = buf;
@@ -4789,7 +4782,8 @@ remote_insert_hw_breakpoint (CORE_ADDR addr, gdb_byte *shadow)
   /* The length field should be set to the size of a breakpoint
      instruction.  */
 
-  BREAKPOINT_FROM_PC (&addr, &len);
+  bpt->placed_address = addr;
+  BREAKPOINT_FROM_PC (&bpt->placed_address, &bpt->placed_size);
 
   if (remote_protocol_packets[PACKET_Z1].support == PACKET_DISABLE)
     error (_("Can't set hardware breakpoint without the '%s' (%s) packet."),
@@ -4800,9 +4794,9 @@ remote_insert_hw_breakpoint (CORE_ADDR addr, gdb_byte *shadow)
   *(p++) = '1';
   *(p++) = ',';
 
-  addr = remote_address_masked (addr);
+  addr = remote_address_masked (bpt->placed_address);
   p += hexnumstr (p, (ULONGEST) addr);
-  sprintf (p, ",%x", len);
+  sprintf (p, ",%x", bpt->placed_size);
 
   putpkt (buf);
   getpkt (buf, rs->remote_packet_size, 0);
@@ -4821,9 +4815,8 @@ remote_insert_hw_breakpoint (CORE_ADDR addr, gdb_byte *shadow)
 
 
 static int
-remote_remove_hw_breakpoint (CORE_ADDR addr, gdb_byte *shadow)
+remote_remove_hw_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
-  int len;
   struct remote_state *rs = get_remote_state ();
   char *buf = alloca (rs->remote_packet_size);
   char *p = buf;
@@ -4831,8 +4824,6 @@ remote_remove_hw_breakpoint (CORE_ADDR addr, gdb_byte *shadow)
   /* 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,
@@ -4842,9 +4833,9 @@ remote_remove_hw_breakpoint (CORE_ADDR addr, gdb_byte *shadow)
   *(p++) = '1';
   *(p++) = ',';
 
-  addr = remote_address_masked (addr);
+  addr = remote_address_masked (bpt->placed_address);
   p += hexnumstr (p, (ULONGEST) addr);
-  sprintf (p, ",%x", len);
+  sprintf (p, ",%x", bpt->placed_size);
 
   putpkt(buf);
   getpkt (buf, rs->remote_packet_size, 0);
index 4b2dc65733e5460614662d3f3700993d8b46b10a..82d3a9bd32292a28d44a877faae65ae867e2b585 100644 (file)
@@ -527,15 +527,15 @@ exec_one_dummy_insn (void)
 {
 #define        DUMMY_INSN_ADDR (TEXT_SEGMENT_BASE)+0x200
 
-  char shadow_contents[BREAKPOINT_MAX];                /* Stash old bkpt addr contents */
   int ret, status, pid;
   CORE_ADDR prev_pc;
+  struct breakpoint *b;
 
   /* We plant one dummy breakpoint into DUMMY_INSN_ADDR address. We
      assume that this address will never be executed again by the real
      code. */
 
-  target_insert_breakpoint (DUMMY_INSN_ADDR, shadow_contents);
+  b = deprecated_insert_raw_breakpoint (DUMMY_INSN_ADDR);
 
   /* You might think this could be done with a single ptrace call, and
      you'd be correct for just about every platform I've ever worked
@@ -559,7 +559,7 @@ exec_one_dummy_insn (void)
   while (pid != PIDGET (inferior_ptid));
 
   write_pc (prev_pc);
-  target_remove_breakpoint (DUMMY_INSN_ADDR, shadow_contents);
+  deprecated_remove_raw_breakpoint (b);
 }
 
 /* Fetch registers from the register section in core bfd. */
index f78280009a1a81ed56292f0ebea00dfbcbd904b5..f932b4c52a5e450b53e6cabf3a0621b08d57582b 100644 (file)
@@ -110,17 +110,6 @@ struct reg
                                    register number.  */
   };
 
-/* Breakpoint shadows for the single step instructions will be kept here. */
-
-static struct sstep_breaks
-{
-  /* Address, or 0 if this is not in use.  */
-  CORE_ADDR address;
-  /* Shadow contents.  */
-  gdb_byte data[4];
-}
-stepBreaks[2];
-
 /* Hook for determining the TOC address when calling functions in the
    inferior under AIX. The initialization code in rs6000-nat.c sets
    this hook to point to find_toc_address.  */
@@ -730,7 +719,6 @@ rs6000_software_single_step (enum target_signal signal,
 
   if (insert_breakpoints_p)
     {
-
       loc = read_pc ();
 
       insn = read_memory_integer (loc, 4);
@@ -743,28 +731,17 @@ rs6000_software_single_step (enum target_signal signal,
       if (breaks[1] == breaks[0])
        breaks[1] = -1;
 
-      stepBreaks[1].address = 0;
-
       for (ii = 0; ii < 2; ++ii)
        {
-
          /* ignore invalid breakpoint. */
          if (breaks[ii] == -1)
            continue;
-         target_insert_breakpoint (breaks[ii], stepBreaks[ii].data);
-         stepBreaks[ii].address = breaks[ii];
+         insert_single_step_breakpoint (breaks[ii]);
        }
-
     }
   else
-    {
+    remove_single_step_breakpoints ();
 
-      /* remove step breakpoints. */
-      for (ii = 0; ii < 2; ++ii)
-       if (stepBreaks[ii].address != 0)
-         target_remove_breakpoint (stepBreaks[ii].address,
-                                   stepBreaks[ii].data);
-    }
   errno = 0;                   /* FIXME, don't ignore errors! */
   /* What errors?  {read,write}_memory call error().  */
 }
index ed4e8e5440235b7565e7c1a115b272e4605ad94a..30703b11313d5db4078b428fb95c8731b3011c56 100644 (file)
@@ -1524,7 +1524,7 @@ sol_make_note_section (bfd *obfd, int *note_size)
 }
 
 static int
-ignore (CORE_ADDR addr, gdb_byte *contents)
+ignore (CORE_ADDR addr, struct bp_location *bpt)
 {
   return 0;
 }
index ffbb2528cdbb69fec0cec3d6ab917b0c0557aae4..f8fce9ddcfb9717459d85b267e4149b51f7cbd42 100644 (file)
@@ -227,10 +227,9 @@ fetch_lm_info (CORE_ADDR addr)
 /* The symbol which starts off the list of shared libraries.  */
 #define DEBUG_BASE "__rld_obj_head"
 
-char shadow_contents[BREAKPOINT_MAX];  /* Stash old bkpt addr contents */
+static struct breakpoint *base_breakpoint;
 
 static CORE_ADDR debug_base;   /* Base of dynamic linker structures */
-static CORE_ADDR breakpoint_addr;      /* Address where end bkpt is set */
 
 /*
 
@@ -319,11 +318,13 @@ 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 (deprecated_remove_raw_breakpoint (base_breakpoint) != 0)
     {
       status = 0;
     }
 
+  base_breakpoint = NULL;
+
   /* Note that it is possible that we have stopped at a location that
      is different from the location where we inserted our breakpoint.
      On mips-irix, we can actually land in __dbx_init(), so we should
@@ -352,12 +353,13 @@ disable_break (void)
 static int
 enable_break (void)
 {
-  if (symfile_objfile != NULL
-      && target_insert_breakpoint (entry_point_address (),
-                                  shadow_contents) == 0)
+  if (symfile_objfile != NULL)
     {
-      breakpoint_addr = entry_point_address ();
-      return 1;
+      base_breakpoint
+       = deprecated_insert_raw_breakpoint (entry_point_address ());
+
+      if (base_breakpoint != NULL)
+       return 1;
     }
 
   return 0;
index aacdaa652e1e4b4e1c8b8b5fd4dd118fe115158d..94346fe55b603da7c5cc4f89480b97d6dd9f0107 100644 (file)
@@ -1085,8 +1085,7 @@ sparc_software_single_step (enum target_signal sig, int insert_breakpoints_p)
 {
   struct gdbarch *arch = current_gdbarch;
   struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
-  static CORE_ADDR npc, nnpc;
-  static gdb_byte npc_save[4], nnpc_save[4];
+  CORE_ADDR npc, nnpc;
 
   if (insert_breakpoints_p)
     {
@@ -1098,9 +1097,10 @@ sparc_software_single_step (enum target_signal sig, int insert_breakpoints_p)
       /* Analyze the instruction at PC.  */
       nnpc = sparc_analyze_control_transfer (arch, pc, &npc);
       if (npc != 0)
-       target_insert_breakpoint (npc, npc_save);
+       insert_single_step_breakpoint (npc);
+
       if (nnpc != 0)
-       target_insert_breakpoint (nnpc, nnpc_save);
+       insert_single_step_breakpoint (nnpc);
 
       /* Assert that we have set at least one breakpoint, and that
         they're not set at the same spot - unless we're going
@@ -1109,12 +1109,7 @@ sparc_software_single_step (enum target_signal sig, int insert_breakpoints_p)
       gdb_assert (nnpc != npc || orig_npc == 0);
     }
   else
-    {
-      if (npc != 0)
-       target_remove_breakpoint (npc, npc_save);
-      if (nnpc != 0)
-       target_remove_breakpoint (nnpc, nnpc_save);
-    }
+    remove_single_step_breakpoints ();
 }
 
 static void
index 1d4e035dc7b6f583a6b417d5c84b604ba7f02772..4e0b997179fc2de67d71c0228940966074ad806f 100644 (file)
@@ -111,15 +111,15 @@ static void debug_to_prepare_to_store (void);
 
 static void debug_to_files_info (struct target_ops *);
 
-static int debug_to_insert_breakpoint (CORE_ADDR, gdb_byte *);
+static int debug_to_insert_breakpoint (CORE_ADDR, struct bp_location *);
 
-static int debug_to_remove_breakpoint (CORE_ADDR, gdb_byte *);
+static int debug_to_remove_breakpoint (CORE_ADDR, struct bp_location *);
 
 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_insert_hw_breakpoint (CORE_ADDR, struct bp_location *);
 
-static int debug_to_remove_hw_breakpoint (CORE_ADDR, gdb_byte *);
+static int debug_to_remove_hw_breakpoint (CORE_ADDR, struct bp_location *);
 
 static int debug_to_insert_watchpoint (CORE_ADDR, int, int);
 
@@ -516,10 +516,10 @@ update_current_target (void)
            (int (*) (int, int, int))
            return_zero);
   de_fault (to_insert_hw_breakpoint,
-           (int (*) (CORE_ADDR, gdb_byte *))
+           (int (*) (CORE_ADDR, struct bp_location *))
            return_minus_one);
   de_fault (to_remove_hw_breakpoint,
-           (int (*) (CORE_ADDR, gdb_byte *))
+           (int (*) (CORE_ADDR, struct bp_location *))
            return_minus_one);
   de_fault (to_insert_watchpoint,
            (int (*) (CORE_ADDR, int, int))
@@ -2142,11 +2142,11 @@ debug_to_files_info (struct target_ops *target)
 }
 
 static int
-debug_to_insert_breakpoint (CORE_ADDR addr, gdb_byte *save)
+debug_to_insert_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   int retval;
 
-  retval = debug_target.to_insert_breakpoint (addr, save);
+  retval = debug_target.to_insert_breakpoint (addr, bpt);
 
   fprintf_unfiltered (gdb_stdlog,
                      "target_insert_breakpoint (0x%lx, xxx) = %ld\n",
@@ -2156,11 +2156,11 @@ debug_to_insert_breakpoint (CORE_ADDR addr, gdb_byte *save)
 }
 
 static int
-debug_to_remove_breakpoint (CORE_ADDR addr, gdb_byte *save)
+debug_to_remove_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   int retval;
 
-  retval = debug_target.to_remove_breakpoint (addr, save);
+  retval = debug_target.to_remove_breakpoint (addr, bpt);
 
   fprintf_unfiltered (gdb_stdlog,
                      "target_remove_breakpoint (0x%lx, xxx) = %ld\n",
@@ -2228,11 +2228,11 @@ debug_to_stopped_data_address (struct target_ops *target, CORE_ADDR *addr)
 }
 
 static int
-debug_to_insert_hw_breakpoint (CORE_ADDR addr, gdb_byte *save)
+debug_to_insert_hw_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   int retval;
 
-  retval = debug_target.to_insert_hw_breakpoint (addr, save);
+  retval = debug_target.to_insert_hw_breakpoint (addr, bpt);
 
   fprintf_unfiltered (gdb_stdlog,
                      "target_insert_hw_breakpoint (0x%lx, xxx) = %ld\n",
@@ -2242,11 +2242,11 @@ debug_to_insert_hw_breakpoint (CORE_ADDR addr, gdb_byte *save)
 }
 
 static int
-debug_to_remove_hw_breakpoint (CORE_ADDR addr, gdb_byte *save)
+debug_to_remove_hw_breakpoint (CORE_ADDR addr, struct bp_location *bpt)
 {
   int retval;
 
-  retval = debug_target.to_remove_hw_breakpoint (addr, save);
+  retval = debug_target.to_remove_hw_breakpoint (addr, bpt);
 
   fprintf_unfiltered (gdb_stdlog,
                      "target_remove_hw_breakpoint (0x%lx, xxx) = %ld\n",
index 76d53d81c1a1ce3cdf60f133ccc6eae01dd94e59..f7203abbbf483ceaeb3bb5615a7e8e1c97fdb282 100644 (file)
@@ -30,6 +30,7 @@ struct objfile;
 struct ui_file;
 struct mem_attrib;
 struct target_ops;
+struct bp_location;
 struct gdb_feature_set;
 
 /* This include file defines the interface between the main part
@@ -361,11 +362,11 @@ struct target_ops
                                   struct target_ops *target);
 
     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_insert_breakpoint) (CORE_ADDR, struct bp_location *);
+    int (*to_remove_breakpoint) (CORE_ADDR, struct bp_location *);
     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_insert_hw_breakpoint) (CORE_ADDR, struct bp_location *);
+    int (*to_remove_hw_breakpoint) (CORE_ADDR, struct bp_location *);
     int (*to_remove_watchpoint) (CORE_ADDR, int, int);
     int (*to_insert_watchpoint) (CORE_ADDR, int, int);
     int (*to_stopped_by_watchpoint) (void);
@@ -644,22 +645,23 @@ extern void print_section_info (struct target_ops *, bfd *);
 #define        target_files_info()     \
      (*current_target.to_files_info) (&current_target)
 
-/* Insert a breakpoint at address ADDR in the target machine.  SAVE is
-   a pointer to memory allocated for saving the target contents.  It
-   is guaranteed by the caller to be long enough to save the number of
-   breakpoint bytes indicated by BREAKPOINT_FROM_PC.  Result is 0 for
-   success, or an errno value.  */
+/* Insert a breakpoint at address ADDR in the target machine.  BPT is
+   a struct bp_location *, which contains some memory for saving the
+   target contents.  It is guaranteed to be long enough to save the
+   number of breakpoint bytes indicated by BREAKPOINT_FROM_PC.  Result
+   is 0 for success, or an errno value.  */
 
-#define        target_insert_breakpoint(addr, save)    \
-     (*current_target.to_insert_breakpoint) (addr, save)
+#define        target_insert_breakpoint(addr, bpt)     \
+     (*current_target.to_insert_breakpoint) (addr, bpt)
 
 /* Remove a breakpoint at address ADDR in the target machine.
-   SAVE is a pointer to the same save area
+   BPT is a pointer to the same save area
    that was previously passed to target_insert_breakpoint.
+
    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, bpt)     \
+     (*current_target.to_remove_breakpoint) (addr, bpt)
 
 /* Initialize the terminal settings we record for the inferior,
    before we actually run the inferior.  */
@@ -1089,11 +1091,11 @@ extern void (*deprecated_target_new_objfile_hook) (struct objfile *);
 #endif
 
 #ifndef target_insert_hw_breakpoint
-#define target_insert_hw_breakpoint(addr, save) \
-     (*current_target.to_insert_hw_breakpoint) (addr, save)
+#define target_insert_hw_breakpoint(addr, bpt) \
+     (*current_target.to_insert_hw_breakpoint) (addr, bpt)
 
-#define target_remove_hw_breakpoint(addr, save) \
-     (*current_target.to_remove_hw_breakpoint) (addr, save)
+#define target_remove_hw_breakpoint(addr, bpt) \
+     (*current_target.to_remove_hw_breakpoint) (addr, bpt)
 #endif
 
 extern int target_stopped_data_address_p (struct target_ops *);
@@ -1177,13 +1179,13 @@ struct section_table *target_section_by_addr (struct target_ops *target,
 
 /* From mem-break.c */
 
-extern int memory_remove_breakpoint (CORE_ADDR, gdb_byte *);
+extern int memory_remove_breakpoint (CORE_ADDR, struct bp_location *);
 
-extern int memory_insert_breakpoint (CORE_ADDR, gdb_byte *);
+extern int memory_insert_breakpoint (CORE_ADDR, struct bp_location *);
 
-extern int default_memory_remove_breakpoint (CORE_ADDR, gdb_byte *);
+extern int default_memory_remove_breakpoint (CORE_ADDR, struct bp_location *);
 
-extern int default_memory_insert_breakpoint (CORE_ADDR, gdb_byte *);
+extern int default_memory_insert_breakpoint (CORE_ADDR, struct bp_location *);
 
 
 /* From target.c */
index 56f4b95403f37a2057166863dfde8dd80a9bbfa9..86bfaf6ab66acaff03f87aa79c48c2e398327eac 100644 (file)
@@ -146,7 +146,6 @@ typedef struct thread_info_struct
     int suspend_count;
     int stepped;               /* True if stepped.  */
     CORE_ADDR step_pc;
-    unsigned long step_prev;
     CONTEXT context;
   }
 thread_info;
@@ -834,7 +833,7 @@ undoSStep (thread_info * th)
 {
   if (th->stepped)
     {
-      memory_remove_breakpoint (th->step_pc, (void *) &th->step_prev);
+      remove_single_step_breakpoints ();
       th->stepped = 0;
     }
 }
@@ -857,8 +856,7 @@ wince_software_single_step (enum target_signal ignore,
   th->stepped = 1;
   pc = read_register (PC_REGNUM);
   th->step_pc = mips_next_pc (pc);
-  th->step_prev = 0;
-  memory_insert_breakpoint (th->step_pc, (void *) &th->step_prev);
+  insert_single_step_breakpoint (th->step_pc);
   return;
 }
 #elif SHx
@@ -971,7 +969,7 @@ undoSStep (thread_info * th)
 {
   if (th->stepped)
     {
-      memory_remove_breakpoint (th->step_pc, (void *) &th->step_prev);
+      remove_single_step_breakpoints ();
       th->stepped = 0;
     }
   return;
@@ -996,8 +994,7 @@ wince_software_single_step (enum target_signal ignore,
 
   th->stepped = 1;
   th->step_pc = sh_get_next_pc (&th->context);
-  th->step_prev = 0;
-  memory_insert_breakpoint (th->step_pc, (void *) &th->step_prev);
+  insert_single_step_breakpoint (th->step_pc);
   return;
 }
 #elif defined (ARM)
@@ -1024,7 +1021,7 @@ undoSStep (thread_info * th)
 {
   if (th->stepped)
     {
-      memory_remove_breakpoint (th->step_pc, (void *) &th->step_prev);
+      remove_single_step_breakpoints ();
       th->stepped = 0;
     }
 }
@@ -1047,8 +1044,7 @@ wince_software_single_step (enum target_signal ignore,
   th->stepped = 1;
   pc = read_register (PC_REGNUM);
   th->step_pc = arm_get_next_pc (pc);
-  th->step_prev = 0;
-  memory_insert_breakpoint (th->step_pc, (void *) &th->step_prev);
+  insert_single_step_breakpoint (th->step_pc);
   return;
 }
 #endif