blob: 5af39243a25bd00975d6880f4524180edebb236a [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 Hiramatsu50656ee2009-11-30 19:19:58 -05006
Masami Hiramatsuf4d7da42010-03-16 18:06:05 -04007extern bool probe_event_dry_run;
8
Masami Hiramatsu4235b042010-03-16 18:06:12 -04009/* kprobe-tracer tracing point */
Srikar Dronamraju0e608362010-07-29 19:43:51 +053010struct probe_trace_point {
Masami Hiramatsu4235b042010-03-16 18:06:12 -040011 char *symbol; /* Base symbol */
12 unsigned long offset; /* Offset from symbol */
13 bool retprobe; /* Return probe flag */
14};
15
Srikar Dronamraju0e608362010-07-29 19:43:51 +053016/* probe-tracer tracing argument referencing offset */
17struct probe_trace_arg_ref {
18 struct probe_trace_arg_ref *next; /* Next reference */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040019 long offset; /* Offset value */
20};
21
22/* kprobe-tracer tracing argument */
Srikar Dronamraju0e608362010-07-29 19:43:51 +053023struct probe_trace_arg {
Masami Hiramatsu4235b042010-03-16 18:06:12 -040024 char *name; /* Argument name */
25 char *value; /* Base value */
Masami Hiramatsu49849122010-04-12 13:17:15 -040026 char *type; /* Type name */
Srikar Dronamraju0e608362010-07-29 19:43:51 +053027 struct probe_trace_arg_ref *ref; /* Referencing offset */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040028};
29
30/* kprobe-tracer tracing event (point + arg) */
Srikar Dronamraju0e608362010-07-29 19:43:51 +053031struct probe_trace_event {
Masami Hiramatsu4235b042010-03-16 18:06:12 -040032 char *event; /* Event name */
33 char *group; /* Group name */
Srikar Dronamraju0e608362010-07-29 19:43:51 +053034 struct probe_trace_point point; /* Trace point */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040035 int nargs; /* Number of args */
Srikar Dronamraju0e608362010-07-29 19:43:51 +053036 struct probe_trace_arg *args; /* Arguments */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040037};
38
39/* Perf probe probing point */
40struct perf_probe_point {
41 char *file; /* File path */
42 char *function; /* Function name */
43 int line; /* Line number */
Arnaldo Carvalho de Meloeed05fe2010-04-05 12:53:45 -030044 bool retprobe; /* Return probe flag */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040045 char *lazy_line; /* Lazy matching pattern */
46 unsigned long offset; /* Offset from function entry */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040047};
48
Masami Hiramatsu7df2f322010-03-16 18:06:26 -040049/* Perf probe probing argument field chain */
50struct perf_probe_arg_field {
51 struct perf_probe_arg_field *next; /* Next field */
52 char *name; /* Name of the field */
Masami Hiramatsub2a3c122010-05-19 15:57:42 -040053 long index; /* Array index number */
Masami Hiramatsu7df2f322010-03-16 18:06:26 -040054 bool ref; /* Referencing flag */
55};
56
Masami Hiramatsu4235b042010-03-16 18:06:12 -040057/* Perf probe probing argument */
58struct perf_probe_arg {
Masami Hiramatsu7df2f322010-03-16 18:06:26 -040059 char *name; /* Argument name */
Masami Hiramatsu48481932010-04-12 13:16:53 -040060 char *var; /* Variable name */
Masami Hiramatsu11a1ca32010-04-12 13:17:22 -040061 char *type; /* Type name */
Masami Hiramatsu7df2f322010-03-16 18:06:26 -040062 struct perf_probe_arg_field *field; /* Structure fields */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040063};
64
65/* Perf probe probing event (point + arg) */
66struct 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 */
76struct line_node {
77 struct list_head list;
Masami Hiramatsud3b63d72010-04-14 18:39:42 -040078 int line;
Masami Hiramatsu4235b042010-03-16 18:06:12 -040079};
80
81/* Line range */
82struct line_range {
83 char *file; /* File name */
84 char *function; /* Function name */
Masami Hiramatsud3b63d72010-04-14 18:39:42 -040085 int start; /* Start line number */
86 int end; /* End line number */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040087 int offset; /* Start line offset */
88 char *path; /* Real path name */
Masami Hiramatsu6a330a32010-07-09 18:29:11 +090089 char *comp_dir; /* Compile directory */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040090 struct list_head line_list; /* Visible lines */
91};
92
93/* Command string to events */
Masami Hiramatsu146a1432010-04-12 13:17:42 -040094extern int parse_perf_probe_command(const char *cmd,
95 struct perf_probe_event *pev);
Masami Hiramatsu4235b042010-03-16 18:06:12 -040096
97/* Events to command string */
98extern char *synthesize_perf_probe_command(struct perf_probe_event *pev);
Srikar Dronamraju0e608362010-07-29 19:43:51 +053099extern char *synthesize_probe_trace_command(struct probe_trace_event *tev);
Masami Hiramatsu7df2f322010-03-16 18:06:26 -0400100extern int synthesize_perf_probe_arg(struct perf_probe_arg *pa, char *buf,
101 size_t len);
Masami Hiramatsu4235b042010-03-16 18:06:12 -0400102
103/* Check the perf_probe_event needs debuginfo */
104extern bool perf_probe_event_need_dwarf(struct perf_probe_event *pev);
105
Masami Hiramatsu4235b042010-03-16 18:06:12 -0400106/* Release event contents */
107extern void clear_perf_probe_event(struct perf_probe_event *pev);
Masami Hiramatsu4235b042010-03-16 18:06:12 -0400108
109/* Command string to line-range */
Masami Hiramatsu146a1432010-04-12 13:17:42 -0400110extern int parse_line_range_desc(const char *cmd, struct line_range *lr);
Masami Hiramatsu4235b042010-03-16 18:06:12 -0400111
112
Masami Hiramatsuef4a3562010-04-21 15:56:40 -0400113extern int add_perf_probe_events(struct perf_probe_event *pevs, int npevs,
114 bool force_add, int max_probe_points);
Masami Hiramatsu146a1432010-04-12 13:17:42 -0400115extern int del_perf_probe_events(struct strlist *dellist);
116extern int show_perf_probe_events(void);
117extern int show_line_range(struct line_range *lr);
Masami Hiramatsu50656ee2009-11-30 19:19:58 -0500118
Masami Hiramatsu4235b042010-03-16 18:06:12 -0400119
Masami Hiramatsub498ce12009-11-30 19:20:25 -0500120/* Maximum index number of event-name postfix */
121#define MAX_EVENT_INDEX 1024
122
Masami Hiramatsu50656ee2009-11-30 19:19:58 -0500123#endif /*_PROBE_EVENT_H */