blob: 3434fc9d79d5a11c1b67a594f06feda2d8100ea0 [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 */
13 unsigned long offset; /* Offset from symbol */
14 bool retprobe; /* Return probe flag */
15};
16
Srikar Dronamraju0e608362010-07-29 19:43:51 +053017/* probe-tracer tracing argument referencing offset */
18struct probe_trace_arg_ref {
19 struct probe_trace_arg_ref *next; /* Next reference */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040020 long offset; /* Offset value */
21};
22
23/* kprobe-tracer tracing argument */
Srikar Dronamraju0e608362010-07-29 19:43:51 +053024struct probe_trace_arg {
Masami Hiramatsu4235b042010-03-16 18:06:12 -040025 char *name; /* Argument name */
26 char *value; /* Base value */
Masami Hiramatsu49849122010-04-12 13:17:15 -040027 char *type; /* Type name */
Srikar Dronamraju0e608362010-07-29 19:43:51 +053028 struct probe_trace_arg_ref *ref; /* Referencing offset */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040029};
30
31/* kprobe-tracer tracing event (point + arg) */
Srikar Dronamraju0e608362010-07-29 19:43:51 +053032struct probe_trace_event {
Masami Hiramatsu4235b042010-03-16 18:06:12 -040033 char *event; /* Event name */
34 char *group; /* Group name */
Srikar Dronamraju0e608362010-07-29 19:43:51 +053035 struct probe_trace_point point; /* Trace point */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040036 int nargs; /* Number of args */
Srikar Dronamraju0e608362010-07-29 19:43:51 +053037 struct probe_trace_arg *args; /* Arguments */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040038};
39
40/* Perf probe probing point */
41struct perf_probe_point {
42 char *file; /* File path */
43 char *function; /* Function name */
44 int line; /* Line number */
Arnaldo Carvalho de Meloeed05fe2010-04-05 12:53:45 -030045 bool retprobe; /* Return probe flag */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040046 char *lazy_line; /* Lazy matching pattern */
47 unsigned long offset; /* Offset from function entry */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040048};
49
Masami Hiramatsu7df2f322010-03-16 18:06:26 -040050/* Perf probe probing argument field chain */
51struct perf_probe_arg_field {
52 struct perf_probe_arg_field *next; /* Next field */
53 char *name; /* Name of the field */
Masami Hiramatsub2a3c122010-05-19 15:57:42 -040054 long index; /* Array index number */
Masami Hiramatsu7df2f322010-03-16 18:06:26 -040055 bool ref; /* Referencing flag */
56};
57
Masami Hiramatsu4235b042010-03-16 18:06:12 -040058/* Perf probe probing argument */
59struct perf_probe_arg {
Masami Hiramatsu7df2f322010-03-16 18:06:26 -040060 char *name; /* Argument name */
Masami Hiramatsu48481932010-04-12 13:16:53 -040061 char *var; /* Variable name */
Masami Hiramatsu11a1ca32010-04-12 13:17:22 -040062 char *type; /* Type name */
Masami Hiramatsu7df2f322010-03-16 18:06:26 -040063 struct perf_probe_arg_field *field; /* Structure fields */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040064};
65
66/* Perf probe probing event (point + arg) */
67struct perf_probe_event {
68 char *event; /* Event name */
69 char *group; /* Group name */
70 struct perf_probe_point point; /* Probe point */
71 int nargs; /* Number of arguments */
72 struct perf_probe_arg *args; /* Arguments */
73};
74
75
76/* Line number container */
77struct line_node {
78 struct list_head list;
Masami Hiramatsud3b63d72010-04-14 18:39:42 -040079 int line;
Masami Hiramatsu4235b042010-03-16 18:06:12 -040080};
81
82/* Line range */
83struct line_range {
84 char *file; /* File name */
85 char *function; /* Function name */
Masami Hiramatsud3b63d72010-04-14 18:39:42 -040086 int start; /* Start line number */
87 int end; /* End line number */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040088 int offset; /* Start line offset */
89 char *path; /* Real path name */
Masami Hiramatsu6a330a32010-07-09 18:29:11 +090090 char *comp_dir; /* Compile directory */
Masami Hiramatsu4235b042010-03-16 18:06:12 -040091 struct list_head line_list; /* Visible lines */
92};
93
Masami Hiramatsucf6eb482010-10-21 19:13:23 +090094/* List of variables */
95struct variable_list {
96 struct probe_trace_point point; /* Actual probepoint */
97 struct strlist *vars; /* Available variables */
98};
99
Masami Hiramatsu4235b042010-03-16 18:06:12 -0400100/* Command string to events */
Masami Hiramatsu146a1432010-04-12 13:17:42 -0400101extern int parse_perf_probe_command(const char *cmd,
102 struct perf_probe_event *pev);
Masami Hiramatsu4235b042010-03-16 18:06:12 -0400103
104/* Events to command string */
105extern char *synthesize_perf_probe_command(struct perf_probe_event *pev);
Srikar Dronamraju0e608362010-07-29 19:43:51 +0530106extern char *synthesize_probe_trace_command(struct probe_trace_event *tev);
Masami Hiramatsu7df2f322010-03-16 18:06:26 -0400107extern int synthesize_perf_probe_arg(struct perf_probe_arg *pa, char *buf,
108 size_t len);
Masami Hiramatsu4235b042010-03-16 18:06:12 -0400109
110/* Check the perf_probe_event needs debuginfo */
111extern bool perf_probe_event_need_dwarf(struct perf_probe_event *pev);
112
Masami Hiramatsu4235b042010-03-16 18:06:12 -0400113/* Release event contents */
114extern void clear_perf_probe_event(struct perf_probe_event *pev);
Masami Hiramatsu4235b042010-03-16 18:06:12 -0400115
116/* Command string to line-range */
Masami Hiramatsu146a1432010-04-12 13:17:42 -0400117extern int parse_line_range_desc(const char *cmd, struct line_range *lr);
Masami Hiramatsu4235b042010-03-16 18:06:12 -0400118
Masami Hiramatsu469b9b82010-10-21 19:13:41 +0900119/* Internal use: Return kernel/module path */
120extern const char *kernel_get_module_path(const char *module);
Masami Hiramatsu4235b042010-03-16 18:06:12 -0400121
Masami Hiramatsuef4a3562010-04-21 15:56:40 -0400122extern int add_perf_probe_events(struct perf_probe_event *pevs, int npevs,
Masami Hiramatsu469b9b82010-10-21 19:13:41 +0900123 int max_probe_points, const char *module,
124 bool force_add);
Masami Hiramatsu146a1432010-04-12 13:17:42 -0400125extern int del_perf_probe_events(struct strlist *dellist);
126extern int show_perf_probe_events(void);
Masami Hiramatsu469b9b82010-10-21 19:13:41 +0900127extern int show_line_range(struct line_range *lr, const char *module);
Masami Hiramatsucf6eb482010-10-21 19:13:23 +0900128extern int show_available_vars(struct perf_probe_event *pevs, int npevs,
Masami Hiramatsu469b9b82010-10-21 19:13:41 +0900129 int max_probe_points, const char *module,
Masami Hiramatsubd09d7b2011-01-20 23:15:39 +0900130 struct strfilter *filter, bool externs);
Masami Hiramatsu3c422582011-01-20 23:15:45 +0900131extern int show_available_funcs(const char *module, struct strfilter *filter);
Masami Hiramatsu50656ee2009-11-30 19:19:58 -0500132
Masami Hiramatsu4235b042010-03-16 18:06:12 -0400133
Masami Hiramatsub498ce12009-11-30 19:20:25 -0500134/* Maximum index number of event-name postfix */
135#define MAX_EVENT_INDEX 1024
136
Masami Hiramatsu50656ee2009-11-30 19:19:58 -0500137#endif /*_PROBE_EVENT_H */