From 893ad2fc6c414e9677903e9e0deff7635e3cbd6f Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Fri, 13 Jan 2017 23:37:28 +0100 Subject: [PATCH] cc: Use PID to detach uprobes We need the PID when detaching uprobes to resolve library names to the same path as when attaching --- src/python/bcc/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/python/bcc/__init__.py b/src/python/bcc/__init__.py index e1363ad..2f484ab 100644 --- a/src/python/bcc/__init__.py +++ b/src/python/bcc/__init__.py @@ -770,15 +770,15 @@ class BPF(object): self._add_uprobe(ev_name, res) return self - def detach_uprobe(self, name="", sym="", addr=None): - """detach_uprobe(name="", sym="", addr=None) + def detach_uprobe(self, name="", sym="", addr=None, pid=-1): + """detach_uprobe(name="", sym="", addr=None, pid=-1) Stop running a bpf function that is attached to symbol 'sym' in library or binary 'name'. """ name = str(name) - (path, addr) = BPF._check_path_symbol(name, sym, addr, -1) + (path, addr) = BPF._check_path_symbol(name, sym, addr, pid) ev_name = "p_%s_0x%x" % (self._probe_repl.sub("_", path), addr) if ev_name not in self.open_uprobes: raise Exception("Uprobe %s is not attached" % ev_name) @@ -822,15 +822,15 @@ class BPF(object): self._add_uprobe(ev_name, res) return self - def detach_uretprobe(self, name="", sym="", addr=None): - """detach_uretprobe(name="", sym="", addr=None) + def detach_uretprobe(self, name="", sym="", addr=None, pid=-1): + """detach_uretprobe(name="", sym="", addr=None, pid=-1) Stop running a bpf function that is attached to symbol 'sym' in library or binary 'name'. """ name = str(name) - (path, addr) = BPF._check_path_symbol(name, sym, addr, -1) + (path, addr) = BPF._check_path_symbol(name, sym, addr, pid) ev_name = "r_%s_0x%x" % (self._probe_repl.sub("_", path), addr) if ev_name not in self.open_uprobes: raise Exception("Uretprobe %s is not attached" % ev_name) -- 2.7.4