return None
def __init__(self, src_file=b"", hdr_file=b"", text=None, debug=0,
- cflags=[], usdt_contexts=[], allow_rlimit=True, device=None):
+ cflags=[], usdt_contexts=[], allow_rlimit=True, device=None,
+ attach_usdt_ignore_pid=False):
"""Create a new BPF module with the given source code.
Note:
raise Exception("Failed to compile BPF module %s" % (src_file or "<text>"))
for usdt_context in usdt_contexts:
- usdt_context.attach_uprobes(self)
+ usdt_context.attach_uprobes(self, attach_usdt_ignore_pid)
# If any "kprobe__" or "tracepoint__" or "raw_tracepoint__"
# prefixed functions were defined,
# This is called by the BPF module's __init__ when it realizes that there
# is a USDT context and probes need to be attached.
- def attach_uprobes(self, bpf):
+ def attach_uprobes(self, bpf, attach_usdt_ignore_pid):
probes = self.enumerate_active_probes()
for (binpath, fn_name, addr, pid) in probes:
+ if attach_usdt_ignore_pid:
+ pid = -1
bpf.attach_uprobe(name=binpath.decode(), fn_name=fn_name.decode(),
addr=addr, pid=pid)