convert to_enable_btrace
authorTom Tromey <tromey@redhat.com>
Thu, 19 Dec 2013 15:19:41 +0000 (08:19 -0700)
committerTom Tromey <tromey@redhat.com>
Wed, 19 Feb 2014 14:48:38 +0000 (07:48 -0700)
2014-02-19  Tom Tromey  <tromey@redhat.com>

* target-delegates.c: Rebuild.
* target.c (target_enable_btrace): Unconditionally delegate.
* target.h (struct target_ops) <to_enable_btrace>: Use
TARGET_DEFAULT_NORETURN.

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

index 3cdb9fe..644ebfd 100644 (file)
@@ -1,6 +1,13 @@
 2014-02-19  Tom Tromey  <tromey@redhat.com>
 
        * target-delegates.c: Rebuild.
+       * target.c (target_enable_btrace): Unconditionally delegate.
+       * target.h (struct target_ops) <to_enable_btrace>: Use
+       TARGET_DEFAULT_NORETURN.
+
+2014-02-19  Tom Tromey  <tromey@redhat.com>
+
+       * target-delegates.c: Rebuild.
        * target.c (target_read_btrace): Unconditionally delegate.
        * target.h (struct target_ops) <to_read_btrace>: Use
        TARGET_DEFAULT_NORETURN.
index 1b956d2..df17c7b 100644 (file)
@@ -1300,6 +1300,19 @@ tdefault_supports_btrace (struct target_ops *self)
   return 0;
 }
 
+static struct btrace_target_info *
+delegate_enable_btrace (struct target_ops *self, ptid_t arg1)
+{
+  self = self->beneath;
+  return self->to_enable_btrace (self, arg1);
+}
+
+static struct btrace_target_info *
+tdefault_enable_btrace (struct target_ops *self, ptid_t arg1)
+{
+  tcomplain ();
+}
+
 static void
 delegate_disable_btrace (struct target_ops *self, struct btrace_target_info *arg1)
 {
@@ -1731,6 +1744,8 @@ install_delegators (struct target_ops *ops)
     ops->to_can_use_agent = delegate_can_use_agent;
   if (ops->to_supports_btrace == NULL)
     ops->to_supports_btrace = delegate_supports_btrace;
+  if (ops->to_enable_btrace == NULL)
+    ops->to_enable_btrace = delegate_enable_btrace;
   if (ops->to_disable_btrace == NULL)
     ops->to_disable_btrace = delegate_disable_btrace;
   if (ops->to_teardown_btrace == NULL)
@@ -1878,6 +1893,7 @@ install_dummy_methods (struct target_ops *ops)
   ops->to_use_agent = tdefault_use_agent;
   ops->to_can_use_agent = tdefault_can_use_agent;
   ops->to_supports_btrace = tdefault_supports_btrace;
+  ops->to_enable_btrace = tdefault_enable_btrace;
   ops->to_disable_btrace = tdefault_disable_btrace;
   ops->to_teardown_btrace = tdefault_teardown_btrace;
   ops->to_read_btrace = tdefault_read_btrace;
index 75d961b..547afcc 100644 (file)
@@ -3784,14 +3784,7 @@ target_ranged_break_num_registers (void)
 struct btrace_target_info *
 target_enable_btrace (ptid_t ptid)
 {
-  struct target_ops *t;
-
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
-    if (t->to_enable_btrace != NULL)
-      return t->to_enable_btrace (t, ptid);
-
-  tcomplain ();
-  return NULL;
+  return current_target.to_enable_btrace (&current_target, ptid);
 }
 
 /* See target.h.  */
index 13090e1..bbc0ecd 100644 (file)
@@ -1001,7 +1001,8 @@ struct target_ops
     /* Enable branch tracing for PTID and allocate a branch trace target
        information struct for reading and for disabling branch trace.  */
     struct btrace_target_info *(*to_enable_btrace) (struct target_ops *,
-                                                   ptid_t ptid);
+                                                   ptid_t ptid)
+      TARGET_DEFAULT_NORETURN (tcomplain ());
 
     /* Disable branch tracing and deallocate TINFO.  */
     void (*to_disable_btrace) (struct target_ops *,