Since kprobe functions will have a different prototype than the kernel
symbols they are attaching to, require that the user prefix the trace
function with a kprobe__ name to denote intent. kretprobe__ prefix is
also supported.
Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
from bcc import BPF
-BPF(text='void sys_clone(void *ctx) { bpf_trace_printk("Hello, World!\\n"); }').trace_print()
+BPF(text='void kprobe__sys_clone(void *ctx) { bpf_trace_printk("Hello, World!\\n"); }').trace_print()
if len(open_kprobes) == 0:
fns = self.load_funcs(BPF.KPROBE)
for fn in fns:
- self.attach_kprobe(event=fn.name, fn_name=fn.name)
+ if fn.name.startswith("kprobe__"):
+ self.attach_kprobe(event=fn.name[8:], fn_name=fn.name)
+ elif fn.name.startswith("kretprobe__"):
+ self.attach_kprobe(event=fn.name[11:], fn_name=fn.name)
while True:
if fmt: