0001
0002 #ifndef _PROBE_EVENT_H
0003 #define _PROBE_EVENT_H
0004
0005 #include <linux/compiler.h>
0006 #include <stdbool.h>
0007
0008 struct intlist;
0009 struct nsinfo;
0010
0011
0012 struct probe_conf {
0013 bool show_ext_vars;
0014 bool show_location_range;
0015 bool force_add;
0016 bool no_inlines;
0017 bool cache;
0018 bool bootconfig;
0019 int max_probes;
0020 unsigned long magic_num;
0021 };
0022 extern struct probe_conf probe_conf;
0023 extern bool probe_event_dry_run;
0024
0025 #define DEFAULT_PROBE_MAGIC_NUM 0xdeade12d
0026
0027 struct symbol;
0028
0029
0030 struct probe_trace_point {
0031 char *realname;
0032 char *symbol;
0033 char *module;
0034 unsigned long offset;
0035 unsigned long ref_ctr_offset;
0036 u64 address;
0037 bool retprobe;
0038 };
0039
0040
0041 struct probe_trace_arg_ref {
0042 struct probe_trace_arg_ref *next;
0043 long offset;
0044 bool user_access;
0045 };
0046
0047
0048 struct probe_trace_arg {
0049 char *name;
0050 char *value;
0051 char *type;
0052 struct probe_trace_arg_ref *ref;
0053 };
0054
0055
0056 struct probe_trace_event {
0057 char *event;
0058 char *group;
0059 struct probe_trace_point point;
0060 int nargs;
0061 bool uprobes;
0062 struct probe_trace_arg *args;
0063 };
0064
0065
0066 struct perf_probe_point {
0067 char *file;
0068 char *function;
0069 int line;
0070 bool retprobe;
0071 char *lazy_line;
0072 unsigned long offset;
0073 u64 abs_address;
0074 };
0075
0076
0077 struct perf_probe_arg_field {
0078 struct perf_probe_arg_field *next;
0079 char *name;
0080 long index;
0081 bool ref;
0082 };
0083
0084
0085 struct perf_probe_arg {
0086 char *name;
0087 char *var;
0088 char *type;
0089 struct perf_probe_arg_field *field;
0090 bool user_access;
0091 };
0092
0093
0094 struct perf_probe_event {
0095 char *event;
0096 char *group;
0097 struct perf_probe_point point;
0098 int nargs;
0099 bool sdt;
0100 bool uprobes;
0101 char *target;
0102 struct perf_probe_arg *args;
0103 struct probe_trace_event *tevs;
0104 int ntevs;
0105 struct nsinfo *nsi;
0106 };
0107
0108
0109 struct line_range {
0110 char *file;
0111 char *function;
0112 int start;
0113 int end;
0114 int offset;
0115 char *path;
0116 char *comp_dir;
0117 struct intlist *line_list;
0118 };
0119
0120 struct strlist;
0121
0122
0123 struct variable_list {
0124 struct probe_trace_point point;
0125 struct strlist *vars;
0126 };
0127
0128 struct map;
0129 int init_probe_symbol_maps(bool user_only);
0130 void exit_probe_symbol_maps(void);
0131
0132
0133 int parse_perf_probe_command(const char *cmd, struct perf_probe_event *pev);
0134 int parse_probe_trace_command(const char *cmd, struct probe_trace_event *tev);
0135
0136
0137 char *synthesize_perf_probe_command(struct perf_probe_event *pev);
0138 char *synthesize_probe_trace_command(struct probe_trace_event *tev);
0139 char *synthesize_perf_probe_arg(struct perf_probe_arg *pa);
0140 char *synthesize_perf_probe_point(struct perf_probe_point *pp);
0141
0142 int perf_probe_event__copy(struct perf_probe_event *dst,
0143 struct perf_probe_event *src);
0144
0145 bool perf_probe_with_var(struct perf_probe_event *pev);
0146
0147
0148 bool perf_probe_event_need_dwarf(struct perf_probe_event *pev);
0149
0150
0151 void clear_perf_probe_event(struct perf_probe_event *pev);
0152 void clear_probe_trace_event(struct probe_trace_event *tev);
0153
0154
0155 int parse_line_range_desc(const char *cmd, struct line_range *lr);
0156
0157
0158 void line_range__clear(struct line_range *lr);
0159
0160
0161 int line_range__init(struct line_range *lr);
0162
0163 int add_perf_probe_events(struct perf_probe_event *pevs, int npevs);
0164 int convert_perf_probe_events(struct perf_probe_event *pevs, int npevs);
0165 int apply_perf_probe_events(struct perf_probe_event *pevs, int npevs);
0166 int show_probe_trace_events(struct perf_probe_event *pevs, int npevs);
0167 int show_bootconfig_events(struct perf_probe_event *pevs, int npevs);
0168 void cleanup_perf_probe_events(struct perf_probe_event *pevs, int npevs);
0169
0170 struct strfilter;
0171
0172 int del_perf_probe_events(struct strfilter *filter);
0173
0174 int show_perf_probe_event(const char *group, const char *event,
0175 struct perf_probe_event *pev,
0176 const char *module, bool use_stdout);
0177 int show_perf_probe_events(struct strfilter *filter);
0178 int show_line_range(struct line_range *lr, const char *module,
0179 struct nsinfo *nsi, bool user);
0180 int show_available_vars(struct perf_probe_event *pevs, int npevs,
0181 struct strfilter *filter);
0182 int show_available_funcs(const char *module, struct nsinfo *nsi,
0183 struct strfilter *filter, bool user);
0184 void arch__fix_tev_from_maps(struct perf_probe_event *pev,
0185 struct probe_trace_event *tev, struct map *map,
0186 struct symbol *sym);
0187
0188
0189 int e_snprintf(char *str, size_t size, const char *format, ...) __printf(3, 4);
0190
0191
0192 #define MAX_EVENT_INDEX 1024
0193
0194 int copy_to_probe_trace_arg(struct probe_trace_arg *tvar,
0195 struct perf_probe_arg *pvar);
0196
0197 struct map *get_target_map(const char *target, struct nsinfo *nsi, bool user);
0198
0199 void arch__post_process_probe_trace_events(struct perf_probe_event *pev,
0200 int ntevs);
0201
0202 #endif