kvm tools: Add ivshmem device
[linux-2.6/next.git] / tools / perf / util / probe-finder.h
blob605730a366dbc5dc0158ffc32db254420c5045bb
1 #ifndef _PROBE_FINDER_H
2 #define _PROBE_FINDER_H
4 #include <stdbool.h>
5 #include "util.h"
6 #include "probe-event.h"
8 #define MAX_PATH_LEN 256
9 #define MAX_PROBE_BUFFER 1024
10 #define MAX_PROBES 128
12 static inline int is_c_varname(const char *name)
14 /* TODO */
15 return isalpha(name[0]) || name[0] == '_';
18 #ifdef DWARF_SUPPORT
19 /* Find probe_trace_events specified by perf_probe_event from debuginfo */
20 extern int find_probe_trace_events(int fd, struct perf_probe_event *pev,
21 struct probe_trace_event **tevs,
22 int max_tevs);
24 /* Find a perf_probe_point from debuginfo */
25 extern int find_perf_probe_point(unsigned long addr,
26 struct perf_probe_point *ppt);
28 /* Find a line range */
29 extern int find_line_range(int fd, struct line_range *lr);
31 /* Find available variables */
32 extern int find_available_vars_at(int fd, struct perf_probe_event *pev,
33 struct variable_list **vls, int max_points,
34 bool externs);
36 #include <dwarf.h>
37 #include <elfutils/libdw.h>
38 #include <elfutils/libdwfl.h>
39 #include <elfutils/version.h>
41 struct probe_finder {
42 struct perf_probe_event *pev; /* Target probe event */
44 /* Callback when a probe point is found */
45 int (*callback)(Dwarf_Die *sp_die, struct probe_finder *pf);
47 /* For function searching */
48 int lno; /* Line number */
49 Dwarf_Addr addr; /* Address */
50 const char *fname; /* Real file name */
51 Dwarf_Die cu_die; /* Current CU */
52 Dwarf_Die sp_die;
53 struct list_head lcache; /* Line cache for lazy match */
55 /* For variable searching */
56 #if _ELFUTILS_PREREQ(0, 142)
57 Dwarf_CFI *cfi; /* Call Frame Information */
58 #endif
59 Dwarf_Op *fb_ops; /* Frame base attribute */
60 struct perf_probe_arg *pvar; /* Current target variable */
61 struct probe_trace_arg *tvar; /* Current result variable */
64 struct trace_event_finder {
65 struct probe_finder pf;
66 struct probe_trace_event *tevs; /* Found trace events */
67 int ntevs; /* Number of trace events */
68 int max_tevs; /* Max number of trace events */
71 struct available_var_finder {
72 struct probe_finder pf;
73 struct variable_list *vls; /* Found variable lists */
74 int nvls; /* Number of variable lists */
75 int max_vls; /* Max no. of variable lists */
76 bool externs; /* Find external vars too */
77 bool child; /* Search child scopes */
80 struct line_finder {
81 struct line_range *lr; /* Target line range */
83 const char *fname; /* File name */
84 int lno_s; /* Start line number */
85 int lno_e; /* End line number */
86 Dwarf_Die cu_die; /* Current CU */
87 Dwarf_Die sp_die;
88 int found;
91 #endif /* DWARF_SUPPORT */
93 #endif /*_PROBE_FINDER_H */