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

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

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

index 45d853c1e9930a57339a3104b4958261c41b9d61..4217562329d2d39fe93a214e057ab2b91f937794 100644 (file)
@@ -1,3 +1,11 @@
+2014-02-19  Tom Tromey  <tromey@redhat.com>
+
+       * target-delegates.c: Rebuild.
+       * target.c (target_masked_watch_num_registers): Unconditionally
+       delegate.
+       * target.h (struct target_ops) <to_masked_watch_num_registers>:
+       Use TARGET_DEFAULT_RETURN.
+
 2014-02-19  Tom Tromey  <tromey@redhat.com>
 
        * target-delegates.c: Rebuild.
index 164739ddee6ad001814ef2d9128e12e0a92ba72b..9d7065caf4729b053104a9b544f97519693da9bf 100644 (file)
@@ -281,6 +281,19 @@ tdefault_can_accel_watchpoint_condition (struct target_ops *self, CORE_ADDR arg1
   return 0;
 }
 
+static int
+delegate_masked_watch_num_registers (struct target_ops *self, CORE_ADDR arg1, CORE_ADDR arg2)
+{
+  self = self->beneath;
+  return self->to_masked_watch_num_registers (self, arg1, arg2);
+}
+
+static int
+tdefault_masked_watch_num_registers (struct target_ops *self, CORE_ADDR arg1, CORE_ADDR arg2)
+{
+  return -1;
+}
+
 static void
 delegate_terminal_init (struct target_ops *self)
 {
@@ -1176,6 +1189,8 @@ install_delegators (struct target_ops *ops)
     ops->to_region_ok_for_hw_watchpoint = delegate_region_ok_for_hw_watchpoint;
   if (ops->to_can_accel_watchpoint_condition == NULL)
     ops->to_can_accel_watchpoint_condition = delegate_can_accel_watchpoint_condition;
+  if (ops->to_masked_watch_num_registers == NULL)
+    ops->to_masked_watch_num_registers = delegate_masked_watch_num_registers;
   if (ops->to_terminal_init == NULL)
     ops->to_terminal_init = delegate_terminal_init;
   if (ops->to_terminal_inferior == NULL)
@@ -1345,6 +1360,7 @@ install_dummy_methods (struct target_ops *ops)
   ops->to_watchpoint_addr_within_range = default_watchpoint_addr_within_range;
   ops->to_region_ok_for_hw_watchpoint = default_region_ok_for_hw_watchpoint;
   ops->to_can_accel_watchpoint_condition = tdefault_can_accel_watchpoint_condition;
+  ops->to_masked_watch_num_registers = tdefault_masked_watch_num_registers;
   ops->to_terminal_init = tdefault_terminal_init;
   ops->to_terminal_inferior = tdefault_terminal_inferior;
   ops->to_terminal_ours_for_output = tdefault_terminal_ours_for_output;
index 6f1c1bc7a606f100a581475268fee74e43bab217..8306906b84b4287dacff95fb1a388d63298addd8 100644 (file)
@@ -3870,13 +3870,8 @@ target_remove_mask_watchpoint (%s, %s, %d) = %d\n",
 int
 target_masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask)
 {
-  struct target_ops *t;
-
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
-    if (t->to_masked_watch_num_registers != NULL)
-      return t->to_masked_watch_num_registers (t, addr, mask);
-
-  return -1;
+  return current_target.to_masked_watch_num_registers (&current_target,
+                                                      addr, mask);
 }
 
 /* The documentation for this function is in its prototype declaration
index 4af2148465c3e7cc8e9d7012f302a986f4d29065..696020cfced902346644e7a5fd624cf0cfb7ebaa 100644 (file)
@@ -503,7 +503,8 @@ struct target_ops
                                              struct expression *)
       TARGET_DEFAULT_RETURN (0);
     int (*to_masked_watch_num_registers) (struct target_ops *,
-                                         CORE_ADDR, CORE_ADDR);
+                                         CORE_ADDR, CORE_ADDR)
+      TARGET_DEFAULT_RETURN (-1);
     void (*to_terminal_init) (struct target_ops *)
       TARGET_DEFAULT_IGNORE ();
     void (*to_terminal_inferior) (struct target_ops *)