Commit 9eb6e51a authored by Alastair Robertson's avatar Alastair Robertson

libbcc changed the arguments to bpf_attach_kprobe

parent 796f9c9a
...@@ -68,7 +68,7 @@ int BPFtrace::add_probe(ast::Probe &p) ...@@ -68,7 +68,7 @@ int BPFtrace::add_probe(ast::Probe &p)
int BPFtrace::attach_kprobe(Probe &probe) int BPFtrace::attach_kprobe(Probe &probe)
{ {
std::string event; std::string event;
std::string event_desc; bpf_probe_attach_type attach_type;
int pid = -1; int pid = -1;
int cpu = 0; int cpu = 0;
int group_fd = -1; int group_fd = -1;
...@@ -78,27 +78,18 @@ int BPFtrace::attach_kprobe(Probe &probe) ...@@ -78,27 +78,18 @@ int BPFtrace::attach_kprobe(Probe &probe)
switch (probe.type) { switch (probe.type) {
case ProbeType::kprobe: case ProbeType::kprobe:
event = "p_" + probe.attach_point; event = "p_" + probe.attach_point;
attach_type = BPF_PROBE_ENTRY;
break; break;
case ProbeType::kretprobe: case ProbeType::kretprobe:
event = "r_" + probe.attach_point; event = "r_" + probe.attach_point;
attach_type = BPF_PROBE_RETURN;
break; break;
default: default:
abort(); abort();
} }
switch (probe.type) { bpf_attach_kprobe(probe.progfd, attach_type, event.c_str(),
case ProbeType::kprobe: probe.attach_point.c_str(), pid, cpu, group_fd, cb, cb_cookie);
event_desc = "p:kprobes/" + event + " " + probe.attach_point;
break;
case ProbeType::kretprobe:
event_desc = "r:kprobes/" + event + " " + probe.attach_point;
break;
default:
abort();
}
bpf_attach_kprobe(probe.progfd, event.c_str(), event_desc.c_str(),
pid, cpu, group_fd, cb, cb_cookie);
} }
} // namespace bpftrace } // namespace bpftrace
......
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