Skip to content

Commit

Permalink
python: Filter duplicate in get_kprobe_functions
Browse files Browse the repository at this point in the history
`BPF.get_kprobe_functions` does not filter duplicates, and
as a result may return the same function name more than
once if it appears in /sys/kernel/debug/tracing/available_filter_functions
more than once. Change the function's behavior to filter
out duplicates before returning, so we don't end up
attaching the same kprobe more than once.
  • Loading branch information
goldshtn committed Oct 20, 2016
1 parent 715f7e6 commit 06fb0fa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/python/bcc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ def get_kprobe_functions(event_re):
fn = line.rstrip().split()[0]
if re.match(event_re, fn) and fn not in blacklist:
fns.append(fn)
return fns
return set(fns) # Some functions may appear more than once

def _check_probe_quota(self, num_new_probes):
global _num_open_probes
Expand Down

0 comments on commit 06fb0fa

Please sign in to comment.