`bcc_procutils_which_so(libname, pid)` finds library unused by the process
gukoff opened this issue · comments
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: sumerc/gilstats.py#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 whenpid != 0
.
Also, here's an implementation of the backwards-compatible solution: #5014