static pthread_once_t init_control = PTHREAD_ONCE_INIT;
-/* NB: this is slightly thread-unsafe */
+/* dwfl->debuginfod_lock must be held when calling this function. */
debuginfod_client *
dwfl_get_debuginfod_client (Dwfl *dwfl)
int fd = -1;
if (build_id_len > 0)
{
+ mutex_lock (dwfl->debuginfod_lock);
debuginfod_client *c = INTUSE (dwfl_get_debuginfod_client) (dwfl);
if (c != NULL)
fd = (*fp_debuginfod_find_executable) (c, build_id_bits,
build_id_len, NULL);
+ mutex_unlock (dwfl->debuginfod_lock);
}
return fd;
int fd = -1;
if (build_id_len > 0)
{
+ mutex_lock (dwfl->debuginfod_lock);
debuginfod_client *c = INTUSE (dwfl_get_debuginfod_client) (dwfl);
if (c != NULL)
fd = (*fp_debuginfod_find_debuginfo) (c, build_id_bits,
build_id_len, NULL);
+ mutex_unlock (dwfl->debuginfod_lock);
}
return fd;
dwfl->offline_next_address = OFFLINE_REDZONE;
}
+ mutex_init (dwfl->debuginfod_lock);
+
return dwfl;
}
INTDEF (dwfl_begin)
free (dwfl->lookup_module);
free (dwfl->lookup_segndx);
free (dwfl->sysroot);
+ mutex_fini (dwfl->debuginfod_lock);
Dwfl_Module *next = dwfl->modulelist;
while (next != NULL)
When the client connection has not yet been initialized, it will be done on the
first call to this function. If elfutils is compiled without support for debuginfod,
NULL will be returned.
+
+ The returned debuginfod-client handle must not be used at the same time as
+ any libdwfl function taking the client's associated DWFL as an argument.
*/
extern debuginfod_client *dwfl_get_debuginfod_client (Dwfl *dwfl);
struct Dwfl_User_Core *user_core;
char *sysroot; /* sysroot, or NULL to search standard system
paths */
+
+ /* Serialize debuginfod_client usage. */
+ mutex_define (, debuginfod_lock);
};
#define OFFLINE_REDZONE 0x10000