Hi Frank, On Wed, 2019-10-30 at 14:11 -0400, Frank Ch. Eigler wrote: > Revised code to look like this (libdwfl/find-debuginfo.c): > > 00404 /* NB: this is slightly thread-unsafe */ > 00405 static __typeof__ (debuginfod_find_debuginfo) > *fp_debuginfod_find_debuginfo; > 00406 > 00407 if (fp_debuginfod_find_debuginfo == NULL) > 00408 { > 00409 void *debuginfod_so = dlopen("libdebuginfod-" VERSION ".so", > RTLD_LAZY); > 00410 if (debuginfod_so == NULL) > 00411 debuginfod_so = dlopen("libdebuginfod.so", RTLD_LAZY); > 00412 if (debuginfod_so != NULL) > 00413 fp_debuginfod_find_debuginfo = dlsym (debuginfod_so, > "debuginfod_find_debuginfo"); > 00414 if (fp_debuginfod_find_debuginfo == NULL) > 00415 fp_debuginfod_find_debuginfo = (void *) -1; /* never try > again */ > 00416 } > 00417 > 00418 if (fp_debuginfod_find_debuginfo != NULL && > fp_debuginfod_find_debuginfo != (void *) -1) > 00419 { > 00420 /* If all else fails and a build-id is available, query the > 00421 debuginfo-server if enabled. */ > 00422 if (fd < 0 && bits_len > 0) > 00423 fd = (*fp_debuginfod_find_debuginfo) (bits, bits_len, NULL); > 00424 }
Thanks, that looks perfectly fine for now. This should also be not too hard to make thread-safe when using atomics. > > > We document returning standard errnos generally, and a few particular > > > ones for network unreachability. > > > > But those aren't propagated to users for libdwfl find_elf or > > find_debuginfo. I was really just wondering if you thought about that > > in the scope of the libdwfl calls. Currently there is no real good way > > to do any error reporting there. So it isn't a big concern. But if you > > have any ideas for improvement that would be nice. > > Will think about it. One idea is described here: https://lists.fedorahosted.org/pipermail/elfutils-devel/2015-May/thread.html#4841 Cheers, Mark