LTTNG_UTILS_PLUGIN_PATH += :$(PLUGINS_PATH)/lttng-utils
endif
+if BABELTRACE_BUILD_WITH_MINGW
+IN_TREE_PLUGIN_PATH := $(shell cygpath -pm "$(PLUGINS_PATH)/ctf:$(PLUGINS_PATH)/text:$(PLUGINS_PATH)/utils$(LTTNG_UTILS_PLUGIN_PATH)")
+else
IN_TREE_PLUGIN_PATH = $(PLUGINS_PATH)/ctf:$(PLUGINS_PATH)/text:$(PLUGINS_PATH)/utils$(LTTNG_UTILS_PLUGIN_PATH)
+endif
AM_CFLAGS = $(PACKAGE_CFLAGS) -I$(top_srcdir)/include \
'-DCONFIG_IN_TREE_PLUGIN_PATH="$(IN_TREE_PLUGIN_PATH)"'
while (at < end) {
GString *path;
- const char *next_colon;
+ const char *next_sep;
- next_colon = strchr(at, ':');
- if (next_colon == at) {
+ next_sep = strchr(at, G_SEARCHPATH_SEPARATOR);
+ if (next_sep == at) {
/*
* Empty path: try next character (supported
* to conform to the typical parsing of $PATH).
*/
at++;
continue;
- } else if (!next_colon) {
- /* No more colon: use the remaining */
- next_colon = paths + strlen(paths);
+ } else if (!next_sep) {
+ /* No more separator: use the remaining */
+ next_sep = paths + strlen(paths);
}
path = g_string_new(NULL);
goto error;
}
- g_string_append_len(path, at, next_colon - at);
- at = next_colon + 1;
+ g_string_append_len(path, at, next_sep - at);
+ at = next_sep + 1;
g_ptr_array_add(dirs, path);
}
*/
#include <stdint.h>
+#include <babeltrace/babeltrace-internal.h>
#include <babeltrace/plugin/plugin.h>
#include <babeltrace/graph/component-class.h>
#include <babeltrace/graph/component-class-source.h>
} value;
} __attribute__((packed));
+struct __bt_plugin_descriptor const * const *__bt_get_begin_section_plugin_descriptors(void);
+struct __bt_plugin_descriptor const * const *__bt_get_end_section_plugin_descriptors(void);
+struct __bt_plugin_descriptor_attribute const * const *__bt_get_begin_section_plugin_descriptor_attributes(void);
+struct __bt_plugin_descriptor_attribute const * const *__bt_get_end_section_plugin_descriptor_attributes(void);
+struct __bt_plugin_component_class_descriptor const * const *__bt_get_begin_section_component_class_descriptors(void);
+struct __bt_plugin_component_class_descriptor const * const *__bt_get_end_section_component_class_descriptors(void);
+struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_begin_section_component_class_descriptor_attributes(void);
+struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_end_section_component_class_descriptor_attributes(void);
+
/*
* Variable attributes for a plugin descriptor pointer to be added to
* the plugin descriptor section (internal use).
*/
+#ifdef __APPLE__
+#define __BT_PLUGIN_DESCRIPTOR_ATTRS \
+ __attribute__((section("__DATA,btp_desc"), used))
+
+#define __BT_PLUGIN_DESCRIPTOR_BEGIN_SYMBOL \
+ __start___bt_plugin_descriptors
+
+#define __BT_PLUGIN_DESCRIPTOR_END_SYMBOL \
+ __stop___bt_plugin_descriptors
+
+#define __BT_PLUGIN_DESCRIPTOR_BEGIN_EXTRA \
+ __asm("section$start$__DATA$btp_desc")
+
+#define __BT_PLUGIN_DESCRIPTOR_END_EXTRA \
+ __asm("section$end$__DATA$btp_desc")
+
+#else
+
#define __BT_PLUGIN_DESCRIPTOR_ATTRS \
__attribute__((section("__bt_plugin_descriptors"), used))
+#define __BT_PLUGIN_DESCRIPTOR_BEGIN_SYMBOL \
+ __start___bt_plugin_descriptors
+
+#define __BT_PLUGIN_DESCRIPTOR_END_SYMBOL \
+ __stop___bt_plugin_descriptors
+
+#define __BT_PLUGIN_DESCRIPTOR_BEGIN_EXTRA
+
+#define __BT_PLUGIN_DESCRIPTOR_END_EXTRA
+#endif
+
/*
* Variable attributes for a plugin attribute pointer to be added to
* the plugin attribute section (internal use).
*/
+#ifdef __APPLE__
+#define __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_ATTRS \
+ __attribute__((section("__DATA,btp_desc_att"), used))
+
+#define __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_BEGIN_SYMBOL \
+ __start___bt_plugin_descriptor_attributes
+
+#define __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_END_SYMBOL \
+ __stop___bt_plugin_descriptor_attributes
+
+#define __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_BEGIN_EXTRA \
+ __asm("section$start$__DATA$btp_desc_att")
+
+#define __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_END_EXTRA \
+ __asm("section$end$__DATA$btp_desc_att")
+
+#else
+
#define __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_ATTRS \
__attribute__((section("__bt_plugin_descriptor_attributes"), used))
+#define __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_BEGIN_SYMBOL \
+ __start___bt_plugin_descriptor_attributes
+
+#define __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_END_SYMBOL \
+ __stop___bt_plugin_descriptor_attributes
+
+#define __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_BEGIN_EXTRA
+
+#define __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_END_EXTRA
+#endif
+
/*
* Variable attributes for a component class descriptor pointer to be
* added to the component class descriptor section (internal use).
*/
+#ifdef __APPLE__
+#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS \
+ __attribute__((section("__DATA,btp_cc_desc"), used))
+
+#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_BEGIN_SYMBOL \
+ __start___bt_plugin_component_class_descriptors
+
+#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_END_SYMBOL \
+ __stop___bt_plugin_component_class_descriptors
+
+#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_BEGIN_EXTRA \
+ __asm("section$start$__DATA$btp_cc_desc")
+
+#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_END_EXTRA \
+ __asm("section$end$__DATA$btp_cc_desc")
+
+#else
+
#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS \
__attribute__((section("__bt_plugin_component_class_descriptors"), used))
+#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_BEGIN_SYMBOL \
+ __start___bt_plugin_component_class_descriptors
+
+#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_END_SYMBOL \
+ __stop___bt_plugin_component_class_descriptors
+
+#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_BEGIN_EXTRA
+
+#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_END_EXTRA
+#endif
+
/*
* Variable attributes for a component class descriptor attribute
* pointer to be added to the component class descriptor attribute
* section (internal use).
*/
+#ifdef __APPLE__
+#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_ATTRS \
+ __attribute__((section("__DATA,btp_cc_desc_att"), used))
+
+#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_BEGIN_SYMBOL \
+ __start___bt_plugin_component_class_descriptor_attributes
+
+#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_END_SYMBOL \
+ __stop___bt_plugin_component_class_descriptor_attributes
+
+#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_BEGIN_EXTRA \
+ __asm("section$start$__DATA$btp_cc_desc_att")
+
+#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_END_EXTRA \
+ __asm("section$end$__DATA$btp_cc_desc_att")
+
+#else
+
#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_ATTRS \
__attribute__((section("__bt_plugin_component_class_descriptor_attributes"), used))
+#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_BEGIN_SYMBOL \
+ __start___bt_plugin_component_class_descriptor_attributes
+
+#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_END_SYMBOL \
+ __stop___bt_plugin_component_class_descriptor_attributes
+
+#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_BEGIN_EXTRA
+
+#define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_END_EXTRA
+#endif
+
/*
* Declares a plugin descriptor pointer variable with a custom ID.
*
.minor = __BT_PLUGIN_VERSION_MINOR, \
.name = _name, \
}; \
- static struct __bt_plugin_descriptor const * const __bt_plugin_descriptor_##_id##_ptr __BT_PLUGIN_DESCRIPTOR_ATTRS = &__bt_plugin_descriptor_##_id; \
- extern struct __bt_plugin_descriptor const *__start___bt_plugin_descriptors; \
- extern struct __bt_plugin_descriptor const *__stop___bt_plugin_descriptors
+ static struct __bt_plugin_descriptor const * const __bt_plugin_descriptor_##_id##_ptr __BT_PLUGIN_DESCRIPTOR_ATTRS = &__bt_plugin_descriptor_##_id
/*
* Defines a plugin attribute (generic, internal use).
.type = _attr_type, \
.value._attr_name = _x, \
}; \
- static struct __bt_plugin_descriptor_attribute const * const __bt_plugin_descriptor_attribute_##_id##_##_attr_name##_ptr __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_ATTRS = &__bt_plugin_descriptor_attribute_##_id##_##_attr_name; \
- extern struct __bt_plugin_descriptor_attribute const *__start___bt_plugin_descriptor_attributes; \
- extern struct __bt_plugin_descriptor_attribute const *__stop___bt_plugin_descriptor_attributes
+ static struct __bt_plugin_descriptor_attribute const * const __bt_plugin_descriptor_attribute_##_id##_##_attr_name##_ptr __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_ATTRS = &__bt_plugin_descriptor_attribute_##_id##_##_attr_name
/*
* Defines a plugin initialization function attribute attached to a
#define BT_PLUGIN_VERSION_WITH_ID(_id, _major, _minor, _patch, _extra) \
__BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(version, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_VERSION, _id, __BT_PLUGIN_VERSION_STRUCT_VALUE(_major, _minor, _patch, _extra))
-/*
- * Declaration of start and stop symbols of component class descriptors
- * section.
- */
-#define __BT_PLUGIN_DECL_COMPONENT_CLASS_DESCRIPTORS_SECTION_START_STOP \
- extern struct __bt_plugin_component_class_descriptor const *__start___bt_plugin_component_class_descriptors; \
- extern struct __bt_plugin_component_class_descriptor const *__stop___bt_plugin_component_class_descriptors
-
/*
* Defines a source component class descriptor with a custom ID.
*
.notif_iter_next = _notif_iter_next_method, \
}, \
}; \
- static struct __bt_plugin_component_class_descriptor const * const __bt_plugin_source_component_class_descriptor_##_id##_##_comp_class_id##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS = &__bt_plugin_source_component_class_descriptor_##_id##_##_comp_class_id; \
- __BT_PLUGIN_DECL_COMPONENT_CLASS_DESCRIPTORS_SECTION_START_STOP
+ static struct __bt_plugin_component_class_descriptor const * const __bt_plugin_source_component_class_descriptor_##_id##_##_comp_class_id##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS = &__bt_plugin_source_component_class_descriptor_##_id##_##_comp_class_id
/*
* Defines a filter component class descriptor with a custom ID.
.notif_iter_next = _notif_iter_next_method, \
}, \
}; \
- static struct __bt_plugin_component_class_descriptor const * const __bt_plugin_filter_component_class_descriptor_##_id##_##_comp_class_id##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS = &__bt_plugin_filter_component_class_descriptor_##_id##_##_comp_class_id; \
- __BT_PLUGIN_DECL_COMPONENT_CLASS_DESCRIPTORS_SECTION_START_STOP
+ static struct __bt_plugin_component_class_descriptor const * const __bt_plugin_filter_component_class_descriptor_##_id##_##_comp_class_id##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS = &__bt_plugin_filter_component_class_descriptor_##_id##_##_comp_class_id
/*
* Defines a sink component class descriptor with a custom ID.
.consume = _consume_method, \
}, \
}; \
- static struct __bt_plugin_component_class_descriptor const * const __bt_plugin_sink_component_class_descriptor_##_id##_##_comp_class_id##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS = &__bt_plugin_sink_component_class_descriptor_##_id##_##_comp_class_id; \
- __BT_PLUGIN_DECL_COMPONENT_CLASS_DESCRIPTORS_SECTION_START_STOP
+ static struct __bt_plugin_component_class_descriptor const * const __bt_plugin_sink_component_class_descriptor_##_id##_##_comp_class_id##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS = &__bt_plugin_sink_component_class_descriptor_##_id##_##_comp_class_id
/*
* Defines a component class descriptor attribute (generic, internal
.type = _attr_type, \
.value._attr_name = _x, \
}; \
- static struct __bt_plugin_component_class_descriptor_attribute const * const __bt_plugin_##_type##_component_class_descriptor_attribute_##_id##_##_comp_class_id##_##_attr_name##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_ATTRS = &__bt_plugin_##_type##_component_class_descriptor_attribute_##_id##_##_comp_class_id##_##_attr_name; \
- extern struct __bt_plugin_component_class_descriptor_attribute const *__start___bt_plugin_component_class_descriptor_attributes; \
- extern struct __bt_plugin_component_class_descriptor_attribute const *__stop___bt_plugin_component_class_descriptor_attributes
+ static struct __bt_plugin_component_class_descriptor_attribute const * const __bt_plugin_##_type##_component_class_descriptor_attribute_##_id##_##_comp_class_id##_##_attr_name##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_ATTRS = &__bt_plugin_##_type##_component_class_descriptor_attribute_##_id##_##_comp_class_id##_##_attr_name
/*
* Defines a description attribute attached to a specific source
#define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD(_name, _x) \
BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD_WITH_ID(auto, _name, _x)
+#define BT_PLUGIN_MODULE() \
+ static struct __bt_plugin_descriptor const * const __bt_plugin_descriptor_dummy __BT_PLUGIN_DESCRIPTOR_ATTRS = NULL; \
+ BT_HIDDEN extern struct __bt_plugin_descriptor const *__BT_PLUGIN_DESCRIPTOR_BEGIN_SYMBOL __BT_PLUGIN_DESCRIPTOR_BEGIN_EXTRA; \
+ BT_HIDDEN extern struct __bt_plugin_descriptor const *__BT_PLUGIN_DESCRIPTOR_END_SYMBOL __BT_PLUGIN_DESCRIPTOR_END_EXTRA; \
+ \
+ static struct __bt_plugin_descriptor_attribute const * const __bt_plugin_descriptor_attribute_dummy __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_ATTRS = NULL; \
+ BT_HIDDEN extern struct __bt_plugin_descriptor_attribute const *__BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_BEGIN_SYMBOL __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_BEGIN_EXTRA; \
+ BT_HIDDEN extern struct __bt_plugin_descriptor_attribute const *__BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_END_SYMBOL __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_END_EXTRA; \
+ \
+ static struct __bt_plugin_component_class_descriptor const * const __bt_plugin_component_class_descriptor_dummy __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS = NULL; \
+ BT_HIDDEN extern struct __bt_plugin_component_class_descriptor const *__BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_BEGIN_SYMBOL __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_BEGIN_EXTRA; \
+ BT_HIDDEN extern struct __bt_plugin_component_class_descriptor const *__BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_END_SYMBOL __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_END_EXTRA; \
+ \
+ static struct __bt_plugin_component_class_descriptor_attribute const * const __bt_plugin_component_class_descriptor_attribute_dummy __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_ATTRS = NULL; \
+ BT_HIDDEN extern struct __bt_plugin_component_class_descriptor_attribute const *__BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_BEGIN_SYMBOL __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_BEGIN_EXTRA; \
+ BT_HIDDEN extern struct __bt_plugin_component_class_descriptor_attribute const *__BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_END_SYMBOL __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_END_EXTRA; \
+ \
+ struct __bt_plugin_descriptor const * const *__bt_get_begin_section_plugin_descriptors(void) \
+ { \
+ return &__BT_PLUGIN_DESCRIPTOR_BEGIN_SYMBOL; \
+ } \
+ struct __bt_plugin_descriptor const * const *__bt_get_end_section_plugin_descriptors(void) \
+ { \
+ return &__BT_PLUGIN_DESCRIPTOR_END_SYMBOL; \
+ } \
+ struct __bt_plugin_descriptor_attribute const * const *__bt_get_begin_section_plugin_descriptor_attributes(void) \
+ { \
+ return &__BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_BEGIN_SYMBOL; \
+ } \
+ struct __bt_plugin_descriptor_attribute const * const *__bt_get_end_section_plugin_descriptor_attributes(void) \
+ { \
+ return &__BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_END_SYMBOL; \
+ } \
+ struct __bt_plugin_component_class_descriptor const * const *__bt_get_begin_section_component_class_descriptors(void) \
+ { \
+ return &__BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_BEGIN_SYMBOL; \
+ } \
+ struct __bt_plugin_component_class_descriptor const * const *__bt_get_end_section_component_class_descriptors(void) \
+ { \
+ return &__BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_END_SYMBOL; \
+ } \
+ struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_begin_section_component_class_descriptor_attributes(void) \
+ { \
+ return &__BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_BEGIN_SYMBOL; \
+ } \
+ struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_end_section_component_class_descriptor_attributes(void) \
+ { \
+ return &__BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_END_SYMBOL; \
+ }
+
#ifdef __cplusplus
}
#endif
#define PLUGIN_SUFFIX_LEN max_t(size_t, sizeof(NATIVE_PLUGIN_SUFFIX), \
sizeof(LIBTOOL_PLUGIN_SUFFIX))
-#define SECTION_BEGIN(_name) (&(__start_##_name))
-#define SECTION_END(_name) (&(__stop_##_name))
-#define SECTION_ELEMENT_COUNT(_name) (SECTION_END(_name) - SECTION_BEGIN(_name))
-
-#define DECLARE_SECTION(_type, _name) \
- extern _type __start_##_name __attribute((weak)); \
- extern _type __stop_##_name __attribute((weak))
-
-DECLARE_SECTION(struct __bt_plugin_descriptor const *, __bt_plugin_descriptors);
-DECLARE_SECTION(struct __bt_plugin_descriptor_attribute const *, __bt_plugin_descriptor_attributes);
-DECLARE_SECTION(struct __bt_plugin_component_class_descriptor const *, __bt_plugin_component_class_descriptors);
-DECLARE_SECTION(struct __bt_plugin_component_class_descriptor_attribute const *, __bt_plugin_component_class_descriptor_attributes);
+BT_PLUGIN_MODULE();
/*
* This list, global to the library, keeps all component classes that
const struct __bt_plugin_descriptor_attribute *cur_attr =
*cur_attr_ptr;
+ if (cur_attr == NULL) {
+ continue;
+ }
+
if (cur_attr->plugin_descriptor != descriptor) {
continue;
}
*cur_cc_descr_ptr;
struct comp_class_full_descriptor full_descriptor = {0};
+ if (cur_cc_descr == NULL) {
+ continue;
+ }
+
if (cur_cc_descr->plugin_descriptor != descriptor) {
continue;
}
const struct __bt_plugin_component_class_descriptor_attribute *cur_cc_descr_attr =
*cur_cc_descr_attr_ptr;
+ if (cur_cc_descr_attr == NULL) {
+ continue;
+ }
+
if (cur_cc_descr_attr->comp_class_descriptor->plugin_descriptor !=
descriptor) {
continue;
return plugin;
}
+static
+size_t count_non_null_items_in_section(const void *begin, const void *end)
+{
+ size_t count = 0;
+ const int * const *begin_int = (const int * const *) begin;
+ const int * const *end_int = (const int * const *) end;
+ const int * const *iter;
+
+ for (iter = begin_int; iter != end_int; iter++) {
+ if (*iter) {
+ count++;
+ }
+ }
+
+ return count;
+}
+
static
struct bt_plugin_set *bt_plugin_so_create_all_from_sections(
struct bt_plugin_so_shared_lib_handle *shared_lib_handle,
size_t i;
struct bt_plugin_set *plugin_set = 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;
+ 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\", "
goto error;
}
- for (i = 0; i < descriptor_count; i++) {
+ for (i = 0; i < descriptors_end - descriptors_begin; i++) {
enum bt_plugin_status status;
const struct __bt_plugin_descriptor *descriptor =
descriptors_begin[i];
struct bt_plugin *plugin;
+ if (descriptor == NULL) {
+ continue;
+ }
+
BT_LOGD("Creating plugin object for plugin: "
"name=\"%s\", abi-major=%d, abi-minor=%d",
descriptor->name, descriptor->major, descriptor->minor);
BT_LOGD_STR("Creating all SO plugins from built-in plugins.");
plugin_set = bt_plugin_so_create_all_from_sections(shared_lib_handle,
- SECTION_BEGIN(__bt_plugin_descriptors),
- SECTION_END(__bt_plugin_descriptors),
- SECTION_BEGIN(__bt_plugin_descriptor_attributes),
- SECTION_END(__bt_plugin_descriptor_attributes),
- SECTION_BEGIN(__bt_plugin_component_class_descriptors),
- SECTION_END(__bt_plugin_component_class_descriptors),
- SECTION_BEGIN(__bt_plugin_component_class_descriptor_attributes),
- SECTION_END(__bt_plugin_component_class_descriptor_attributes));
+ __bt_get_begin_section_plugin_descriptors(),
+ __bt_get_end_section_plugin_descriptors(),
+ __bt_get_begin_section_plugin_descriptor_attributes(),
+ __bt_get_end_section_plugin_descriptor_attributes(),
+ __bt_get_begin_section_component_class_descriptors(),
+ __bt_get_end_section_component_class_descriptors(),
+ __bt_get_begin_section_component_class_descriptor_attributes(),
+ __bt_get_end_section_component_class_descriptor_attributes());
end:
BT_PUT(shared_lib_handle);
struct __bt_plugin_component_class_descriptor const * const *cc_descriptors_end = NULL;
struct __bt_plugin_component_class_descriptor_attribute const * const *cc_descr_attrs_begin = NULL;
struct __bt_plugin_component_class_descriptor_attribute const * const *cc_descr_attrs_end = NULL;
+ struct __bt_plugin_descriptor const * const *(*get_begin_section_plugin_descriptors)(void);
+ struct __bt_plugin_descriptor const * const *(*get_end_section_plugin_descriptors)(void);
+ struct __bt_plugin_descriptor_attribute const * const *(*get_begin_section_plugin_descriptor_attributes)(void);
+ struct __bt_plugin_descriptor_attribute const * const *(*get_end_section_plugin_descriptor_attributes)(void);
+ struct __bt_plugin_component_class_descriptor const * const *(*get_begin_section_component_class_descriptors)(void);
+ struct __bt_plugin_component_class_descriptor const * const *(*get_end_section_component_class_descriptors)(void);
+ struct __bt_plugin_component_class_descriptor_attribute const * const *(*get_begin_section_component_class_descriptor_attributes)(void);
+ struct __bt_plugin_component_class_descriptor_attribute const * const *(*get_end_section_component_class_descriptor_attributes)(void);
bt_bool is_libtool_wrapper = BT_FALSE, is_shared_object = BT_FALSE;
struct bt_plugin_so_shared_lib_handle *shared_lib_handle = NULL;
goto end;
}
- if (!g_module_symbol(shared_lib_handle->module, "__start___bt_plugin_descriptors",
- (gpointer *) &descriptors_begin)) {
+ if (g_module_symbol(shared_lib_handle->module, "__bt_get_begin_section_plugin_descriptors",
+ (gpointer *) &get_begin_section_plugin_descriptors)) {
+ descriptors_begin = get_begin_section_plugin_descriptors();
+ } else {
BT_LOGD("Cannot resolve plugin symbol: path=\"%s\", "
"symbol=\"%s\"", path,
- "__start___bt_plugin_descriptors");
+ "__bt_get_begin_section_plugin_descriptors");
goto end;
}
- if (!g_module_symbol(shared_lib_handle->module, "__stop___bt_plugin_descriptors",
- (gpointer *) &descriptors_end)) {
+ if (g_module_symbol(shared_lib_handle->module, "__bt_get_end_section_plugin_descriptors",
+ (gpointer *) &get_end_section_plugin_descriptors)) {
+ descriptors_end = get_end_section_plugin_descriptors();
+ } else {
BT_LOGD("Cannot resolve plugin symbol: path=\"%s\", "
"symbol=\"%s\"", path,
- "__stop___bt_plugin_descriptors");
+ "__bt_get_end_section_plugin_descriptors");
goto end;
}
- if (!g_module_symbol(shared_lib_handle->module, "__start___bt_plugin_descriptor_attributes",
- (gpointer *) &attrs_begin)) {
+ if (g_module_symbol(shared_lib_handle->module, "__bt_get_begin_section_plugin_descriptor_attributes",
+ (gpointer *) &get_begin_section_plugin_descriptor_attributes)) {
+ attrs_begin = get_begin_section_plugin_descriptor_attributes();
+ } else {
BT_LOGD("Cannot resolve plugin symbol: path=\"%s\", "
"symbol=\"%s\"", path,
- "__start___bt_plugin_descriptor_attributes");
+ "__bt_get_begin_section_plugin_descriptor_attributes");
}
- if (!g_module_symbol(shared_lib_handle->module, "__stop___bt_plugin_descriptor_attributes",
- (gpointer *) &attrs_end)) {
+ if (g_module_symbol(shared_lib_handle->module, "__bt_get_end_section_plugin_descriptor_attributes",
+ (gpointer *) &get_end_section_plugin_descriptor_attributes)) {
+ attrs_end = get_end_section_plugin_descriptor_attributes();
+ } else {
BT_LOGD("Cannot resolve plugin symbol: path=\"%s\", "
"symbol=\"%s\"", path,
- "__stop___bt_plugin_descriptor_attributes");
+ "__bt_get_end_section_plugin_descriptor_attributes");
}
if ((!!attrs_begin - !!attrs_end) != 0) {
"path=\"%s\", symbol-start=\"%s\", "
"symbol-end=\"%s\", symbol-start-addr=%p, "
"symbol-end-addr=%p",
- path, "__start___bt_plugin_descriptor_attributes",
- "__stop___bt_plugin_descriptor_attributes",
+ path, "__bt_get_begin_section_plugin_descriptor_attributes",
+ "__bt_get_end_section_plugin_descriptor_attributes",
attrs_begin, attrs_end);
goto end;
}
- if (!g_module_symbol(shared_lib_handle->module, "__start___bt_plugin_component_class_descriptors",
- (gpointer *) &cc_descriptors_begin)) {
+ if (g_module_symbol(shared_lib_handle->module, "__bt_get_begin_section_component_class_descriptors",
+ (gpointer *) &get_begin_section_component_class_descriptors)) {
+ cc_descriptors_begin = get_begin_section_component_class_descriptors();
+ } else {
BT_LOGD("Cannot resolve plugin symbol: path=\"%s\", "
"symbol=\"%s\"", path,
- "__start___bt_plugin_component_class_descriptors");
+ "__bt_get_begin_section_component_class_descriptors");
}
- if (!g_module_symbol(shared_lib_handle->module, "__stop___bt_plugin_component_class_descriptors",
- (gpointer *) &cc_descriptors_end)) {
+ if (g_module_symbol(shared_lib_handle->module, "__bt_get_end_section_component_class_descriptors",
+ (gpointer *) &get_end_section_component_class_descriptors)) {
+ cc_descriptors_end = get_end_section_component_class_descriptors();
+ } else {
BT_LOGD("Cannot resolve plugin symbol: path=\"%s\", "
"symbol=\"%s\"", path,
- "__stop___bt_plugin_component_class_descriptors");
+ "__bt_get_end_section_component_class_descriptors");
}
if ((!!cc_descriptors_begin - !!cc_descriptors_end) != 0) {
"path=\"%s\", symbol-start=\"%s\", "
"symbol-end=\"%s\", symbol-start-addr=%p, "
"symbol-end-addr=%p",
- path, "__start___bt_plugin_component_class_descriptors",
- "__stop___bt_plugin_component_class_descriptors",
+ path, "__bt_get_begin_section_component_class_descriptors",
+ "__bt_get_end_section_component_class_descriptors",
cc_descriptors_begin, cc_descriptors_end);
goto end;
}
- if (!g_module_symbol(shared_lib_handle->module, "__start___bt_plugin_component_class_descriptor_attributes",
- (gpointer *) &cc_descr_attrs_begin)) {
+ if (g_module_symbol(shared_lib_handle->module, "__bt_get_begin_section_component_class_descriptor_attributes",
+ (gpointer *) &get_begin_section_component_class_descriptor_attributes)) {
+ cc_descr_attrs_begin = get_begin_section_component_class_descriptor_attributes();
+ } else {
BT_LOGD("Cannot resolve plugin symbol: path=\"%s\", "
"symbol=\"%s\"", path,
- "__start___bt_plugin_component_class_descriptor_attributes");
+ "__bt_get_begin_section_component_class_descriptor_attributes");
}
- if (!g_module_symbol(shared_lib_handle->module, "__stop___bt_plugin_component_class_descriptor_attributes",
- (gpointer *) &cc_descr_attrs_end)) {
+ if (g_module_symbol(shared_lib_handle->module, "__bt_get_end_section_component_class_descriptor_attributes",
+ (gpointer *) &get_end_section_component_class_descriptor_attributes)) {
+ cc_descr_attrs_end = get_end_section_component_class_descriptor_attributes();
+ } else {
BT_LOGD("Cannot resolve plugin symbol: path=\"%s\", "
"symbol=\"%s\"", path,
- "__stop___bt_plugin_component_class_descriptor_attributes");
+ "__bt_get_end_section_component_class_descriptor_attributes");
}
if ((!!cc_descr_attrs_begin - !!cc_descr_attrs_end) != 0) {
"path=\"%s\", symbol-start=\"%s\", "
"symbol-end=\"%s\", symbol-start-addr=%p, "
"symbol-end-addr=%p",
- path, "__start___bt_plugin_component_class_descriptor_attributes",
- "__stop___bt_plugin_component_class_descriptor_attributes",
+ path, "__bt_get_begin_section_component_class_descriptor_attributes",
+ "__bt_get_end_section_component_class_descriptor_attributes",
cc_descr_attrs_begin, cc_descr_attrs_end);
goto end;
}
switch (flag) {
case FTW_F:
+ {
+ struct bt_plugin_set *plugins_from_file;
+
if (name[0] == '.') {
/* Skip hidden files */
BT_LOGV("Skipping hidden file: path=\"%s\"", file);
goto end;
}
- struct bt_plugin_set *plugins_from_file =
- bt_plugin_create_all_from_file(file);
+
+ plugins_from_file = bt_plugin_create_all_from_file(file);
if (plugins_from_file) {
size_t j;
bt_put(plugins_from_file);
}
break;
+ }
case FTW_DNR:
/* Continue to next file / directory. */
BT_LOGW("Cannot enter directory: continuing: path=\"%s\"", file);
#include "fs-sink/writer.h"
#include "lttng-live/lttng-live-internal.h"
+#ifndef BT_BUILT_IN_PLUGINS
+BT_PLUGIN_MODULE();
+#endif
+
/* Initialize plug-in description. */
BT_PLUGIN(ctf);
BT_PLUGIN_DESCRIPTION("CTF source and sink support");
return ret;
}
+#ifndef BT_BUILT_IN_PLUGINS
+BT_PLUGIN_MODULE();
+#endif
+
/* Initialize plug-in entry points. */
BT_PLUGIN_WITH_ID(lttng_utils, "lttng-utils");
BT_PLUGIN_DESCRIPTION_WITH_ID(lttng_utils, "LTTng utilities");
#include <babeltrace/plugin/plugin-dev.h>
#include "pretty/pretty.h"
+#ifndef BT_BUILT_IN_PLUGINS
+BT_PLUGIN_MODULE();
+#endif
+
BT_PLUGIN(text);
BT_PLUGIN_DESCRIPTION("Plain text component classes");
BT_PLUGIN_AUTHOR("Julien Desfossez, Mathieu Desnoyers, Philippe Proulx");
#include "trimmer/iterator.h"
#include "muxer/muxer.h"
+#ifndef BT_BUILT_IN_PLUGINS
+BT_PLUGIN_MODULE();
+#endif
+
BT_PLUGIN(utils);
BT_PLUGIN_DESCRIPTION("Graph utilities");
BT_PLUGIN_AUTHOR("Julien Desfossez, Jérémie Galarneau, Philippe Proulx");