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