+ ip, so_base, resolved_path, flags, memsz,
+ has_build_id, has_debug_link);
+
+ if (has_build_id) {
+ tracepoint(lttng_ust_dl, build_id,
+ ip, so_base, build_id, build_id_len);
+ }
+
+ if (has_debug_link) {
+ tracepoint(lttng_ust_dl, debug_link,
+ ip, so_base, dbg_file, crc);
+ }
+
+end:
+ free(dbg_file);
+ free(build_id);
+ lttng_ust_elf_destroy(elf);
+ return;
+}
+
+#ifdef HAVE_DLMOPEN
+static
+void lttng_ust_dl_dlmopen(void *so_base, Lmid_t nsid, const char *so_name,
+ int flags, void *ip)
+{
+ char resolved_path[PATH_MAX];
+ struct lttng_ust_elf *elf;
+ uint64_t memsz;
+ uint8_t *build_id = NULL;
+ size_t build_id_len;
+ char *dbg_file = NULL;
+ uint32_t crc;
+ int has_build_id = 0, has_debug_link = 0;
+ int ret;
+
+ if (!realpath(so_name, resolved_path)) {
+ ERR("could not resolve path '%s'", so_name);
+ return;
+ }
+
+ elf = lttng_ust_elf_create(resolved_path);
+ if (!elf) {
+ ERR("could not access file %s", resolved_path);
+ return;
+ }
+
+ ret = lttng_ust_elf_get_memsz(elf, &memsz);
+ if (ret) {
+ goto end;
+ }
+ ret = lttng_ust_elf_get_build_id(
+ elf, &build_id, &build_id_len, &has_build_id);
+ if (ret) {
+ goto end;
+ }
+ ret = lttng_ust_elf_get_debug_link(
+ elf, &dbg_file, &crc, &has_debug_link);
+ if (ret) {
+ goto end;
+ }
+
+ tracepoint(lttng_ust_dl, dlmopen,
+ ip, so_base, nsid, resolved_path, flags, memsz,
+ has_build_id, has_debug_link);