Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1#ifndef _PROBE_EVENT_H
2#define _PROBE_EVENT_H
3
4#include <stdbool.h>
5#include "strlist.h"
6#include "strfilter.h"
7
8extern bool probe_event_dry_run;
9
10/* kprobe-tracer and uprobe-tracer tracing point */
11struct 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 bool retprobe; /* Return probe flag */
17};
18
19/* probe-tracer tracing argument referencing offset */
20struct probe_trace_arg_ref {
21 struct probe_trace_arg_ref *next; /* Next reference */
22 long offset; /* Offset value */
23};
24
25/* kprobe-tracer and uprobe-tracer tracing argument */
26struct probe_trace_arg {
27 char *name; /* Argument name */
28 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) */
34struct probe_trace_event {
35 char *event; /* Event name */
36 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/* Perf probe probing point */
44struct perf_probe_point {
45 char *file; /* File path */
46 char *function; /* Function name */
47 int line; /* Line number */
48 bool retprobe; /* Return probe flag */
49 char *lazy_line; /* Lazy matching pattern */
50 unsigned long offset; /* Offset from function entry */
51};
52
53/* Perf probe probing argument field chain */
54struct perf_probe_arg_field {
55 struct perf_probe_arg_field *next; /* Next field */
56 char *name; /* Name of the field */
57 long index; /* Array index number */
58 bool ref; /* Referencing flag */
59};
60
61/* Perf probe probing argument */
62struct 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/* Perf probe probing event (point + arg) */
70struct perf_probe_event {
71 char *event; /* Event name */
72 char *group; /* Group name */
73 struct perf_probe_point point; /* Probe point */
74 int nargs; /* Number of arguments */
75 bool uprobes;
76 struct perf_probe_arg *args; /* Arguments */
77};
78
79
80/* Line number container */
81struct line_node {
82 struct list_head list;
83 int line;
84};
85
86/* Line range */
87struct line_range {
88 char *file; /* File name */
89 char *function; /* Function name */
90 int start; /* Start line number */
91 int end; /* End line number */
92 int offset; /* Start line offset */
93 char *path; /* Real path name */
94 char *comp_dir; /* Compile directory */
95 struct list_head line_list; /* Visible lines */
96};
97
98/* List of variables */
99struct variable_list {
100 struct probe_trace_point point; /* Actual probepoint */
101 struct strlist *vars; /* Available variables */
102};
103
104/* Command string to events */
105extern int parse_perf_probe_command(const char *cmd,
106 struct perf_probe_event *pev);
107
108/* Events to command string */
109extern char *synthesize_perf_probe_command(struct perf_probe_event *pev);
110extern char *synthesize_probe_trace_command(struct probe_trace_event *tev);
111extern int synthesize_perf_probe_arg(struct perf_probe_arg *pa, char *buf,
112 size_t len);
113
114/* Check the perf_probe_event needs debuginfo */
115extern bool perf_probe_event_need_dwarf(struct perf_probe_event *pev);
116
117/* Release event contents */
118extern void clear_perf_probe_event(struct perf_probe_event *pev);
119
120/* Command string to line-range */
121extern int parse_line_range_desc(const char *cmd, struct line_range *lr);
122
123/* Release line range members */
124extern void line_range__clear(struct line_range *lr);
125
126/* Initialize line range */
127extern void line_range__init(struct line_range *lr);
128
129/* Internal use: Return kernel/module path */
130extern const char *kernel_get_module_path(const char *module);
131
132extern int add_perf_probe_events(struct perf_probe_event *pevs, int npevs,
133 int max_probe_points, const char *module,
134 bool force_add);
135extern int del_perf_probe_events(struct strlist *dellist);
136extern int show_perf_probe_events(void);
137extern int show_line_range(struct line_range *lr, const char *module);
138extern int show_available_vars(struct perf_probe_event *pevs, int npevs,
139 int max_probe_points, const char *module,
140 struct strfilter *filter, bool externs);
141extern int show_available_funcs(const char *module, struct strfilter *filter,
142 bool user);
143
144/* Maximum index number of event-name postfix */
145#define MAX_EVENT_INDEX 1024
146
147#endif /*_PROBE_EVENT_H */