- struct bt_plugin **plugins = NULL;
-
- descriptor_count = descriptors_end - descriptors_begin;
- attrs_count = attrs_end - attrs_begin;
- cc_descriptors_count = cc_descriptors_end - cc_descriptors_begin;
- cc_descr_attrs_count = cc_descr_attrs_end - cc_descr_attrs_begin;
- printf_verbose("Section: Plugin descriptors: [%p - %p], (%zu elements)\n",
- descriptors_begin, descriptors_end, descriptor_count);
- printf_verbose("Section: Plugin descriptor attributes: [%p - %p], (%zu elements)\n",
- attrs_begin, attrs_end, attrs_count);
- printf_verbose("Section: Plugin component class descriptors: [%p - %p], (%zu elements)\n",
- cc_descriptors_begin, cc_descriptors_end, cc_descriptors_count);
- printf_verbose("Section: Plugin component class descriptor attributes: [%p - %p], (%zu elements)\n",
- cc_descr_attrs_begin, cc_descr_attrs_end, cc_descr_attrs_count);
- plugins = calloc(descriptor_count + 1, sizeof(*plugins));
- if (!plugins) {
+ struct bt_plugin_set *plugin_set = NULL;
+
+ descriptor_count = count_non_null_items_in_section(descriptors_begin, descriptors_end);
+ attrs_count = count_non_null_items_in_section(attrs_begin, attrs_end);
+ cc_descriptors_count = count_non_null_items_in_section(cc_descriptors_begin, cc_descriptors_end);
+ cc_descr_attrs_count = count_non_null_items_in_section(cc_descr_attrs_begin, cc_descr_attrs_end);
+
+ BT_LOGD("Creating all SO plugins from sections: "
+ "plugin-path=\"%s\", "
+ "descr-begin-addr=%p, descr-end-addr=%p, "
+ "attrs-begin-addr=%p, attrs-end-addr=%p, "
+ "cc-descr-begin-addr=%p, cc-descr-end-addr=%p, "
+ "cc-descr-attrs-begin-addr=%p, cc-descr-attrs-end-addr=%p, "
+ "descr-count=%zu, attrs-count=%zu, "
+ "cc-descr-count=%zu, cc-descr-attrs-count=%zu",
+ shared_lib_handle->path ? shared_lib_handle->path->str : NULL,
+ descriptors_begin, descriptors_end,
+ attrs_begin, attrs_end,
+ cc_descriptors_begin, cc_descriptors_end,
+ cc_descr_attrs_begin, cc_descr_attrs_end,
+ descriptor_count, attrs_count,
+ cc_descriptors_count, cc_descr_attrs_count);
+ plugin_set = bt_plugin_set_create();
+ if (!plugin_set) {
+ BT_LOGE_STR("Cannot create empty plugin set.");