When debugging a specific process, I might need to set the probes in the shared library that this process is using.
The function bcc_procutils_which_so(libname, pid) seemingly helps with this. But in reality, it also looks for the library in the ldconfig cache.
It potentially returns the libraries unrelated to the given process even if I pass a pid to this function, which breaks my expectations as a library user. Example: https://github.com/sumerc/gilstats.py/pull/1
Potential solutions
Backwards-compatible: export a more specialized function bcc_procutils_which_so_in_process(libname, pid).
Backwards-incompatible: force bcc_procutils_which_so(..., pid) to search only the libraries of the given process when pid != 0.
Problem
When debugging a specific process, I might need to set the probes in the shared library that this process is using.
The function
bcc_procutils_which_so(libname, pid)
seemingly helps with this. But in reality, it also looks for the library in the ldconfig cache.It potentially returns the libraries unrelated to the given process even if I pass a
pid
to this function, which breaks my expectations as a library user. Example: https://github.com/sumerc/gilstats.py/pull/1Potential solutions
bcc_procutils_which_so_in_process(libname, pid)
.bcc_procutils_which_so(..., pid)
to search only the libraries of the given process whenpid != 0
.Also, here's an implementation of the backwards-compatible solution: https://github.com/iovisor/bcc/pull/5014