This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: patch 0/2 debuginfod submission


Hi -

> Ah, I was not thinking that far yet. I was just worried about the
> dlopen/dlsym dance being done on every call. Which does its own file
> search to find the library. So simply setting debuginfod_so = (void *)
> -1; on first failure to make sure dlopen/dlsym it is never called
> again.

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       }

> > 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.


- FChE


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]