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