Masami Hiramatsu | 50656ee | 2009-11-30 19:19:58 -0500 | [diff] [blame] | 1 | #ifndef _PROBE_EVENT_H |
| 2 | #define _PROBE_EVENT_H |
| 3 | |
Masami Hiramatsu | fac13fd | 2009-12-15 10:31:14 -0500 | [diff] [blame] | 4 | #include <stdbool.h> |
Masami Hiramatsu | 5a62257 | 2014-02-06 05:32:09 +0000 | [diff] [blame] | 5 | #include "intlist.h" |
Masami Hiramatsu | 4de189f | 2009-11-30 19:20:17 -0500 | [diff] [blame] | 6 | #include "strlist.h" |
Masami Hiramatsu | bd09d7b | 2011-01-20 23:15:39 +0900 | [diff] [blame] | 7 | #include "strfilter.h" |
Masami Hiramatsu | 50656ee | 2009-11-30 19:19:58 -0500 | [diff] [blame] | 8 | |
Masami Hiramatsu | f4d7da4 | 2010-03-16 18:06:05 -0400 | [diff] [blame] | 9 | extern bool probe_event_dry_run; |
| 10 | |
Srikar Dronamraju | 225466f | 2012-04-16 17:39:09 +0530 | [diff] [blame] | 11 | /* kprobe-tracer and uprobe-tracer tracing point */ |
Srikar Dronamraju | 0e60836 | 2010-07-29 19:43:51 +0530 | [diff] [blame] | 12 | struct probe_trace_point { |
Masami Hiramatsu | 4235b04 | 2010-03-16 18:06:12 -0400 | [diff] [blame] | 13 | char *symbol; /* Base symbol */ |
Masami Hiramatsu | 190b57f | 2011-06-27 16:27:45 +0900 | [diff] [blame] | 14 | char *module; /* Module name */ |
Masami Hiramatsu | 4235b04 | 2010-03-16 18:06:12 -0400 | [diff] [blame] | 15 | unsigned long offset; /* Offset from symbol */ |
Masami Hiramatsu | fb7345b | 2013-12-26 05:41:53 +0000 | [diff] [blame] | 16 | unsigned long address; /* Actual address of the trace point */ |
Masami Hiramatsu | 4235b04 | 2010-03-16 18:06:12 -0400 | [diff] [blame] | 17 | bool retprobe; /* Return probe flag */ |
| 18 | }; |
| 19 | |
Srikar Dronamraju | 0e60836 | 2010-07-29 19:43:51 +0530 | [diff] [blame] | 20 | /* probe-tracer tracing argument referencing offset */ |
| 21 | struct probe_trace_arg_ref { |
| 22 | struct probe_trace_arg_ref *next; /* Next reference */ |
Masami Hiramatsu | 4235b04 | 2010-03-16 18:06:12 -0400 | [diff] [blame] | 23 | long offset; /* Offset value */ |
| 24 | }; |
| 25 | |
Srikar Dronamraju | 225466f | 2012-04-16 17:39:09 +0530 | [diff] [blame] | 26 | /* kprobe-tracer and uprobe-tracer tracing argument */ |
Srikar Dronamraju | 0e60836 | 2010-07-29 19:43:51 +0530 | [diff] [blame] | 27 | struct probe_trace_arg { |
Masami Hiramatsu | 4235b04 | 2010-03-16 18:06:12 -0400 | [diff] [blame] | 28 | char *name; /* Argument name */ |
| 29 | char *value; /* Base value */ |
Masami Hiramatsu | 4984912 | 2010-04-12 13:17:15 -0400 | [diff] [blame] | 30 | char *type; /* Type name */ |
Srikar Dronamraju | 0e60836 | 2010-07-29 19:43:51 +0530 | [diff] [blame] | 31 | struct probe_trace_arg_ref *ref; /* Referencing offset */ |
Masami Hiramatsu | 4235b04 | 2010-03-16 18:06:12 -0400 | [diff] [blame] | 32 | }; |
| 33 | |
Srikar Dronamraju | 225466f | 2012-04-16 17:39:09 +0530 | [diff] [blame] | 34 | /* kprobe-tracer and uprobe-tracer tracing event (point + arg) */ |
Srikar Dronamraju | 0e60836 | 2010-07-29 19:43:51 +0530 | [diff] [blame] | 35 | struct probe_trace_event { |
Masami Hiramatsu | 4235b04 | 2010-03-16 18:06:12 -0400 | [diff] [blame] | 36 | char *event; /* Event name */ |
| 37 | char *group; /* Group name */ |
Srikar Dronamraju | 0e60836 | 2010-07-29 19:43:51 +0530 | [diff] [blame] | 38 | struct probe_trace_point point; /* Trace point */ |
Masami Hiramatsu | 4235b04 | 2010-03-16 18:06:12 -0400 | [diff] [blame] | 39 | int nargs; /* Number of args */ |
Srikar Dronamraju | 225466f | 2012-04-16 17:39:09 +0530 | [diff] [blame] | 40 | bool uprobes; /* uprobes only */ |
Srikar Dronamraju | 0e60836 | 2010-07-29 19:43:51 +0530 | [diff] [blame] | 41 | struct probe_trace_arg *args; /* Arguments */ |
Masami Hiramatsu | 4235b04 | 2010-03-16 18:06:12 -0400 | [diff] [blame] | 42 | }; |
| 43 | |
| 44 | /* Perf probe probing point */ |
| 45 | struct perf_probe_point { |
| 46 | char *file; /* File path */ |
| 47 | char *function; /* Function name */ |
| 48 | int line; /* Line number */ |
Arnaldo Carvalho de Melo | eed05fe | 2010-04-05 12:53:45 -0300 | [diff] [blame] | 49 | bool retprobe; /* Return probe flag */ |
Masami Hiramatsu | 4235b04 | 2010-03-16 18:06:12 -0400 | [diff] [blame] | 50 | char *lazy_line; /* Lazy matching pattern */ |
| 51 | unsigned long offset; /* Offset from function entry */ |
Masami Hiramatsu | 4235b04 | 2010-03-16 18:06:12 -0400 | [diff] [blame] | 52 | }; |
| 53 | |
Masami Hiramatsu | 7df2f32 | 2010-03-16 18:06:26 -0400 | [diff] [blame] | 54 | /* Perf probe probing argument field chain */ |
| 55 | struct perf_probe_arg_field { |
| 56 | struct perf_probe_arg_field *next; /* Next field */ |
| 57 | char *name; /* Name of the field */ |
Masami Hiramatsu | b2a3c12 | 2010-05-19 15:57:42 -0400 | [diff] [blame] | 58 | long index; /* Array index number */ |
Masami Hiramatsu | 7df2f32 | 2010-03-16 18:06:26 -0400 | [diff] [blame] | 59 | bool ref; /* Referencing flag */ |
| 60 | }; |
| 61 | |
Masami Hiramatsu | 4235b04 | 2010-03-16 18:06:12 -0400 | [diff] [blame] | 62 | /* Perf probe probing argument */ |
| 63 | struct perf_probe_arg { |
Masami Hiramatsu | 7df2f32 | 2010-03-16 18:06:26 -0400 | [diff] [blame] | 64 | char *name; /* Argument name */ |
Masami Hiramatsu | 4848193 | 2010-04-12 13:16:53 -0400 | [diff] [blame] | 65 | char *var; /* Variable name */ |
Masami Hiramatsu | 11a1ca3 | 2010-04-12 13:17:22 -0400 | [diff] [blame] | 66 | char *type; /* Type name */ |
Masami Hiramatsu | 7df2f32 | 2010-03-16 18:06:26 -0400 | [diff] [blame] | 67 | struct perf_probe_arg_field *field; /* Structure fields */ |
Masami Hiramatsu | 4235b04 | 2010-03-16 18:06:12 -0400 | [diff] [blame] | 68 | }; |
| 69 | |
| 70 | /* Perf probe probing event (point + arg) */ |
| 71 | struct perf_probe_event { |
| 72 | char *event; /* Event name */ |
| 73 | char *group; /* Group name */ |
| 74 | struct perf_probe_point point; /* Probe point */ |
| 75 | int nargs; /* Number of arguments */ |
Srikar Dronamraju | 225466f | 2012-04-16 17:39:09 +0530 | [diff] [blame] | 76 | bool uprobes; |
Masami Hiramatsu | 4235b04 | 2010-03-16 18:06:12 -0400 | [diff] [blame] | 77 | struct perf_probe_arg *args; /* Arguments */ |
| 78 | }; |
| 79 | |
Masami Hiramatsu | 4235b04 | 2010-03-16 18:06:12 -0400 | [diff] [blame] | 80 | /* Line range */ |
| 81 | struct line_range { |
| 82 | char *file; /* File name */ |
| 83 | char *function; /* Function name */ |
Masami Hiramatsu | d3b63d7 | 2010-04-14 18:39:42 -0400 | [diff] [blame] | 84 | int start; /* Start line number */ |
| 85 | int end; /* End line number */ |
Masami Hiramatsu | 4235b04 | 2010-03-16 18:06:12 -0400 | [diff] [blame] | 86 | int offset; /* Start line offset */ |
| 87 | char *path; /* Real path name */ |
Masami Hiramatsu | 6a330a3 | 2010-07-09 18:29:11 +0900 | [diff] [blame] | 88 | char *comp_dir; /* Compile directory */ |
Masami Hiramatsu | 5a62257 | 2014-02-06 05:32:09 +0000 | [diff] [blame] | 89 | struct intlist *line_list; /* Visible lines */ |
Masami Hiramatsu | 4235b04 | 2010-03-16 18:06:12 -0400 | [diff] [blame] | 90 | }; |
| 91 | |
Masami Hiramatsu | cf6eb48 | 2010-10-21 19:13:23 +0900 | [diff] [blame] | 92 | /* List of variables */ |
| 93 | struct variable_list { |
| 94 | struct probe_trace_point point; /* Actual probepoint */ |
| 95 | struct strlist *vars; /* Available variables */ |
| 96 | }; |
| 97 | |
Masami Hiramatsu | 4235b04 | 2010-03-16 18:06:12 -0400 | [diff] [blame] | 98 | /* Command string to events */ |
Masami Hiramatsu | 146a143 | 2010-04-12 13:17:42 -0400 | [diff] [blame] | 99 | extern int parse_perf_probe_command(const char *cmd, |
| 100 | struct perf_probe_event *pev); |
Masami Hiramatsu | 4235b04 | 2010-03-16 18:06:12 -0400 | [diff] [blame] | 101 | |
| 102 | /* Events to command string */ |
| 103 | extern char *synthesize_perf_probe_command(struct perf_probe_event *pev); |
Srikar Dronamraju | 0e60836 | 2010-07-29 19:43:51 +0530 | [diff] [blame] | 104 | extern char *synthesize_probe_trace_command(struct probe_trace_event *tev); |
Masami Hiramatsu | 7df2f32 | 2010-03-16 18:06:26 -0400 | [diff] [blame] | 105 | extern int synthesize_perf_probe_arg(struct perf_probe_arg *pa, char *buf, |
| 106 | size_t len); |
Masami Hiramatsu | 4235b04 | 2010-03-16 18:06:12 -0400 | [diff] [blame] | 107 | |
| 108 | /* Check the perf_probe_event needs debuginfo */ |
| 109 | extern bool perf_probe_event_need_dwarf(struct perf_probe_event *pev); |
| 110 | |
Masami Hiramatsu | 4235b04 | 2010-03-16 18:06:12 -0400 | [diff] [blame] | 111 | /* Release event contents */ |
| 112 | extern void clear_perf_probe_event(struct perf_probe_event *pev); |
Masami Hiramatsu | 4235b04 | 2010-03-16 18:06:12 -0400 | [diff] [blame] | 113 | |
| 114 | /* Command string to line-range */ |
Masami Hiramatsu | 146a143 | 2010-04-12 13:17:42 -0400 | [diff] [blame] | 115 | extern int parse_line_range_desc(const char *cmd, struct line_range *lr); |
Masami Hiramatsu | 4235b04 | 2010-03-16 18:06:12 -0400 | [diff] [blame] | 116 | |
Masami Hiramatsu | e53b00d | 2014-01-16 09:39:47 +0000 | [diff] [blame] | 117 | /* Release line range members */ |
| 118 | extern void line_range__clear(struct line_range *lr); |
| 119 | |
| 120 | /* Initialize line range */ |
Masami Hiramatsu | 5a62257 | 2014-02-06 05:32:09 +0000 | [diff] [blame] | 121 | extern int line_range__init(struct line_range *lr); |
Masami Hiramatsu | e53b00d | 2014-01-16 09:39:47 +0000 | [diff] [blame] | 122 | |
Masami Hiramatsu | 469b9b8 | 2010-10-21 19:13:41 +0900 | [diff] [blame] | 123 | /* Internal use: Return kernel/module path */ |
| 124 | extern const char *kernel_get_module_path(const char *module); |
Masami Hiramatsu | 4235b04 | 2010-03-16 18:06:12 -0400 | [diff] [blame] | 125 | |
Masami Hiramatsu | ef4a356 | 2010-04-21 15:56:40 -0400 | [diff] [blame] | 126 | extern int add_perf_probe_events(struct perf_probe_event *pevs, int npevs, |
Masami Hiramatsu | 469b9b8 | 2010-10-21 19:13:41 +0900 | [diff] [blame] | 127 | int max_probe_points, const char *module, |
| 128 | bool force_add); |
Masami Hiramatsu | 146a143 | 2010-04-12 13:17:42 -0400 | [diff] [blame] | 129 | extern int del_perf_probe_events(struct strlist *dellist); |
| 130 | extern int show_perf_probe_events(void); |
Masami Hiramatsu | 2b394bc | 2014-09-17 08:40:54 +0000 | [diff] [blame] | 131 | extern int show_line_range(struct line_range *lr, const char *module, |
| 132 | bool user); |
Masami Hiramatsu | cf6eb48 | 2010-10-21 19:13:23 +0900 | [diff] [blame] | 133 | extern int show_available_vars(struct perf_probe_event *pevs, int npevs, |
Masami Hiramatsu | 469b9b8 | 2010-10-21 19:13:41 +0900 | [diff] [blame] | 134 | int max_probe_points, const char *module, |
Masami Hiramatsu | bd09d7b | 2011-01-20 23:15:39 +0900 | [diff] [blame] | 135 | struct strfilter *filter, bool externs); |
Srikar Dronamraju | 225466f | 2012-04-16 17:39:09 +0530 | [diff] [blame] | 136 | extern int show_available_funcs(const char *module, struct strfilter *filter, |
| 137 | bool user); |
Masami Hiramatsu | 4235b04 | 2010-03-16 18:06:12 -0400 | [diff] [blame] | 138 | |
Masami Hiramatsu | b498ce1 | 2009-11-30 19:20:25 -0500 | [diff] [blame] | 139 | /* Maximum index number of event-name postfix */ |
| 140 | #define MAX_EVENT_INDEX 1024 |
| 141 | |
Masami Hiramatsu | 50656ee | 2009-11-30 19:19:58 -0500 | [diff] [blame] | 142 | #endif /*_PROBE_EVENT_H */ |