debug-info: sync the copied trace on static change
[babeltrace.git] / plugins / libctfcopytrace / ctfcopytrace.c
index 54a7fd14d175221989e01cf9ecabd0915d4a3f28..b8e281355b05abc44d798b8c337586719f28127e 100644 (file)
@@ -318,6 +318,22 @@ enum bt_component_status ctf_copy_event_classes(FILE *err,
                        ret = BT_COMPONENT_STATUS_ERROR;
                        goto error;
                }
+               if (i < bt_ctf_stream_class_get_event_class_count(writer_stream_class)) {
+                       writer_event_class = bt_ctf_stream_class_get_event_class_by_index(
+                                       writer_stream_class, i);
+                       if (writer_event_class) {
+                               /*
+                                * If the writer_event_class already exists,
+                                * just skip it. It can be used to resync the
+                                * event_classes after a trace has become
+                                * static.
+                                */
+                               BT_PUT(writer_event_class);
+                               BT_PUT(event_class);
+                               continue;
+                       }
+               }
+
                writer_event_class = ctf_copy_event_class(err, event_class);
                if (!writer_event_class) {
                        fprintf(err, "[error] %s in %s:%d\n", __func__,
This page took 0.023368 seconds and 4 git commands to generate.