(self)
| 82 | return self.type == "t" or (self.type == "p" and self.library == "") |
| 83 | |
| 84 | def attach(self): |
| 85 | if self.type == "p": |
| 86 | if self.library: |
| 87 | self.bpf.attach_uprobe(name=self.library, |
| 88 | sym_re=self.pattern, |
| 89 | fn_name="trace_count", |
| 90 | pid=self.pid or -1) |
| 91 | self.matched = self.bpf.num_open_uprobes() |
| 92 | else: |
| 93 | self.bpf.attach_kprobe(event_re=self.pattern, |
| 94 | fn_name="trace_count") |
| 95 | self.matched = self.bpf.num_open_kprobes() |
| 96 | elif self.type == "t": |
| 97 | self.bpf.attach_tracepoint(tp_re=self.pattern, |
| 98 | fn_name="trace_count") |
| 99 | self.matched = self.bpf.num_open_tracepoints() |
| 100 | elif self.type == "u": |
| 101 | pass # Nothing to do -- attach already happened in `load` |
| 102 | |
| 103 | if self.matched == 0: |
| 104 | raise Exception("No functions matched by pattern %s" % |
| 105 | self.pattern) |
| 106 | |
| 107 | def load(self): |
| 108 | ctx_name = "ctx" |
no test coverage detected