funccount now bails early with an error if there are no
functions matching the specified pattern (the same applies
to tracepoints and USDT probes). For example:
```
No functions matched by pattern ^sched:sched_fork$
```
Fixes #789.
elif self.type == "u":
pass # Nothing to do -- attach already happened in `load`
- if self.matched == 0:
- raise Exception("No functions matched by pattern %s" %
- self.pattern)
-
def _add_function(self, template, probe_name):
new_func = "trace_count_%d" % self.matched
text = template.replace("PROBE_FUNCTION", new_func)
if debug:
print(bpf_text)
+ if self.matched == 0:
+ raise Exception("No functions matched by pattern %s" %
+ self.pattern)
+
self.bpf = BPF(text=bpf_text,
usdt_contexts=[self.usdt] if self.usdt else [])
self.clear() # Initialize all array items to zero