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

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

7 8
extern bool probe_event_dry_run;

9
/* kprobe-tracer tracing point */
10
struct probe_trace_point {
11 12 13 14 15
	char		*symbol;	/* Base symbol */
	unsigned long	offset;		/* Offset from symbol */
	bool		retprobe;	/* Return probe flag */
};

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

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

/* kprobe-tracer tracing event (point + arg) */
31
struct probe_trace_event {
32 33
	char				*event;	/* Event name */
	char				*group;	/* Group name */
34
	struct probe_trace_point	point;	/* Trace point */
35
	int				nargs;	/* Number of args */
36
	struct probe_trace_arg		*args;	/* Arguments */
37 38 39 40 41 42 43
};

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

49 50 51 52
/* 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 */
53
	long				index;	/* Array index number */
54 55 56
	bool				ref;	/* Referencing flag */
};

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

/* 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 */
	struct perf_probe_arg	*args;	/* Arguments */
};


/* Line number container */
struct line_node {
	struct list_head	list;
78
	int			line;
79 80 81 82 83 84
};

/* Line range */
struct line_range {
	char			*file;		/* File name */
	char			*function;	/* Function name */
85 86
	int			start;		/* Start line number */
	int			end;		/* End line number */
87 88
	int			offset;		/* Start line offset */
	char			*path;		/* Real path name */
89
	char			*comp_dir;	/* Compile directory */
90 91 92
	struct list_head	line_list;	/* Visible lines */
};

93 94 95 96 97 98
/* List of variables */
struct variable_list {
	struct probe_trace_point	point;	/* Actual probepoint */
	struct strlist			*vars;	/* Available variables */
};

99
/* Command string to events */
100 101
extern int parse_perf_probe_command(const char *cmd,
				    struct perf_probe_event *pev);
102 103 104

/* Events to command string */
extern char *synthesize_perf_probe_command(struct perf_probe_event *pev);
105
extern char *synthesize_probe_trace_command(struct probe_trace_event *tev);
106 107
extern int synthesize_perf_probe_arg(struct perf_probe_arg *pa, char *buf,
				     size_t len);
108 109 110 111 112 113 114 115

/* 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 */
116
extern int parse_line_range_desc(const char *cmd, struct line_range *lr);
117 118


119 120
extern int add_perf_probe_events(struct perf_probe_event *pevs, int npevs,
				 bool force_add, int max_probe_points);
121 122 123
extern int del_perf_probe_events(struct strlist *dellist);
extern int show_perf_probe_events(void);
extern int show_line_range(struct line_range *lr);
124 125
extern int show_available_vars(struct perf_probe_event *pevs, int npevs,
			       int max_probe_points);
126

127

128 129 130
/* Maximum index number of event-name postfix */
#define MAX_EVENT_INDEX	1024

131
#endif /*_PROBE_EVENT_H */