target, breakpoint: allow insert/remove breakpoint to be forwarded
authorMarkus Metzger <markus.t.metzger@intel.com>
Tue, 17 Dec 2013 09:49:03 +0000 (10:49 +0100)
committerMarkus Metzger <markus.t.metzger@intel.com>
Thu, 16 Jan 2014 12:06:13 +0000 (13:06 +0100)
2014-01-16  Markus Metzger  <markus.t.metzger@intel.com>

* target.h (target_ops) <to_insert_breakpoint>
<to_remove_breakpoint>: Add target_ops parameter.
(forward_target_insert_breakpoint): New.
(forward_target_remove_breakpoint): New.
(memory_remove_breakpoint, memory_insert_breakpoint):
Add target_ops parameter.
* target.c (target_insert_breakpoint): Split into this and ...
(forward_target_insert_breakpoint): ... this.
(target_remove_breakpoint): Split into this and ...
(forward_target_remove_breakpoint): ... this.
(debug_to_insert_breakpoint): Add target_ops parameter.
Call forward_target_insert_breakpoint.
(debug_to_remove_breakpoint): Add target_ops parameter.
Call forward_target_remove_breakpoint.
(update_current_target): Do not inherit or default to_insert_breakpoint
and to_remove_breakpoint.
* corelow.c (ignore): Add target_ops parameter.
* exec.c (ignore): Add target_ops parameter.
* mem-break.c (memory_insert_breakpoint, memory_remove_breakpoint):
Add target_ops parameter.
* monitor.c (monitor_insert_breakpoint, monitor_remove_breakpoint):
Add target_ops parameter.
* nto-procfs.c (procfs_insert_breakpoint, procfs_remove_breakpoint):
Add target_ops parameter.
* record-full.c (record_full_beneath_to_insert_breakpoint)
(record_full_beneath_to_remove_breakpoint, tmp_to_insert_breakpoint)
(tmp_to_remove_breakpoint, record_full_insert_breakpoint)
(record_full_remove_breakpoint, record_full_core_insert_breakpoint)
(record_full_core_remove_breakpoint): Add target_ops parameter.
Update users.
(record_full_beneath_to_insert_breakpoint_ops)
(record_full_beneath_to_remove_breakpoint_ops)
(tmp_to_insert_breakpoint_ops, tmp_to_remove_breakpoint_ops): New.
(record_full_open): Initialize tmp_to_insert_breakpoint_ops,
tmp_to_remove_breakpoint_ops,
record_full_beneath_to_insert_breakpoint_ops, and
record_full_beneath_to_remove_breakpoint_ops.
* remote-m32r-sdi.c (m32r_insert_breakpoint)
(m32r_remove_breakpoint): Add target_ops parameter.
* remote-mips.c (mips_insert_breakpoint, mips_remove_breakpoint):
Add target_ops parameter.
* remote.c (remote_insert_breakpoint, remote_remove_breakpoint):
Add target_ops parameter.

12 files changed:
gdb/ChangeLog
gdb/corelow.c
gdb/exec.c
gdb/mem-break.c
gdb/monitor.c
gdb/nto-procfs.c
gdb/record-full.c
gdb/remote-m32r-sdi.c
gdb/remote-mips.c
gdb/remote.c
gdb/target.c
gdb/target.h

index 41bf49bca87fccd1a7bb855ae20221a4ae70fcd8..b4dd9c673270f91dda49d6d1968faa0d7535a26f 100644 (file)
@@ -1,3 +1,49 @@
+2014-01-16  Markus Metzger  <markus.t.metzger@intel.com>
+
+       * target.h (target_ops) <to_insert_breakpoint>
+       <to_remove_breakpoint>: Add target_ops parameter.
+       (forward_target_insert_breakpoint): New.
+       (forward_target_remove_breakpoint): New.
+       (memory_remove_breakpoint, memory_insert_breakpoint):
+       Add target_ops parameter.
+       * target.c (target_insert_breakpoint): Split into this and ...
+       (forward_target_insert_breakpoint): ... this.
+       (target_remove_breakpoint): Split into this and ...
+       (forward_target_remove_breakpoint): ... this.
+       (debug_to_insert_breakpoint): Add target_ops parameter.
+       Call forward_target_insert_breakpoint.
+       (debug_to_remove_breakpoint): Add target_ops parameter.
+       Call forward_target_remove_breakpoint.
+       (update_current_target): Do not inherit or default to_insert_breakpoint
+       and to_remove_breakpoint.
+       * corelow.c (ignore): Add target_ops parameter.
+       * exec.c (ignore): Add target_ops parameter.
+       * mem-break.c (memory_insert_breakpoint, memory_remove_breakpoint):
+       Add target_ops parameter.
+       * monitor.c (monitor_insert_breakpoint, monitor_remove_breakpoint):
+       Add target_ops parameter.
+       * nto-procfs.c (procfs_insert_breakpoint, procfs_remove_breakpoint):
+       Add target_ops parameter.
+       * record-full.c (record_full_beneath_to_insert_breakpoint)
+       (record_full_beneath_to_remove_breakpoint, tmp_to_insert_breakpoint)
+       (tmp_to_remove_breakpoint, record_full_insert_breakpoint)
+       (record_full_remove_breakpoint, record_full_core_insert_breakpoint)
+       (record_full_core_remove_breakpoint): Add target_ops parameter.
+       Update users.
+       (record_full_beneath_to_insert_breakpoint_ops)
+       (record_full_beneath_to_remove_breakpoint_ops)
+       (tmp_to_insert_breakpoint_ops, tmp_to_remove_breakpoint_ops): New.
+       (record_full_open): Initialize tmp_to_insert_breakpoint_ops,
+       tmp_to_remove_breakpoint_ops,
+       record_full_beneath_to_insert_breakpoint_ops, and
+       record_full_beneath_to_remove_breakpoint_ops.
+       * remote-m32r-sdi.c (m32r_insert_breakpoint)
+       (m32r_remove_breakpoint): Add target_ops parameter.
+       * remote-mips.c (mips_insert_breakpoint, mips_remove_breakpoint):
+       Add target_ops parameter.
+       * remote.c (remote_insert_breakpoint, remote_remove_breakpoint):
+       Add target_ops parameter.
+
 2014-01-16  Jan Kratochvil  <jan.kratochvil@redhat.com>
             Markus Metzger  <markus.t.metzger@intel.com>
 
index 6f59d31459961b3dacb4b5767002eadb02baba94..d4c1c16c25bb59e1b14c89213b3ae78d082b49bd 100644 (file)
@@ -842,7 +842,8 @@ core_xfer_partial (struct target_ops *ops, enum target_object object,
    breakpoint_init_inferior).  */
 
 static int
-ignore (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
+ignore (struct target_ops *ops, struct gdbarch *gdbarch,
+       struct bp_target_info *bp_tgt)
 {
   return 0;
 }
index 809a0b2f8fe10b728dda4f81364a8ba8148785e9..b5aa7f288c9c097edaa0f06aefdf55cd4ba5c1bd 100644 (file)
@@ -801,7 +801,8 @@ exec_set_section_address (const char *filename, int index, CORE_ADDR address)
    breakpoint_init_inferior).  */
 
 static int
-ignore (struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
+ignore (struct target_ops *ops, struct gdbarch *gdbarch,
+       struct bp_target_info *bp_tgt)
 {
   return 0;
 }
index c206687a92831d7ed57c6f01eebfac1fad346c2d..1a057df8a7a1b1810af0c76aae56bfe784c120a6 100644 (file)
@@ -77,14 +77,14 @@ default_memory_remove_breakpoint (struct gdbarch *gdbarch,
 
 
 int
-memory_insert_breakpoint (struct gdbarch *gdbarch,
+memory_insert_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch,
                          struct bp_target_info *bp_tgt)
 {
   return gdbarch_memory_insert_breakpoint (gdbarch, bp_tgt);
 }
 
 int
-memory_remove_breakpoint (struct gdbarch *gdbarch,
+memory_remove_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch,
                          struct bp_target_info *bp_tgt)
 {
   return gdbarch_memory_remove_breakpoint (gdbarch, bp_tgt);
index 2156f7ce80ac011b7256847768e9bd65103966dd..29c3f71922eb82e77a0c820a9c9c8a4fe258d5e8 100644 (file)
@@ -2095,7 +2095,7 @@ monitor_mourn_inferior (struct target_ops *ops)
 /* Tell the monitor to add a breakpoint.  */
 
 static int
-monitor_insert_breakpoint (struct gdbarch *gdbarch,
+monitor_insert_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch,
                           struct bp_target_info *bp_tgt)
 {
   CORE_ADDR addr = bp_tgt->placed_address;
@@ -2132,7 +2132,7 @@ monitor_insert_breakpoint (struct gdbarch *gdbarch,
 /* Tell the monitor to remove a breakpoint.  */
 
 static int
-monitor_remove_breakpoint (struct gdbarch *gdbarch,
+monitor_remove_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch,
                           struct bp_target_info *bp_tgt)
 {
   CORE_ADDR addr = bp_tgt->placed_address;
index c2d0d30f2466f3b6440310be0d5047d07a6f344f..4669345cb387940b0ebceb993748d55f3117f1a1 100644 (file)
@@ -922,14 +922,14 @@ procfs_breakpoint (CORE_ADDR addr, int type, int size)
 }
 
 static int
-procfs_insert_breakpoint (struct gdbarch *gdbarch,
+procfs_insert_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch,
                          struct bp_target_info *bp_tgt)
 {
   return procfs_breakpoint (bp_tgt->placed_address, _DEBUG_BREAK_EXEC, 0);
 }
 
 static int
-procfs_remove_breakpoint (struct gdbarch *gdbarch,
+procfs_remove_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch,
                          struct bp_target_info *bp_tgt)
 {
   return procfs_breakpoint (bp_tgt->placed_address, _DEBUG_BREAK_EXEC, -1);
index 41b8a54c0341bd790f85ab270ecb8e3dcacb1ee5..a44af1014cafc7e0ca62ac3daa7dd25d6b5464ef 100644 (file)
@@ -243,11 +243,15 @@ static void (*record_full_beneath_to_store_registers) (struct target_ops *,
 static struct target_ops *record_full_beneath_to_xfer_partial_ops;
 static target_xfer_partial_ftype *record_full_beneath_to_xfer_partial;
 static int
-  (*record_full_beneath_to_insert_breakpoint) (struct gdbarch *,
+  (*record_full_beneath_to_insert_breakpoint) (struct target_ops *,
+                                              struct gdbarch *,
                                               struct bp_target_info *);
+static struct target_ops *record_full_beneath_to_insert_breakpoint_ops;
 static int
-  (*record_full_beneath_to_remove_breakpoint) (struct gdbarch *,
+  (*record_full_beneath_to_remove_breakpoint) (struct target_ops *,
+                                              struct gdbarch *,
                                               struct bp_target_info *);
+static struct target_ops *record_full_beneath_to_remove_breakpoint_ops;
 static int (*record_full_beneath_to_stopped_by_watchpoint) (void);
 static int (*record_full_beneath_to_stopped_data_address) (struct target_ops *,
                                                           CORE_ADDR *);
@@ -814,10 +818,12 @@ static void (*tmp_to_store_registers) (struct target_ops *,
                                       int regno);
 static struct target_ops *tmp_to_xfer_partial_ops;
 static target_xfer_partial_ftype *tmp_to_xfer_partial;
-static int (*tmp_to_insert_breakpoint) (struct gdbarch *,
+static int (*tmp_to_insert_breakpoint) (struct target_ops *, struct gdbarch *,
                                        struct bp_target_info *);
-static int (*tmp_to_remove_breakpoint) (struct gdbarch *,
+static struct target_ops *tmp_to_insert_breakpoint_ops;
+static int (*tmp_to_remove_breakpoint) (struct target_ops *, struct gdbarch *,
                                        struct bp_target_info *);
+static struct target_ops *tmp_to_remove_breakpoint_ops;
 static int (*tmp_to_stopped_by_watchpoint) (void);
 static int (*tmp_to_stopped_data_address) (struct target_ops *, CORE_ADDR *);
 static int (*tmp_to_stopped_data_address) (struct target_ops *, CORE_ADDR *);
@@ -936,6 +942,8 @@ record_full_open (char *name, int from_tty)
   tmp_to_stopped_by_watchpoint = NULL;
   tmp_to_stopped_data_address = NULL;
   tmp_to_async = NULL;
+  tmp_to_insert_breakpoint_ops = NULL;
+  tmp_to_remove_breakpoint_ops = NULL;
 
   /* Set the beneath function pointers.  */
   for (t = current_target.beneath; t != NULL; t = t->beneath)
@@ -961,9 +969,15 @@ record_full_open (char *name, int from_tty)
          tmp_to_xfer_partial_ops = t;
         }
       if (!tmp_to_insert_breakpoint)
-       tmp_to_insert_breakpoint = t->to_insert_breakpoint;
+       {
+         tmp_to_insert_breakpoint = t->to_insert_breakpoint;
+         tmp_to_insert_breakpoint_ops = t;
+       }
       if (!tmp_to_remove_breakpoint)
-       tmp_to_remove_breakpoint = t->to_remove_breakpoint;
+       {
+         tmp_to_remove_breakpoint = t->to_remove_breakpoint;
+         tmp_to_remove_breakpoint_ops = t;
+       }
       if (!tmp_to_stopped_by_watchpoint)
        tmp_to_stopped_by_watchpoint = t->to_stopped_by_watchpoint;
       if (!tmp_to_stopped_data_address)
@@ -990,7 +1004,9 @@ record_full_open (char *name, int from_tty)
   record_full_beneath_to_xfer_partial_ops = tmp_to_xfer_partial_ops;
   record_full_beneath_to_xfer_partial = tmp_to_xfer_partial;
   record_full_beneath_to_insert_breakpoint = tmp_to_insert_breakpoint;
+  record_full_beneath_to_insert_breakpoint_ops = tmp_to_insert_breakpoint_ops;
   record_full_beneath_to_remove_breakpoint = tmp_to_remove_breakpoint;
+  record_full_beneath_to_remove_breakpoint_ops = tmp_to_remove_breakpoint_ops;
   record_full_beneath_to_stopped_by_watchpoint = tmp_to_stopped_by_watchpoint;
   record_full_beneath_to_stopped_data_address = tmp_to_stopped_data_address;
   record_full_beneath_to_async = tmp_to_async;
@@ -1755,7 +1771,8 @@ record_full_init_record_breakpoints (void)
    when recording.  */
 
 static int
-record_full_insert_breakpoint (struct gdbarch *gdbarch,
+record_full_insert_breakpoint (struct target_ops *ops,
+                              struct gdbarch *gdbarch,
                               struct bp_target_info *bp_tgt)
 {
   struct record_full_breakpoint *bp;
@@ -1772,7 +1789,9 @@ record_full_insert_breakpoint (struct gdbarch *gdbarch,
       int ret;
 
       old_cleanups = record_full_gdb_operation_disable_set ();
-      ret = record_full_beneath_to_insert_breakpoint (gdbarch, bp_tgt);
+      ops = record_full_beneath_to_insert_breakpoint_ops;
+      ret = record_full_beneath_to_insert_breakpoint (ops, gdbarch,
+                                                     bp_tgt);
       do_cleanups (old_cleanups);
 
       if (ret != 0)
@@ -1792,7 +1811,8 @@ record_full_insert_breakpoint (struct gdbarch *gdbarch,
 /* "to_remove_breakpoint" method for process record target.  */
 
 static int
-record_full_remove_breakpoint (struct gdbarch *gdbarch,
+record_full_remove_breakpoint (struct target_ops *ops,
+                              struct gdbarch *gdbarch,
                               struct bp_target_info *bp_tgt)
 {
   struct record_full_breakpoint *bp;
@@ -1812,7 +1832,9 @@ record_full_remove_breakpoint (struct gdbarch *gdbarch,
              int ret;
 
              old_cleanups = record_full_gdb_operation_disable_set ();
-             ret = record_full_beneath_to_remove_breakpoint (gdbarch, bp_tgt);
+             ops = record_full_beneath_to_remove_breakpoint_ops;
+             ret = record_full_beneath_to_remove_breakpoint (ops, gdbarch,
+                                                             bp_tgt);
              do_cleanups (old_cleanups);
 
              if (ret != 0)
@@ -2262,7 +2284,8 @@ record_full_core_xfer_partial (struct target_ops *ops,
 /* "to_insert_breakpoint" method for prec over corefile.  */
 
 static int
-record_full_core_insert_breakpoint (struct gdbarch *gdbarch,
+record_full_core_insert_breakpoint (struct target_ops *ops,
+                                   struct gdbarch *gdbarch,
                                    struct bp_target_info *bp_tgt)
 {
   return 0;
@@ -2271,7 +2294,8 @@ record_full_core_insert_breakpoint (struct gdbarch *gdbarch,
 /* "to_remove_breakpoint" method for prec over corefile.  */
 
 static int
-record_full_core_remove_breakpoint (struct gdbarch *gdbarch,
+record_full_core_remove_breakpoint (struct target_ops *ops,
+                                   struct gdbarch *gdbarch,
                                    struct bp_target_info *bp_tgt)
 {
   return 0;
index 9364b5f2d4813d7c0b0eb2d6f312cda0ff56fe42..d7228767142c3cfae07857d6a0f50df7219010dd 100644 (file)
@@ -1144,7 +1144,8 @@ m32r_mourn_inferior (struct target_ops *ops)
 }
 
 static int
-m32r_insert_breakpoint (struct gdbarch *gdbarch,
+m32r_insert_breakpoint (struct target_ops *ops,
+                       struct gdbarch *gdbarch,
                        struct bp_target_info *bp_tgt)
 {
   CORE_ADDR addr = bp_tgt->placed_address;
@@ -1188,7 +1189,8 @@ m32r_insert_breakpoint (struct gdbarch *gdbarch,
 }
 
 static int
-m32r_remove_breakpoint (struct gdbarch *gdbarch,
+m32r_remove_breakpoint (struct target_ops *ops,
+                       struct gdbarch *gdbarch,
                        struct bp_target_info *bp_tgt)
 {
   CORE_ADDR addr = bp_tgt->placed_address;
index adf2643990f932e6515858d949c5a768c452026f..6e7d9560fbf9346754843012f524ac9bd8ccbb7c 100644 (file)
@@ -2363,27 +2363,27 @@ mips_mourn_inferior (struct target_ops *ops)
    target contents.  */
 
 static int
-mips_insert_breakpoint (struct gdbarch *gdbarch,
+mips_insert_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch,
                        struct bp_target_info *bp_tgt)
 {
   if (monitor_supports_breakpoints)
     return mips_set_breakpoint (bp_tgt->placed_address, MIPS_INSN32_SIZE,
                                BREAK_FETCH);
   else
-    return memory_insert_breakpoint (gdbarch, bp_tgt);
+    return memory_insert_breakpoint (ops, gdbarch, bp_tgt);
 }
 
 /* Remove a breakpoint.  */
 
 static int
-mips_remove_breakpoint (struct gdbarch *gdbarch,
+mips_remove_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch,
                        struct bp_target_info *bp_tgt)
 {
   if (monitor_supports_breakpoints)
     return mips_clear_breakpoint (bp_tgt->placed_address, MIPS_INSN32_SIZE,
                                  BREAK_FETCH);
   else
-    return memory_remove_breakpoint (gdbarch, bp_tgt);
+    return memory_remove_breakpoint (ops, gdbarch, bp_tgt);
 }
 
 /* Tell whether this target can support a hardware breakpoint.  CNT
index 2c0f3ba21ea2bf1730bdc188cd592f9380a67b18..10aab6676750e0ac00a398e564043b798972ff2b 100644 (file)
@@ -8258,7 +8258,8 @@ remote_add_target_side_commands (struct gdbarch *gdbarch,
    which don't, we insert a traditional memory breakpoint.  */
 
 static int
-remote_insert_breakpoint (struct gdbarch *gdbarch,
+remote_insert_breakpoint (struct target_ops *ops,
+                         struct gdbarch *gdbarch,
                          struct bp_target_info *bp_tgt)
 {
   /* Try the "Z" s/w breakpoint packet if it is not already disabled.
@@ -8320,11 +8321,12 @@ remote_insert_breakpoint (struct gdbarch *gdbarch,
     throw_error (NOT_SUPPORTED_ERROR, _("\
 Target doesn't support breakpoints that have target side commands."));
 
-  return memory_insert_breakpoint (gdbarch, bp_tgt);
+  return memory_insert_breakpoint (ops, gdbarch, bp_tgt);
 }
 
 static int
-remote_remove_breakpoint (struct gdbarch *gdbarch,
+remote_remove_breakpoint (struct target_ops *ops,
+                         struct gdbarch *gdbarch,
                          struct bp_target_info *bp_tgt)
 {
   CORE_ADDR addr = bp_tgt->placed_address;
@@ -8354,7 +8356,7 @@ remote_remove_breakpoint (struct gdbarch *gdbarch,
       return (rs->buf[0] == 'E');
     }
 
-  return memory_remove_breakpoint (gdbarch, bp_tgt);
+  return memory_remove_breakpoint (ops, gdbarch, bp_tgt);
 }
 
 static int
index 5e842884c7ac925b939b72a4567bb2eea8cbf2a4..612d909f045e89e477945d4d53d516e3a7204c38 100644 (file)
@@ -90,10 +90,10 @@ static void debug_to_prepare_to_store (struct target_ops *self,
 
 static void debug_to_files_info (struct target_ops *);
 
-static int debug_to_insert_breakpoint (struct gdbarch *,
+static int debug_to_insert_breakpoint (struct target_ops *, struct gdbarch *,
                                       struct bp_target_info *);
 
-static int debug_to_remove_breakpoint (struct gdbarch *,
+static int debug_to_remove_breakpoint (struct target_ops *, struct gdbarch *,
                                       struct bp_target_info *);
 
 static int debug_to_can_use_hw_breakpoint (int, int, int);
@@ -585,8 +585,8 @@ update_current_target (void)
       INHERIT (to_prepare_to_store, t);
       INHERIT (deprecated_xfer_memory, t);
       INHERIT (to_files_info, t);
-      INHERIT (to_insert_breakpoint, t);
-      INHERIT (to_remove_breakpoint, t);
+      /* Do not inherit to_insert_breakpoint.  */
+      /* Do not inherit to_remove_breakpoint.  */
       INHERIT (to_can_use_hw_breakpoint, t);
       INHERIT (to_insert_hw_breakpoint, t);
       INHERIT (to_remove_hw_breakpoint, t);
@@ -726,10 +726,6 @@ update_current_target (void)
   de_fault (to_files_info,
            (void (*) (struct target_ops *))
            target_ignore);
-  de_fault (to_insert_breakpoint,
-           memory_insert_breakpoint);
-  de_fault (to_remove_breakpoint,
-           memory_remove_breakpoint);
   de_fault (to_can_use_hw_breakpoint,
            (int (*) (int, int, int))
            return_zero);
@@ -2457,6 +2453,22 @@ get_target_memory_unsigned (struct target_ops *ops, CORE_ADDR addr,
   return extract_unsigned_integer (buf, len, byte_order);
 }
 
+/* See target.h.  */
+
+int
+forward_target_insert_breakpoint (struct target_ops *ops,
+                                 struct gdbarch *gdbarch,
+                                 struct bp_target_info *bp_tgt)
+{
+  for (; ops != NULL; ops = ops->beneath)
+    if (ops->to_insert_breakpoint != NULL)
+      return ops->to_insert_breakpoint (ops, gdbarch, bp_tgt);
+
+  return memory_insert_breakpoint (ops, gdbarch, bp_tgt);
+}
+
+/* See target.h.  */
+
 int
 target_insert_breakpoint (struct gdbarch *gdbarch,
                          struct bp_target_info *bp_tgt)
@@ -2467,12 +2479,15 @@ target_insert_breakpoint (struct gdbarch *gdbarch,
       return 1;
     }
 
-  return (*current_target.to_insert_breakpoint) (gdbarch, bp_tgt);
+  return forward_target_insert_breakpoint (&current_target, gdbarch, bp_tgt);
 }
 
+/* See target.h.  */
+
 int
-target_remove_breakpoint (struct gdbarch *gdbarch,
-                         struct bp_target_info *bp_tgt)
+forward_target_remove_breakpoint (struct target_ops *ops,
+                                 struct gdbarch *gdbarch,
+                                 struct bp_target_info *bp_tgt)
 {
   /* This is kind of a weird case to handle, but the permission might
      have been changed after breakpoints were inserted - in which case
@@ -2484,7 +2499,20 @@ target_remove_breakpoint (struct gdbarch *gdbarch,
       return 1;
     }
 
-  return (*current_target.to_remove_breakpoint) (gdbarch, bp_tgt);
+  for (; ops != NULL; ops = ops->beneath)
+    if (ops->to_remove_breakpoint != NULL)
+      return ops->to_remove_breakpoint (ops, gdbarch, bp_tgt);
+
+  return memory_remove_breakpoint (ops, gdbarch, bp_tgt);
+}
+
+/* See target.h.  */
+
+int
+target_remove_breakpoint (struct gdbarch *gdbarch,
+                         struct bp_target_info *bp_tgt)
+{
+  return forward_target_remove_breakpoint (&current_target, gdbarch, bp_tgt);
 }
 
 static void
@@ -4549,12 +4577,12 @@ debug_to_files_info (struct target_ops *target)
 }
 
 static int
-debug_to_insert_breakpoint (struct gdbarch *gdbarch,
+debug_to_insert_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch,
                            struct bp_target_info *bp_tgt)
 {
   int retval;
 
-  retval = debug_target.to_insert_breakpoint (gdbarch, bp_tgt);
+  retval = forward_target_insert_breakpoint (&debug_target, gdbarch, bp_tgt);
 
   fprintf_unfiltered (gdb_stdlog,
                      "target_insert_breakpoint (%s, xxx) = %ld\n",
@@ -4564,12 +4592,12 @@ debug_to_insert_breakpoint (struct gdbarch *gdbarch,
 }
 
 static int
-debug_to_remove_breakpoint (struct gdbarch *gdbarch,
+debug_to_remove_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch,
                            struct bp_target_info *bp_tgt)
 {
   int retval;
 
-  retval = debug_target.to_remove_breakpoint (gdbarch, bp_tgt);
+  retval = forward_target_remove_breakpoint (&debug_target, gdbarch, bp_tgt);
 
   fprintf_unfiltered (gdb_stdlog,
                      "target_remove_breakpoint (%s, xxx) = %ld\n",
index 975225977a8d6a86f5527153fb287c36fd1923a5..79b9886517d78ff6463961c1222fc03d1ee3786d 100644 (file)
@@ -408,8 +408,10 @@ struct target_ops
                                   struct target_ops *target);
 
     void (*to_files_info) (struct target_ops *);
-    int (*to_insert_breakpoint) (struct gdbarch *, struct bp_target_info *);
-    int (*to_remove_breakpoint) (struct gdbarch *, struct bp_target_info *);
+    int (*to_insert_breakpoint) (struct target_ops *, struct gdbarch *,
+                                struct bp_target_info *);
+    int (*to_remove_breakpoint) (struct target_ops *, struct gdbarch *,
+                                struct bp_target_info *);
     int (*to_can_use_hw_breakpoint) (int, int, int);
     int (*to_ranged_break_num_registers) (struct target_ops *);
     int (*to_insert_hw_breakpoint) (struct gdbarch *, struct bp_target_info *);
@@ -1137,6 +1139,16 @@ int target_write_memory_blocks (VEC(memory_write_request_s) *requests,
 #define        target_files_info()     \
      (*current_target.to_files_info) (&current_target)
 
+/* Insert a hardware breakpoint at address BP_TGT->placed_address in
+   the target machine.  Returns 0 for success, and returns non-zero or
+   throws an error (with a detailed failure reason error code and
+   message) otherwise.
+   Start the target search at OPS.  */
+
+extern int forward_target_insert_breakpoint (struct target_ops *ops,
+                                            struct gdbarch *gdbarch,
+                                            struct bp_target_info *bp_tgt);
+
 /* Insert a hardware breakpoint at address BP_TGT->placed_address in
    the target machine.  Returns 0 for success, and returns non-zero or
    throws an error (with a detailed failure reason error code and
@@ -1145,6 +1157,13 @@ int target_write_memory_blocks (VEC(memory_write_request_s) *requests,
 extern int target_insert_breakpoint (struct gdbarch *gdbarch,
                                     struct bp_target_info *bp_tgt);
 
+/* Remove a breakpoint at address BP_TGT->placed_address in the target
+   machine.  Result is 0 for success, non-zero for error.
+   Start the target search at OPS.  */
+
+extern int forward_target_remove_breakpoint (struct target_ops *ops,
+                                            struct gdbarch *gdbarch,
+                                            struct bp_target_info *bp_tgt);
 /* Remove a breakpoint at address BP_TGT->placed_address in the target
    machine.  Result is 0 for success, non-zero for error.  */
 
@@ -1897,10 +1916,10 @@ extern struct target_section_table *target_get_section_table
 
 /* From mem-break.c */
 
-extern int memory_remove_breakpoint (struct gdbarch *,
+extern int memory_remove_breakpoint (struct target_ops *, struct gdbarch *,
                                     struct bp_target_info *);
 
-extern int memory_insert_breakpoint (struct gdbarch *,
+extern int memory_insert_breakpoint (struct target_ops *, struct gdbarch *,
                                     struct bp_target_info *);
 
 extern int default_memory_remove_breakpoint (struct gdbarch *,
This page took 0.05274 seconds and 4 git commands to generate.