#include <babeltrace/plugin/plugin-dev.h>
#include <babeltrace/plugin/plugin-internal.h>
#include <babeltrace/graph/component-class-internal.h>
+#include <babeltrace/types.h>
#include <string.h>
-#include <stdbool.h>
+#include <stdlib.h>
#include <glib.h>
#include <gmodule.h>
}
if (shared_lib_handle->module) {
- if (!g_module_close(shared_lib_handle->module)) {
- printf_error("Module close error: %s\n",
- g_module_error());
+#ifndef NDEBUG
+ /*
+ * Valgrind shows incomplete stack traces when
+ * dynamically loaded libraries are closed before it
+ * finishes. Use the BABELTRACE_NO_DLCLOSE in a debug
+ * build to avoid this.
+ */
+ const char *var = getenv("BABELTRACE_NO_DLCLOSE");
+
+ if (!var || strcmp(var, "1") != 0) {
+#endif
+ if (!g_module_close(shared_lib_handle->module)) {
+ printf_error("Module close error: %s\n",
+ g_module_error());
+ }
+#ifndef NDEBUG
}
+#endif
}
if (shared_lib_handle->path) {
}
}
- spec->shared_lib_handle->init_called = true;
+ spec->shared_lib_handle->init_called = BT_TRUE;
/* Add described component classes to plugin */
for (i = 0; i < comp_class_full_descriptors->len; i++) {
case BT_COMPONENT_CLASS_TYPE_SINK:
break;
default:
- assert(false);
- break;
+ abort();
}
/*
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;
- bool is_libtool_wrapper = false, is_shared_object = false;
+ bt_bool is_libtool_wrapper = BT_FALSE, is_shared_object = BT_FALSE;
struct bt_plugin_so_shared_lib_handle *shared_lib_handle = NULL;
if (!path) {