forked from bpftrace/bpftrace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
attached_probe.h
47 lines (39 loc) · 1.2 KB
/
attached_probe.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once
#include "types.h"
#include "libbpf.h"
namespace bpftrace {
bpf_probe_attach_type attachtype(ProbeType t);
bpf_prog_type progtype(ProbeType t);
class AttachedProbe
{
public:
AttachedProbe(Probe &probe,
std::tuple<uint8_t *, uintptr_t> func,
bool safe_mode);
AttachedProbe(Probe &probe, std::tuple<uint8_t *, uintptr_t> func, int pid);
~AttachedProbe();
AttachedProbe(const AttachedProbe &) = delete;
AttachedProbe &operator=(const AttachedProbe &) = delete;
private:
std::string eventprefix() const;
std::string eventname() const;
static std::string sanitise(const std::string &str);
void resolve_offset_kprobe(bool safe_mode);
void resolve_offset_uprobe(bool safe_mode);
void load_prog();
void attach_kprobe(bool safe_mode);
void attach_uprobe(bool safe_mode);
void attach_usdt(int pid);
void attach_tracepoint();
void attach_profile();
void attach_interval();
void attach_software();
void attach_hardware();
void attach_watchpoint(int pid, const std::string &mode);
Probe &probe_;
std::tuple<uint8_t *, uintptr_t> func_;
std::vector<int> perf_event_fds_;
int progfd_ = -1;
uint64_t offset_ = 0;
};
} // namespace bpftrace