iovisor / bcc

BCC - Tools for BPF-based Linux IO analysis, networking, monitoring, and more

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`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

  1. Backwards-compatible: export a more specialized function bcc_procutils_which_so_in_process(libname, pid).
  2. Backwards-incompatible: force bcc_procutils_which_so(..., pid) to search only the libraries of the given process when pid != 0.

Also, here's an implementation of the backwards-compatible solution: #5014