Commit b495d2c3 authored by Vicent Marti's avatar Vicent Marti

bpf.lua: fix detaching uprobes and kprobes

parent 28b4efe9
......@@ -44,8 +44,13 @@ function Bpf.static.cleanup_probes()
libbcc.perf_reader_free(probe)
if type(key) == "string" then
local desc = string.format("-:%s/%s", probe_type, key)
-- TODO: why so noisy?
--libbcc.bpf_detach_kprobe(desc)
log.info("detaching %s", desc)
if probe_type == "kprobes" then
libbcc.bpf_detach_kprobe(desc)
elseif probe_type == "uprobes" then
libbcc.bpf_detach_uprobe(desc)
end
end
all_probes[key] = nil
end
......@@ -58,6 +63,10 @@ function Bpf.static.cleanup_probes()
end
end
function Bpf.static.num_open_uprobes()
return table.count(Bpf.static.open_uprobes)
end
function Bpf.static.num_open_kprobes()
return table.count(Bpf.static.open_kprobes)
end
......
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