Hi Vitaly, On Thu, 2020-11-05 at 17:44 +0300, Vitaly Chikunov wrote: > Avoid calling expensive dlopen at the cost of an extra getenv check when > we already know it would not be needed. > > This mirrors the getenv check from debuginfod_query_server.
I am sympathetic to this. It would have been a nicer way to fix the valgrind issue I recently had with dlopen having unsuppressible errors on some older glibc versions. But it also makes it so that an application can never use the debuginfod support afterwards. The current debuginfod_query_server check is late enough that an application could set DEBUGINFOD_URLS just before a Dwarf lookup. What do you think? Is that a valid use case? Should we maybe introduce setting debuginfod_urls on Dwfls so that an application can explicitly indicate they want to use debuginfod lookups and then dlopen libdebuginfod late? The problem with doing the dlopen late is that we also need libcurl and initializing libcurl (as done by libdebuginfod) is not thread-safe. Cheers, Mark