flt.lttng-utils.debug-info: adapt debug-info component to API changes
[babeltrace.git] / plugins / lttng-utils / utils.c
index 80dc87def6cf5c367ea8736e8901e4c61d3c995a..9d8a8c9cc0c73035f4a9ea6550581985cf596350 100644 (file)
@@ -50,3 +50,61 @@ const char *get_filename_from_path(const char *path)
 end:
        return path;
 }
+
+BT_HIDDEN
+bt_bool is_event_common_ctx_dbg_info_compatible(const bt_field_class *in_field_class,
+               const char *debug_info_field_class_name)
+{
+       const bt_field_class *ip_fc, *vpid_fc, *debug_info_fc;
+       bt_bool match = BT_FALSE;
+
+       /*
+        * If the debug info field is already present in the event common
+        * context. Do not try to add it.
+        */
+       debug_info_fc =
+               bt_field_class_structure_borrow_member_field_class_by_name_const(
+                       in_field_class, debug_info_field_class_name);
+       if (debug_info_fc) {
+               goto end;
+       }
+
+       /*
+        * Verify that the ip and vpid field are present and of the right field
+        * class.
+        */
+       ip_fc = bt_field_class_structure_borrow_member_field_class_by_name_const(
+                       in_field_class, IP_FIELD_NAME);
+       if (!ip_fc) {
+               goto end;
+       }
+
+       if (bt_field_class_get_type(ip_fc) !=
+                       BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER) {
+               match = BT_FALSE;
+               goto end;
+       }
+
+       if (bt_field_class_integer_get_field_value_range(ip_fc) != 64) {
+               goto end;
+       }
+
+       vpid_fc = bt_field_class_structure_borrow_member_field_class_by_name_const(
+                       in_field_class, VPID_FIELD_NAME);
+       if (!vpid_fc) {
+               goto end;
+       }
+
+       if (bt_field_class_get_type(vpid_fc) !=
+                       BT_FIELD_CLASS_TYPE_SIGNED_INTEGER) {
+               goto end;
+       }
+
+       if (bt_field_class_integer_get_field_value_range(vpid_fc) != 32) {
+               goto end;
+       }
+
+       match = BT_TRUE;
+end:
+       return match;
+}
This page took 0.02494 seconds and 4 git commands to generate.