convert to_ranged_break_num_registers
authorTom Tromey <tromey@redhat.com>
Wed, 18 Dec 2013 21:31:42 +0000 (14:31 -0700)
committerTom Tromey <tromey@redhat.com>
Wed, 19 Feb 2014 14:48:08 +0000 (07:48 -0700)
2014-02-19  Tom Tromey  <tromey@redhat.com>

* target-delegates.c: Rebuild.
* target.c (target_ranged_break_num_registers): Unconditionally
delegate.
* target.h (struct target_ops) <to_ranged_break_num_registers>:
Use TARGET_DEFAULT_RETURN.

gdb/ChangeLog
gdb/target-delegates.c
gdb/target.c
gdb/target.h

index 1f352eaf688247b3360633aaf1dfbca936257dc8..1e001189b9316b2f94523457f9e9a31fcfd8a49c 100644 (file)
@@ -1,3 +1,11 @@
+2014-02-19  Tom Tromey  <tromey@redhat.com>
+
+       * target-delegates.c: Rebuild.
+       * target.c (target_ranged_break_num_registers): Unconditionally
+       delegate.
+       * target.h (struct target_ops) <to_ranged_break_num_registers>:
+       Use TARGET_DEFAULT_RETURN.
+
 2014-02-19  Tom Tromey  <tromey@redhat.com>
 
        * target-delegates.c: Rebuild.
index f813e35f329a57e099ffbc932b72f6db73fea693..3def7634c1825f0f68998c66a9b7f98ec9cdcfad 100644 (file)
@@ -137,6 +137,19 @@ tdefault_can_use_hw_breakpoint (struct target_ops *self, int arg1, int arg2, int
   return 0;
 }
 
+static int
+delegate_ranged_break_num_registers (struct target_ops *self)
+{
+  self = self->beneath;
+  return self->to_ranged_break_num_registers (self);
+}
+
+static int
+tdefault_ranged_break_num_registers (struct target_ops *self)
+{
+  return -1;
+}
+
 static int
 delegate_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *arg1, struct bp_target_info *arg2)
 {
@@ -1113,6 +1126,8 @@ install_delegators (struct target_ops *ops)
     ops->to_remove_breakpoint = delegate_remove_breakpoint;
   if (ops->to_can_use_hw_breakpoint == NULL)
     ops->to_can_use_hw_breakpoint = delegate_can_use_hw_breakpoint;
+  if (ops->to_ranged_break_num_registers == NULL)
+    ops->to_ranged_break_num_registers = delegate_ranged_break_num_registers;
   if (ops->to_insert_hw_breakpoint == NULL)
     ops->to_insert_hw_breakpoint = delegate_insert_hw_breakpoint;
   if (ops->to_remove_hw_breakpoint == NULL)
@@ -1288,6 +1303,7 @@ install_dummy_methods (struct target_ops *ops)
   ops->to_insert_breakpoint = memory_insert_breakpoint;
   ops->to_remove_breakpoint = memory_remove_breakpoint;
   ops->to_can_use_hw_breakpoint = tdefault_can_use_hw_breakpoint;
+  ops->to_ranged_break_num_registers = tdefault_ranged_break_num_registers;
   ops->to_insert_hw_breakpoint = tdefault_insert_hw_breakpoint;
   ops->to_remove_hw_breakpoint = tdefault_remove_hw_breakpoint;
   ops->to_remove_watchpoint = tdefault_remove_watchpoint;
index f656db371739d31ab5c08e202bb914732234fd34..d4e58b06bfe399e75e44a2128fee7cf71bc6c086 100644 (file)
@@ -3899,13 +3899,7 @@ target_masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask)
 int
 target_ranged_break_num_registers (void)
 {
-  struct target_ops *t;
-
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
-    if (t->to_ranged_break_num_registers != NULL)
-      return t->to_ranged_break_num_registers (t);
-
-  return -1;
+  return current_target.to_ranged_break_num_registers (&current_target);
 }
 
 /* See target.h.  */
index 0aee7a9d51dcd0cdb4bf7580194b4d145bf5ae2c..25e98ed35b24614ef790e73454d07334da3b2048 100644 (file)
@@ -458,7 +458,8 @@ struct target_ops
       TARGET_DEFAULT_FUNC (memory_remove_breakpoint);
     int (*to_can_use_hw_breakpoint) (struct target_ops *, int, int, int)
       TARGET_DEFAULT_RETURN (0);
-    int (*to_ranged_break_num_registers) (struct target_ops *);
+    int (*to_ranged_break_num_registers) (struct target_ops *)
+      TARGET_DEFAULT_RETURN (-1);
     int (*to_insert_hw_breakpoint) (struct target_ops *,
                                    struct gdbarch *, struct bp_target_info *)
       TARGET_DEFAULT_RETURN (-1);