From 9095cec99a28854e57590f002f7311b9d8ca3424 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=C5=9Alusarczyk?= Date: Mon, 18 Nov 2024 10:19:57 +0100 Subject: [PATCH] logging full path of loaded adapter --- source/common/linux/ur_lib_loader.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/source/common/linux/ur_lib_loader.cpp b/source/common/linux/ur_lib_loader.cpp index 4da7f98bc1..3f9acc259b 100644 --- a/source/common/linux/ur_lib_loader.cpp +++ b/source/common/linux/ur_lib_loader.cpp @@ -8,6 +8,10 @@ * */ #include +#if __has_include() +#include +#define ADD_FULL_PATH_LOG +#endif #include "logger/ur_logger.hpp" #include "ur_lib_loader.hpp" @@ -50,7 +54,14 @@ LibLoader::loadAdapterLibrary(const char *name) { logger::info("failed to load adapter '{}' with error: {}", name, err ? err : "unknown error"); } else { - logger::info("loaded adapter 0x{} ({})", handle, name); +#if defined(ADD_FULL_PATH_LOG) + struct link_map *dlinfo_map; + if (dlinfo(handle, RTLD_DI_LINKMAP, &dlinfo_map) == 0) { + logger::info("loaded adapter 0x{} ({}) from {}", handle, name, + dlinfo_map->l_name); + } else +#endif + logger::info("loaded adapter 0x{} ({})", handle, name); } return std::unique_ptr(handle); }