#include <babeltrace/graph/component-class-internal.h>
#include <babeltrace/types.h>
#include <string.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) {
case BT_COMPONENT_CLASS_TYPE_SINK:
break;
default:
- assert(BT_FALSE);
- break;
+ abort();
}
/*