blob: a7dee835f49c45698d72406864a0daa29649315e [file] [log] [blame]
Masami Hiramatsu50656ee2009-11-30 19:19:58 -05001#ifndef _PROBE_EVENT_H
2#define _PROBE_EVENT_H
3
Masami Hiramatsufac13fd2009-12-15 10:31:14 -05004#include <stdbool.h>
Masami Hiramatsu4de189f2009-11-30 19:20:17 -05005#include "strlist.h"
Masami Hiramatsubd09d7b2011-01-20 23:15:39 +09006#include "strfilter.h"
Masami Hiramatsu50656ee2009-11-30 19:19:58 -05007
Masami Hiramatsuf4d7da42010-03-16 18:06:05 -04008extern bool probe_event_dry_run;
9
Masami Hiramatsu4235b042010-03-16 18:06:12 -040010/* kprobe-tracer tracing point */
Srikar Dronamraju0e608362010-07-29 19:43:51 +053011struct probe_trace_point {
Masami Hiramatsu4235b042010-03-16 18:06:12 -040012 char *symbol; /* Base symbol */
Masami Hiramatsu190b57f2011-06-27 16:27:45 +090013 char *module; /* Module name */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040014 unsigned long offset; /* Offset from symbol */
15 bool retprobe; /* Return probe flag */
16};
17
Srikar Dronamraju0e608362010-07-29 19:43:51 +053018/* probe-tracer tracing argument referencing offset */
19struct probe_trace_arg_ref {
20 struct probe_trace_arg_ref *next; /* Next reference */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040021 long offset; /* Offset value */
22};
23
24/* kprobe-tracer tracing argument */
Srikar Dronamraju0e608362010-07-29 19:43:51 +053025struct probe_trace_arg {
Masami Hiramatsu4235b042010-03-16 18:06:12 -040026 char *name; /* Argument name */
27 char *value; /* Base value */
Masami Hiramatsu49849122010-04-12 13:17:15 -040028 char *type; /* Type name */
Srikar Dronamraju0e608362010-07-29 19:43:51 +053029 struct probe_trace_arg_ref *ref; /* Referencing offset */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040030};
31
32/* kprobe-tracer tracing event (point + arg) */
Srikar Dronamraju0e608362010-07-29 19:43:51 +053033struct probe_trace_event {
Masami Hiramatsu4235b042010-03-16 18:06:12 -040034 char *event; /* Event name */
35 char *group; /* Group name */
Srikar Dronamraju0e608362010-07-29 19:43:51 +053036 struct probe_trace_point point; /* Trace point */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040037 int nargs; /* Number of args */
Srikar Dronamraju0e608362010-07-29 19:43:51 +053038 struct probe_trace_arg *args; /* Arguments */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040039};
40
41/* Perf probe probing point */
42struct perf_probe_point {
43 char *file; /* File path */
44 char *function; /* Function name */
45 int line; /* Line number */
Arnaldo Carvalho de Meloeed05fe2010-04-05 12:53:45 -030046 bool retprobe; /* Return probe flag */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040047 char *lazy_line; /* Lazy matching pattern */
48 unsigned long offset; /* Offset from function entry */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040049};
50
Masami Hiramatsu7df2f322010-03-16 18:06:26 -040051/* Perf probe probing argument field chain */
52struct perf_probe_arg_field {
53 struct perf_probe_arg_field *next; /* Next field */
54 char *name; /* Name of the field */
Masami Hiramatsub2a3c122010-05-19 15:57:42 -040055 long index; /* Array index number */
Masami Hiramatsu7df2f322010-03-16 18:06:26 -040056 bool ref; /* Referencing flag */
57};
58
Masami Hiramatsu4235b042010-03-16 18:06:12 -040059/* Perf probe probing argument */
60struct perf_probe_arg {
Masami Hiramatsu7df2f322010-03-16 18:06:26 -040061 char *name; /* Argument name */
Masami Hiramatsu48481932010-04-12 13:16:53 -040062 char *var; /* Variable name */
Masami Hiramatsu11a1ca32010-04-12 13:17:22 -040063 char *type; /* Type name */
Masami Hiramatsu7df2f322010-03-16 18:06:26 -040064 struct perf_probe_arg_field *field; /* Structure fields */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040065};
66
67/* Perf probe probing event (point + arg) */
68struct 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 */
78struct line_node {
79 struct list_head list;
Masami Hiramatsud3b63d72010-04-14 18:39:42 -040080 int line;
Masami Hiramatsu4235b042010-03-16 18:06:12 -040081};
82
83/* Line range */
84struct line_range {
85 char *file; /* File name */
86 char *function; /* Function name */
Masami Hiramatsud3b63d72010-04-14 18:39:42 -040087 int start; /* Start line number */
88 int end; /* End line number */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040089 int offset; /* Start line offset */
90 char *path; /* Real path name */
Masami Hiramatsu6a330a32010-07-09 18:29:11 +090091 char *comp_dir; /* Compile directory */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040092 struct list_head line_list; /* Visible lines */
93};
94
Masami Hiramatsucf6eb482010-10-21 19:13:23 +090095/* List of variables */
96struct variable_list {
97 struct probe_trace_point point; /* Actual probepoint */
98 struct strlist *vars; /* Available variables */
99};
100
Masami Hiramatsu4235b042010-03-16 18:06:12 -0400101/* Command string to events */
Masami Hiramatsu146a1432010-04-12 13:17:42 -0400102extern int parse_perf_probe_command(const char *cmd,
103 struct perf_probe_event *pev);
Masami Hiramatsu4235b042010-03-16 18:06:12 -0400104
105/* Events to command string */
106extern char *synthesize_perf_probe_command(struct perf_probe_event *pev);
Srikar Dronamraju0e608362010-07-29 19:43:51 +0530107extern char *synthesize_probe_trace_command(struct probe_trace_event *tev);
Masami Hiramatsu7df2f322010-03-16 18:06:26 -0400108extern int synthesize_perf_probe_arg(struct perf_probe_arg *pa, char *buf,
109 size_t len);
Masami Hiramatsu4235b042010-03-16 18:06:12 -0400110
111/* Check the perf_probe_event needs debuginfo */
112extern bool perf_probe_event_need_dwarf(struct perf_probe_event *pev);
113
Masami Hiramatsu4235b042010-03-16 18:06:12 -0400114/* Release event contents */
115extern void clear_perf_probe_event(struct perf_probe_event *pev);
Masami Hiramatsu4235b042010-03-16 18:06:12 -0400116
117/* Command string to line-range */
Masami Hiramatsu146a1432010-04-12 13:17:42 -0400118extern int parse_line_range_desc(const char *cmd, struct line_range *lr);
Masami Hiramatsu4235b042010-03-16 18:06:12 -0400119
Masami Hiramatsu469b9b82010-10-21 19:13:41 +0900120/* Internal use: Return kernel/module path */
121extern const char *kernel_get_module_path(const char *module);
Masami Hiramatsu4235b042010-03-16 18:06:12 -0400122
Masami Hiramatsuef4a3562010-04-21 15:56:40 -0400123extern int add_perf_probe_events(struct perf_probe_event *pevs, int npevs,
Masami Hiramatsu469b9b82010-10-21 19:13:41 +0900124 int max_probe_points, const char *module,
125 bool force_add);
Masami Hiramatsu146a1432010-04-12 13:17:42 -0400126extern int del_perf_probe_events(struct strlist *dellist);
127extern int show_perf_probe_events(void);
Masami Hiramatsu469b9b82010-10-21 19:13:41 +0900128extern int show_line_range(struct line_range *lr, const char *module);
Masami Hiramatsucf6eb482010-10-21 19:13:23 +0900129extern int show_available_vars(struct perf_probe_event *pevs, int npevs,
Masami Hiramatsu469b9b82010-10-21 19:13:41 +0900130 int max_probe_points, const char *module,
Masami Hiramatsubd09d7b2011-01-20 23:15:39 +0900131 struct strfilter *filter, bool externs);
Masami Hiramatsu3c422582011-01-20 23:15:45 +0900132extern int show_available_funcs(const char *module, struct strfilter *filter);
Masami Hiramatsu50656ee2009-11-30 19:19:58 -0500133
Masami Hiramatsu4235b042010-03-16 18:06:12 -0400134
Masami Hiramatsub498ce12009-11-30 19:20:25 -0500135/* Maximum index number of event-name postfix */
136#define MAX_EVENT_INDEX 1024
137
Masami Hiramatsu50656ee2009-11-30 19:19:58 -0500138#endif /*_PROBE_EVENT_H */