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

* record.c (record_stop): Unconditionally delegate.
* target-delegates.c: Rebuild.
* target.c (target_stop_recording): Unconditionally delegate.
* target.h (struct target_ops) <to_stop_recording>: Use
TARGET_DEFAULT_IGNORE.

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

index 644ebfd7ebb9058f2c2eb4ded9998caa8be3b27f..aa699ba93533308bda8dbf2142bc799eb71cc306 100644 (file)
@@ -1,3 +1,11 @@
+2014-02-19  Tom Tromey  <tromey@redhat.com>
+
+       * record.c (record_stop): Unconditionally delegate.
+       * target-delegates.c: Rebuild.
+       * target.c (target_stop_recording): Unconditionally delegate.
+       * target.h (struct target_ops) <to_stop_recording>: Use
+       TARGET_DEFAULT_IGNORE.
+
 2014-02-19  Tom Tromey  <tromey@redhat.com>
 
        * target-delegates.c: Rebuild.
index 9dd02e8eae2989809438efbaa6386d7617d0eee0..5a7a88c347504f718e21f08dcbba217c273a5198 100644 (file)
@@ -114,8 +114,7 @@ record_stop (struct target_ops *t)
 {
   DEBUG ("stop %s", t->to_shortname);
 
-  if (t->to_stop_recording != NULL)
-    t->to_stop_recording (t);
+  t->to_stop_recording (t);
 }
 
 /* Unpush the record target.  */
index df17c7b62b2b9e47863e6ec4ed08c13bd12c040a..4b90a2f2badfb0a7dadf67d3bac403df0dbe59a6 100644 (file)
@@ -1352,6 +1352,18 @@ tdefault_read_btrace (struct target_ops *self, VEC (btrace_block_s) **arg1, stru
   tcomplain ();
 }
 
+static void
+delegate_stop_recording (struct target_ops *self)
+{
+  self = self->beneath;
+  self->to_stop_recording (self);
+}
+
+static void
+tdefault_stop_recording (struct target_ops *self)
+{
+}
+
 static void
 delegate_save_record (struct target_ops *self, const char *arg1)
 {
@@ -1752,6 +1764,8 @@ install_delegators (struct target_ops *ops)
     ops->to_teardown_btrace = delegate_teardown_btrace;
   if (ops->to_read_btrace == NULL)
     ops->to_read_btrace = delegate_read_btrace;
+  if (ops->to_stop_recording == NULL)
+    ops->to_stop_recording = delegate_stop_recording;
   if (ops->to_save_record == NULL)
     ops->to_save_record = delegate_save_record;
   if (ops->to_delete_record == NULL)
@@ -1897,6 +1911,7 @@ install_dummy_methods (struct target_ops *ops)
   ops->to_disable_btrace = tdefault_disable_btrace;
   ops->to_teardown_btrace = tdefault_teardown_btrace;
   ops->to_read_btrace = tdefault_read_btrace;
+  ops->to_stop_recording = tdefault_stop_recording;
   ops->to_save_record = tdefault_save_record;
   ops->to_delete_record = tdefault_delete_record;
   ops->to_record_is_replaying = tdefault_record_is_replaying;
index 547afcc8e278d4cdedc7da90d73cec0516aeefb6..ef7374e1b998a01fc459d4b98c391b20a43c333e 100644 (file)
@@ -3818,16 +3818,7 @@ target_read_btrace (VEC (btrace_block_s) **btrace,
 void
 target_stop_recording (void)
 {
-  struct target_ops *t;
-
-  for (t = current_target.beneath; t != NULL; t = t->beneath)
-    if (t->to_stop_recording != NULL)
-      {
-       t->to_stop_recording (t);
-       return;
-      }
-
-  /* This is optional.  */
+  current_target.to_stop_recording (&current_target);
 }
 
 /* See target.h.  */
index bbc0ecd528661e2fcb67e44b6a26553d72fa1f73..1437cc4c9174069037f4cdb8c608f2ec7e817dd1 100644 (file)
@@ -1028,7 +1028,8 @@ struct target_ops
       TARGET_DEFAULT_NORETURN (tcomplain ());
 
     /* Stop trace recording.  */
-    void (*to_stop_recording) (struct target_ops *);
+    void (*to_stop_recording) (struct target_ops *)
+      TARGET_DEFAULT_IGNORE ();
 
     /* Print information about the recording.  */
     void (*to_info_record) (struct target_ops *);