Commit 6641cbb7 authored by Vicent Marti's avatar Vicent Marti

bpf: Wrap `bcc_procutils_which_so` as `BPF.find_library`

This class method was being used outside of the BPF class in the
`tracer` and `usdt` tools.
parent 7d29a461
...@@ -432,6 +432,10 @@ class BPF(object): ...@@ -432,6 +432,10 @@ class BPF(object):
raise Exception("could not determine address of symbol %s" % symname) raise Exception("could not determine address of symbol %s" % symname)
return sym.module, sym.offset return sym.module, sym.offset
@staticmethod
def find_library(libname):
return lib.bcc_procutils_which_so(libname)
def attach_uprobe(self, name="", sym="", addr=None, def attach_uprobe(self, name="", sym="", addr=None,
fn_name="", pid=-1, cpu=0, group_fd=-1): fn_name="", pid=-1, cpu=0, group_fd=-1):
"""attach_uprobe(name="", sym="", addr=None, fn_name="" """attach_uprobe(name="", sym="", addr=None, fn_name=""
......
...@@ -111,6 +111,9 @@ class bcc_symbol(ct.Structure): ...@@ -111,6 +111,9 @@ class bcc_symbol(ct.Structure):
('offset', ct.c_ulonglong), ('offset', ct.c_ulonglong),
] ]
lib.bcc_procutils_which_so.restype = ct.c_char_p
lib.bcc_procutils_which_so.argtypes = [ct.c_char_p]
lib.bcc_resolve_symname.restype = ct.c_int lib.bcc_resolve_symname.restype = ct.c_int
lib.bcc_resolve_symname.argtypes = [ lib.bcc_resolve_symname.argtypes = [
ct.c_char_p, ct.c_char_p, ct.c_ulonglong, ct.POINTER(bcc_symbol)] ct.c_char_p, ct.c_char_p, ct.c_ulonglong, ct.POINTER(bcc_symbol)]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment