1
2#ifndef _PROBE_EVENT_H
3#define _PROBE_EVENT_H
4
5#include <linux/compiler.h>
6#include <stdbool.h>
7
8struct intlist;
9struct nsinfo;
10
11
12struct probe_conf {
13 bool show_ext_vars;
14 bool show_location_range;
15 bool force_add;
16 bool no_inlines;
17 bool cache;
18 bool bootconfig;
19 int max_probes;
20 unsigned long magic_num;
21};
22extern struct probe_conf probe_conf;
23extern bool probe_event_dry_run;
24
25#define DEFAULT_PROBE_MAGIC_NUM 0xdeade12d
26
27struct symbol;
28
29
30struct probe_trace_point {
31 char *realname;
32 char *symbol;
33 char *module;
34 unsigned long offset;
35 unsigned long ref_ctr_offset;
36 u64 address;
37 bool retprobe;
38};
39
40
41struct probe_trace_arg_ref {
42 struct probe_trace_arg_ref *next;
43 long offset;
44 bool user_access;
45};
46
47
48struct probe_trace_arg {
49 char *name;
50 char *value;
51 char *type;
52 struct probe_trace_arg_ref *ref;
53};
54
55
56struct probe_trace_event {
57 char *event;
58 char *group;
59 struct probe_trace_point point;
60 int nargs;
61 bool uprobes;
62 struct probe_trace_arg *args;
63};
64
65
66struct perf_probe_point {
67 char *file;
68 char *function;
69 int line;
70 bool retprobe;
71 char *lazy_line;
72 unsigned long offset;
73 u64 abs_address;
74};
75
76
77struct perf_probe_arg_field {
78 struct perf_probe_arg_field *next;
79 char *name;
80 long index;
81 bool ref;
82};
83
84
85struct perf_probe_arg {
86 char *name;
87 char *var;
88 char *type;
89 struct perf_probe_arg_field *field;
90 bool user_access;
91};
92
93
94struct perf_probe_event {
95 char *event;
96 char *group;
97 struct perf_probe_point point;
98 int nargs;
99 bool sdt;
100 bool uprobes;
101 char *target;
102 struct perf_probe_arg *args;
103 struct probe_trace_event *tevs;
104 int ntevs;
105 struct nsinfo *nsi;
106};
107
108
109struct line_range {
110 char *file;
111 char *function;
112 int start;
113 int end;
114 int offset;
115 char *path;
116 char *comp_dir;
117 struct intlist *line_list;
118};
119
120struct strlist;
121
122
123struct variable_list {
124 struct probe_trace_point point;
125 struct strlist *vars;
126};
127
128struct map;
129int init_probe_symbol_maps(bool user_only);
130void exit_probe_symbol_maps(void);
131
132
133int parse_perf_probe_command(const char *cmd, struct perf_probe_event *pev);
134int parse_probe_trace_command(const char *cmd, struct probe_trace_event *tev);
135
136
137char *synthesize_perf_probe_command(struct perf_probe_event *pev);
138char *synthesize_probe_trace_command(struct probe_trace_event *tev);
139char *synthesize_perf_probe_arg(struct perf_probe_arg *pa);
140char *synthesize_perf_probe_point(struct perf_probe_point *pp);
141
142int perf_probe_event__copy(struct perf_probe_event *dst,
143 struct perf_probe_event *src);
144
145bool perf_probe_with_var(struct perf_probe_event *pev);
146
147
148bool perf_probe_event_need_dwarf(struct perf_probe_event *pev);
149
150
151void clear_perf_probe_event(struct perf_probe_event *pev);
152void clear_probe_trace_event(struct probe_trace_event *tev);
153
154
155int parse_line_range_desc(const char *cmd, struct line_range *lr);
156
157
158void line_range__clear(struct line_range *lr);
159
160
161int line_range__init(struct line_range *lr);
162
163int add_perf_probe_events(struct perf_probe_event *pevs, int npevs);
164int convert_perf_probe_events(struct perf_probe_event *pevs, int npevs);
165int apply_perf_probe_events(struct perf_probe_event *pevs, int npevs);
166int show_probe_trace_events(struct perf_probe_event *pevs, int npevs);
167int show_bootconfig_events(struct perf_probe_event *pevs, int npevs);
168void cleanup_perf_probe_events(struct perf_probe_event *pevs, int npevs);
169
170struct strfilter;
171
172int del_perf_probe_events(struct strfilter *filter);
173
174int show_perf_probe_event(const char *group, const char *event,
175 struct perf_probe_event *pev,
176 const char *module, bool use_stdout);
177int show_perf_probe_events(struct strfilter *filter);
178int show_line_range(struct line_range *lr, const char *module,
179 struct nsinfo *nsi, bool user);
180int show_available_vars(struct perf_probe_event *pevs, int npevs,
181 struct strfilter *filter);
182int show_available_funcs(const char *module, struct nsinfo *nsi,
183 struct strfilter *filter, bool user);
184void arch__fix_tev_from_maps(struct perf_probe_event *pev,
185 struct probe_trace_event *tev, struct map *map,
186 struct symbol *sym);
187
188
189int e_snprintf(char *str, size_t size, const char *format, ...) __printf(3, 4);
190
191
192#define MAX_EVENT_INDEX 1024
193
194int copy_to_probe_trace_arg(struct probe_trace_arg *tvar,
195 struct perf_probe_arg *pvar);
196
197struct map *get_target_map(const char *target, struct nsinfo *nsi, bool user);
198
199void arch__post_process_probe_trace_events(struct perf_probe_event *pev,
200 int ntevs);
201
202#endif
203