diff options
Diffstat (limited to 'tools/perf/util/probe-finder.h')
-rw-r--r-- | tools/perf/util/probe-finder.h | 67 |
1 files changed, 20 insertions, 47 deletions
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h index 21f7354397b4..66f1980e3855 100644 --- a/tools/perf/util/probe-finder.h +++ b/tools/perf/util/probe-finder.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <stdbool.h> | 4 | #include <stdbool.h> |
5 | #include "util.h" | 5 | #include "util.h" |
6 | #include "probe-event.h" | ||
6 | 7 | ||
7 | #define MAX_PATH_LEN 256 | 8 | #define MAX_PATH_LEN 256 |
8 | #define MAX_PROBE_BUFFER 1024 | 9 | #define MAX_PROBE_BUFFER 1024 |
@@ -14,67 +15,39 @@ static inline int is_c_varname(const char *name) | |||
14 | return isalpha(name[0]) || name[0] == '_'; | 15 | return isalpha(name[0]) || name[0] == '_'; |
15 | } | 16 | } |
16 | 17 | ||
17 | struct probe_point { | 18 | #ifdef DWARF_SUPPORT |
18 | char *event; /* Event name */ | 19 | /* Find kprobe_trace_events specified by perf_probe_event from debuginfo */ |
19 | char *group; /* Event group */ | 20 | extern int find_kprobe_trace_events(int fd, struct perf_probe_event *pev, |
21 | struct kprobe_trace_event **tevs, | ||
22 | int max_tevs); | ||
20 | 23 | ||
21 | /* Inputs */ | 24 | /* Find a perf_probe_point from debuginfo */ |
22 | char *file; /* File name */ | 25 | extern int find_perf_probe_point(int fd, unsigned long addr, |
23 | int line; /* Line number */ | 26 | struct perf_probe_point *ppt); |
24 | char *lazy_line; /* Lazy line pattern */ | ||
25 | 27 | ||
26 | char *function; /* Function name */ | ||
27 | int offset; /* Offset bytes */ | ||
28 | |||
29 | int nr_args; /* Number of arguments */ | ||
30 | char **args; /* Arguments */ | ||
31 | |||
32 | int retprobe; /* Return probe */ | ||
33 | |||
34 | /* Output */ | ||
35 | int found; /* Number of found probe points */ | ||
36 | char *probes[MAX_PROBES]; /* Output buffers (will be allocated)*/ | ||
37 | }; | ||
38 | |||
39 | /* Line number container */ | ||
40 | struct line_node { | ||
41 | struct list_head list; | ||
42 | unsigned int line; | ||
43 | }; | ||
44 | |||
45 | /* Line range */ | ||
46 | struct line_range { | ||
47 | char *file; /* File name */ | ||
48 | char *function; /* Function name */ | ||
49 | unsigned int start; /* Start line number */ | ||
50 | unsigned int end; /* End line number */ | ||
51 | int offset; /* Start line offset */ | ||
52 | char *path; /* Real path name */ | ||
53 | struct list_head line_list; /* Visible lines */ | ||
54 | }; | ||
55 | |||
56 | #ifndef NO_DWARF_SUPPORT | ||
57 | extern int find_probe_point(int fd, struct probe_point *pp); | ||
58 | extern int find_line_range(int fd, struct line_range *lr); | 28 | extern int find_line_range(int fd, struct line_range *lr); |
59 | 29 | ||
60 | #include <dwarf.h> | 30 | #include <dwarf.h> |
61 | #include <libdw.h> | 31 | #include <libdw.h> |
62 | 32 | ||
63 | struct probe_finder { | 33 | struct probe_finder { |
64 | struct probe_point *pp; /* Target probe point */ | 34 | struct perf_probe_event *pev; /* Target probe event */ |
35 | struct kprobe_trace_event *tevs; /* Result trace events */ | ||
36 | int ntevs; /* Number of trace events */ | ||
37 | int max_tevs; /* Max number of trace events */ | ||
65 | 38 | ||
66 | /* For function searching */ | 39 | /* For function searching */ |
67 | Dwarf_Addr addr; /* Address */ | ||
68 | const char *fname; /* File name */ | ||
69 | int lno; /* Line number */ | 40 | int lno; /* Line number */ |
41 | Dwarf_Addr addr; /* Address */ | ||
42 | const char *fname; /* Real file name */ | ||
70 | Dwarf_Die cu_die; /* Current CU */ | 43 | Dwarf_Die cu_die; /* Current CU */ |
44 | struct list_head lcache; /* Line cache for lazy match */ | ||
71 | 45 | ||
72 | /* For variable searching */ | 46 | /* For variable searching */ |
47 | Dwarf_CFI *cfi; /* Call Frame Information */ | ||
73 | Dwarf_Op *fb_ops; /* Frame base attribute */ | 48 | Dwarf_Op *fb_ops; /* Frame base attribute */ |
74 | const char *var; /* Current variable name */ | 49 | struct perf_probe_arg *pvar; /* Current target variable */ |
75 | char *buf; /* Current output buffer */ | 50 | struct kprobe_trace_arg *tvar; /* Current result variable */ |
76 | int len; /* Length of output buffer */ | ||
77 | struct list_head lcache; /* Line cache for lazy match */ | ||
78 | }; | 51 | }; |
79 | 52 | ||
80 | struct line_finder { | 53 | struct line_finder { |
@@ -87,6 +60,6 @@ struct line_finder { | |||
87 | int found; | 60 | int found; |
88 | }; | 61 | }; |
89 | 62 | ||
90 | #endif /* NO_DWARF_SUPPORT */ | 63 | #endif /* DWARF_SUPPORT */ |
91 | 64 | ||
92 | #endif /*_PROBE_FINDER_H */ | 65 | #endif /*_PROBE_FINDER_H */ |