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

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

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

index 6b61768062b100deef8e4de4bdb8c02456db3621..0402da30bae30b8b2ab5fab2950252cf87f7cba9 100644 (file)
@@ -1,3 +1,10 @@
+2014-02-19  Tom Tromey  <tromey@redhat.com>
+
+       * target-delegates.c: Rebuild.
+       * target.c (target_teardown_btrace): Unconditionally delegate.
+       * target.h (struct target_ops) <to_teardown_btrace>: Use
+       TARGET_DEFAULT_NORETURN.
+
 2014-02-19  Tom Tromey  <tromey@redhat.com>
 
        * target-delegates.c: Rebuild.
index 30c2849be15e2227fc914dccf5b1b5b46a2ae083..800a37c79faca78f84d7422f4daf127b4012730d 100644 (file)
@@ -1313,6 +1313,19 @@ tdefault_disable_btrace (struct target_ops *self, struct btrace_target_info *arg
   tcomplain ();
 }
 
+static void
+delegate_teardown_btrace (struct target_ops *self, struct btrace_target_info *arg1)
+{
+  self = self->beneath;
+  self->to_teardown_btrace (self, arg1);
+}
+
+static void
+tdefault_teardown_btrace (struct target_ops *self, struct btrace_target_info *arg1)
+{
+  tcomplain ();
+}
+
 static void
 delegate_save_record (struct target_ops *self, const char *arg1)
 {
@@ -1707,6 +1720,8 @@ install_delegators (struct target_ops *ops)
     ops->to_supports_btrace = delegate_supports_btrace;
   if (ops->to_disable_btrace == NULL)
     ops->to_disable_btrace = delegate_disable_btrace;
+  if (ops->to_teardown_btrace == NULL)
+    ops->to_teardown_btrace = delegate_teardown_btrace;
   if (ops->to_save_record == NULL)
     ops->to_save_record = delegate_save_record;
   if (ops->to_delete_record == NULL)
@@ -1849,6 +1864,7 @@ install_dummy_methods (struct target_ops *ops)
   ops->to_can_use_agent = tdefault_can_use_agent;
   ops->to_supports_btrace = tdefault_supports_btrace;
   ops->to_disable_btrace = tdefault_disable_btrace;
+  ops->to_teardown_btrace = tdefault_teardown_btrace;
   ops->to_save_record = tdefault_save_record;
   ops->to_delete_record = tdefault_delete_record;
   ops->to_record_is_replaying = tdefault_record_is_replaying;
index 2914a2aa681b943448fe1612a1abc1b467660cfd..85ee3312c9c20fd67148286643013fa1949b4d1f 100644 (file)
@@ -3807,16 +3807,7 @@ target_disable_btrace (struct btrace_target_info *btinfo)
 void
 target_teardown_btrace (struct btrace_target_info *btinfo)
 {
-  struct target_ops *t;
-
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
-    if (t->to_teardown_btrace != NULL)
-      {
-       t->to_teardown_btrace (t, btinfo);
-       return;
-      }
-
-  tcomplain ();
+  current_target.to_teardown_btrace (&current_target, btinfo);
 }
 
 /* See target.h.  */
index eed1d6638e5301e9b4715faa8f6eea078ef35e84..8898438519bacf3aab3f75f5d435d4c4ab434b88 100644 (file)
@@ -1013,7 +1013,8 @@ struct target_ops
        only allowed to perform actions that are safe.  A counter-example would
        be attempting to talk to a remote target.  */
     void (*to_teardown_btrace) (struct target_ops *,
-                               struct btrace_target_info *tinfo);
+                               struct btrace_target_info *tinfo)
+      TARGET_DEFAULT_NORETURN (tcomplain ());
 
     /* Read branch trace data for the thread indicated by BTINFO into DATA.
        DATA is cleared before new trace is added.