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 */ |
| 10 | struct kprobe_trace_point { |
| 11 | char *symbol; /* Base symbol */ |
| 12 | unsigned long offset; /* Offset from symbol */ |
| 13 | bool retprobe; /* Return probe flag */ |
| 14 | }; |
| 15 | |
| 16 | /* kprobe-tracer tracing argument referencing offset */ |
| 17 | struct kprobe_trace_arg_ref { |
| 18 | struct kprobe_trace_arg_ref *next; /* Next reference */ |
| 19 | long offset; /* Offset value */ |
| 20 | }; |
| 21 | |
| 22 | /* kprobe-tracer tracing argument */ |
| 23 | struct kprobe_trace_arg { |
| 24 | char *name; /* Argument name */ |
| 25 | char *value; /* Base value */ |
| 26 | struct kprobe_trace_arg_ref *ref; /* Referencing offset */ |
| 27 | }; |
| 28 | |
| 29 | /* kprobe-tracer tracing event (point + arg) */ |
| 30 | struct kprobe_trace_event { |
| 31 | char *event; /* Event name */ |
| 32 | char *group; /* Group name */ |
| 33 | struct kprobe_trace_point point; /* Trace point */ |
| 34 | int nargs; /* Number of args */ |
| 35 | struct kprobe_trace_arg *args; /* Arguments */ |
| 36 | }; |
| 37 | |
| 38 | /* Perf probe probing point */ |
| 39 | struct perf_probe_point { |
| 40 | char *file; /* File path */ |
| 41 | char *function; /* Function name */ |
| 42 | int line; /* Line number */ |
| 43 | char *lazy_line; /* Lazy matching pattern */ |
| 44 | unsigned long offset; /* Offset from function entry */ |
| 45 | bool retprobe; /* Return probe flag */ |
| 46 | }; |
| 47 | |
| 48 | /* Perf probe probing argument */ |
| 49 | struct perf_probe_arg { |
| 50 | char *name; /* Argument name */ |
| 51 | }; |
| 52 | |
| 53 | /* Perf probe probing event (point + arg) */ |
| 54 | struct perf_probe_event { |
| 55 | char *event; /* Event name */ |
| 56 | char *group; /* Group name */ |
| 57 | struct perf_probe_point point; /* Probe point */ |
| 58 | int nargs; /* Number of arguments */ |
| 59 | struct perf_probe_arg *args; /* Arguments */ |
| 60 | }; |
| 61 | |
| 62 | |
| 63 | /* Line number container */ |
| 64 | struct line_node { |
| 65 | struct list_head list; |
| 66 | unsigned int line; |
| 67 | }; |
| 68 | |
| 69 | /* Line range */ |
| 70 | struct line_range { |
| 71 | char *file; /* File name */ |
| 72 | char *function; /* Function name */ |
| 73 | unsigned int start; /* Start line number */ |
| 74 | unsigned int end; /* End line number */ |
| 75 | int offset; /* Start line offset */ |
| 76 | char *path; /* Real path name */ |
| 77 | struct list_head line_list; /* Visible lines */ |
| 78 | }; |
| 79 | |
| 80 | /* Command string to events */ |
| 81 | extern void parse_perf_probe_command(const char *cmd, |
| 82 | struct perf_probe_event *pev); |
| 83 | extern void parse_kprobe_trace_command(const char *cmd, |
| 84 | struct kprobe_trace_event *tev); |
| 85 | |
| 86 | /* Events to command string */ |
| 87 | extern char *synthesize_perf_probe_command(struct perf_probe_event *pev); |
| 88 | extern char *synthesize_kprobe_trace_command(struct kprobe_trace_event *tev); |
| 89 | |
| 90 | /* Check the perf_probe_event needs debuginfo */ |
| 91 | extern bool perf_probe_event_need_dwarf(struct perf_probe_event *pev); |
| 92 | |
| 93 | /* Convert from kprobe_trace_event to perf_probe_event */ |
| 94 | extern void convert_to_perf_probe_event(struct kprobe_trace_event *tev, |
| 95 | struct perf_probe_event *pev); |
| 96 | |
| 97 | /* Release event contents */ |
| 98 | extern void clear_perf_probe_event(struct perf_probe_event *pev); |
| 99 | extern void clear_kprobe_trace_event(struct kprobe_trace_event *tev); |
| 100 | |
| 101 | /* Command string to line-range */ |
| 102 | extern void parse_line_range_desc(const char *cmd, struct line_range *lr); |
| 103 | |
| 104 | |
| 105 | extern void add_perf_probe_events(struct perf_probe_event *pevs, int ntevs, |
| 106 | bool force_add); |
| 107 | extern void del_perf_probe_events(struct strlist *dellist); |
Masami Hiramatsu | 4de189f | 2009-11-30 19:20:17 -0500 | [diff] [blame] | 108 | extern void show_perf_probe_events(void); |
Masami Hiramatsu | 631c9de | 2010-01-06 09:45:34 -0500 | [diff] [blame] | 109 | extern void show_line_range(struct line_range *lr); |
Masami Hiramatsu | 50656ee | 2009-11-30 19:19:58 -0500 | [diff] [blame] | 110 | |
Masami Hiramatsu | 4235b04 | 2010-03-16 18:06:12 -0400 | [diff] [blame^] | 111 | |
Masami Hiramatsu | b498ce1 | 2009-11-30 19:20:25 -0500 | [diff] [blame] | 112 | /* Maximum index number of event-name postfix */ |
| 113 | #define MAX_EVENT_INDEX 1024 |
| 114 | |
Masami Hiramatsu | 50656ee | 2009-11-30 19:19:58 -0500 | [diff] [blame] | 115 | #endif /*_PROBE_EVENT_H */ |