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