1 #ifndef _PROBE_EVENT_H 2 #define _PROBE_EVENT_H 3 4 #include <stdbool.h> 5 #include "strlist.h" 6 7 extern bool probe_event_dry_run; 8 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 char *type; /* Type name */ 27 struct kprobe_trace_arg_ref *ref; /* Referencing offset */ 28 }; 29 30 /* kprobe-tracer tracing event (point + arg) */ 31 struct kprobe_trace_event { 32 char *event; /* Event name */ 33 char *group; /* Group name */ 34 struct kprobe_trace_point point; /* Trace point */ 35 int nargs; /* Number of args */ 36 struct kprobe_trace_arg *args; /* Arguments */ 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 */ 44 bool retprobe; /* Return probe flag */ 45 char *lazy_line; /* Lazy matching pattern */ 46 unsigned long offset; /* Offset from function entry */ 47 }; 48 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 */ 53 bool ref; /* Referencing flag */ 54 }; 55 56 /* Perf probe probing argument */ 57 struct perf_probe_arg { 58 char *name; /* Argument name */ 59 char *var; /* Variable name */ 60 char *type; /* Type name */ 61 struct perf_probe_arg_field *field; /* Structure fields */ 62 }; 63 64 /* Perf probe probing event (point + arg) */ 65 struct perf_probe_event { 66 char *event; /* Event name */ 67 char *group; /* Group name */ 68 struct perf_probe_point point; /* Probe point */ 69 int nargs; /* Number of arguments */ 70 struct perf_probe_arg *args; /* Arguments */ 71 }; 72 73 74 /* Line number container */ 75 struct line_node { 76 struct list_head list; 77 int line; 78 }; 79 80 /* Line range */ 81 struct line_range { 82 char *file; /* File name */ 83 char *function; /* Function name */ 84 int start; /* Start line number */ 85 int end; /* End line number */ 86 int offset; /* Start line offset */ 87 char *path; /* Real path name */ 88 struct list_head line_list; /* Visible lines */ 89 }; 90 91 /* Command string to events */ 92 extern int parse_perf_probe_command(const char *cmd, 93 struct perf_probe_event *pev); 94 extern int parse_kprobe_trace_command(const char *cmd, 95 struct kprobe_trace_event *tev); 96 97 /* Events to command string */ 98 extern char *synthesize_perf_probe_command(struct perf_probe_event *pev); 99 extern char *synthesize_kprobe_trace_command(struct kprobe_trace_event *tev); 100 extern int synthesize_perf_probe_arg(struct perf_probe_arg *pa, char *buf, 101 size_t len); 102 103 /* Check the perf_probe_event needs debuginfo */ 104 extern bool perf_probe_event_need_dwarf(struct perf_probe_event *pev); 105 106 /* Convert from kprobe_trace_event to perf_probe_event */ 107 extern int convert_to_perf_probe_event(struct kprobe_trace_event *tev, 108 struct perf_probe_event *pev); 109 110 /* Release event contents */ 111 extern void clear_perf_probe_event(struct perf_probe_event *pev); 112 extern void clear_kprobe_trace_event(struct kprobe_trace_event *tev); 113 114 /* Command string to line-range */ 115 extern int parse_line_range_desc(const char *cmd, struct line_range *lr); 116 117 118 extern int add_perf_probe_events(struct perf_probe_event *pevs, int npevs, 119 bool force_add, int max_probe_points); 120 extern int del_perf_probe_events(struct strlist *dellist); 121 extern int show_perf_probe_events(void); 122 extern int show_line_range(struct line_range *lr); 123 124 125 /* Maximum index number of event-name postfix */ 126 #define MAX_EVENT_INDEX 1024 127 128 #endif /*_PROBE_EVENT_H */ 129