6pack,mkiss: fix lock inconsistency
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / tools / perf / util / probe-finder.h
blobbeaefc3c1223df16423cbd084f700b6ee5a5fbf2
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 struct list_head lcache; /* Line cache for lazy match */
54 /* For variable searching */
55 #if _ELFUTILS_PREREQ(0, 142)
56 Dwarf_CFI *cfi; /* Call Frame Information */
57 #endif
58 Dwarf_Op *fb_ops; /* Frame base attribute */
59 struct perf_probe_arg *pvar; /* Current target variable */
60 struct probe_trace_arg *tvar; /* Current result variable */
63 struct trace_event_finder {
64 struct probe_finder pf;
65 struct probe_trace_event *tevs; /* Found trace events */
66 int ntevs; /* Number of trace events */
67 int max_tevs; /* Max number of trace events */
70 struct available_var_finder {
71 struct probe_finder pf;
72 struct variable_list *vls; /* Found variable lists */
73 int nvls; /* Number of variable lists */
74 int max_vls; /* Max no. of variable lists */
75 bool externs; /* Find external vars too */
76 bool child; /* Search child scopes */
79 struct line_finder {
80 struct line_range *lr; /* Target line range */
82 const char *fname; /* File name */
83 int lno_s; /* Start line number */
84 int lno_e; /* End line number */
85 Dwarf_Die cu_die; /* Current CU */
86 int found;
89 #endif /* DWARF_SUPPORT */
91 #endif /*_PROBE_FINDER_H */