probe-event.h 4.3 KB
Newer Older
1 2 3
#ifndef _PROBE_EVENT_H
#define _PROBE_EVENT_H

4
#include <stdbool.h>
5
#include "strlist.h"
6
#include "strfilter.h"
7

8 9
extern bool probe_event_dry_run;

10
/* kprobe-tracer and uprobe-tracer tracing point */
11
struct probe_trace_point {
12
	char		*symbol;	/* Base symbol */
13
	char		*module;	/* Module name */
14
	unsigned long	offset;		/* Offset from symbol */
15
	unsigned long	address;	/* Actual address of the trace point */
16 17 18
	bool		retprobe;	/* Return probe flag */
};

19 20 21
/* probe-tracer tracing argument referencing offset */
struct probe_trace_arg_ref {
	struct probe_trace_arg_ref	*next;	/* Next reference */
22 23 24
	long				offset;	/* Offset value */
};

25
/* kprobe-tracer and uprobe-tracer tracing argument */
26
struct probe_trace_arg {
27 28
	char				*name;	/* Argument name */
	char				*value;	/* Base value */
29
	char				*type;	/* Type name */
30
	struct probe_trace_arg_ref	*ref;	/* Referencing offset */
31 32
};

33
/* kprobe-tracer and uprobe-tracer tracing event (point + arg) */
34
struct probe_trace_event {
35 36
	char				*event;	/* Event name */
	char				*group;	/* Group name */
37
	struct probe_trace_point	point;	/* Trace point */
38
	int				nargs;	/* Number of args */
39
	bool				uprobes;	/* uprobes only */
40
	struct probe_trace_arg		*args;	/* Arguments */
41 42 43 44 45 46 47
};

/* Perf probe probing point */
struct perf_probe_point {
	char		*file;		/* File path */
	char		*function;	/* Function name */
	int		line;		/* Line number */
48
	bool		retprobe;	/* Return probe flag */
49 50 51 52
	char		*lazy_line;	/* Lazy matching pattern */
	unsigned long	offset;		/* Offset from function entry */
};

53 54 55 56
/* Perf probe probing argument field chain */
struct perf_probe_arg_field {
	struct perf_probe_arg_field	*next;	/* Next field */
	char				*name;	/* Name of the field */
57
	long				index;	/* Array index number */
58 59 60
	bool				ref;	/* Referencing flag */
};

61 62
/* Perf probe probing argument */
struct perf_probe_arg {
63
	char				*name;	/* Argument name */
64
	char				*var;	/* Variable name */
65
	char				*type;	/* Type name */
66
	struct perf_probe_arg_field	*field;	/* Structure fields */
67 68 69 70 71 72 73 74
};

/* Perf probe probing event (point + arg) */
struct perf_probe_event {
	char			*event;	/* Event name */
	char			*group;	/* Group name */
	struct perf_probe_point	point;	/* Probe point */
	int			nargs;	/* Number of arguments */
75
	bool			uprobes;
76 77 78 79 80 81 82
	struct perf_probe_arg	*args;	/* Arguments */
};


/* Line number container */
struct line_node {
	struct list_head	list;
83
	int			line;
84 85 86 87 88 89
};

/* Line range */
struct line_range {
	char			*file;		/* File name */
	char			*function;	/* Function name */
90 91
	int			start;		/* Start line number */
	int			end;		/* End line number */
92 93
	int			offset;		/* Start line offset */
	char			*path;		/* Real path name */
94
	char			*comp_dir;	/* Compile directory */
95 96 97
	struct list_head	line_list;	/* Visible lines */
};

98 99 100 101 102 103
/* List of variables */
struct variable_list {
	struct probe_trace_point	point;	/* Actual probepoint */
	struct strlist			*vars;	/* Available variables */
};

104
/* Command string to events */
105 106
extern int parse_perf_probe_command(const char *cmd,
				    struct perf_probe_event *pev);
107 108 109

/* Events to command string */
extern char *synthesize_perf_probe_command(struct perf_probe_event *pev);
110
extern char *synthesize_probe_trace_command(struct probe_trace_event *tev);
111 112
extern int synthesize_perf_probe_arg(struct perf_probe_arg *pa, char *buf,
				     size_t len);
113 114 115 116 117 118 119 120

/* Check the perf_probe_event needs debuginfo */
extern bool perf_probe_event_need_dwarf(struct perf_probe_event *pev);

/* Release event contents */
extern void clear_perf_probe_event(struct perf_probe_event *pev);

/* Command string to line-range */
121
extern int parse_line_range_desc(const char *cmd, struct line_range *lr);
122

123 124
/* Internal use: Return kernel/module path */
extern const char *kernel_get_module_path(const char *module);
125

126
extern int add_perf_probe_events(struct perf_probe_event *pevs, int npevs,
127 128
				 int max_probe_points, const char *module,
				 bool force_add);
129 130
extern int del_perf_probe_events(struct strlist *dellist);
extern int show_perf_probe_events(void);
131
extern int show_line_range(struct line_range *lr, const char *module);
132
extern int show_available_vars(struct perf_probe_event *pevs, int npevs,
133
			       int max_probe_points, const char *module,
134
			       struct strfilter *filter, bool externs);
135 136
extern int show_available_funcs(const char *module, struct strfilter *filter,
				bool user);
137

138 139 140
/* Maximum index number of event-name postfix */
#define MAX_EVENT_INDEX	1024

141
#endif /*_PROBE_EVENT_H */