1 #ifndef _PROBE_FINDER_H
2 #define _PROBE_FINDER_H
7 #include "probe-event.h"
9 #define MAX_PROBE_BUFFER 1024
10 #define MAX_PROBES 128
11 #define MAX_PROBE_ARGS 128
13 static inline int is_c_varname(const char *name
)
16 return isalpha(name
[0]) || name
[0] == '_';
19 #ifdef HAVE_DWARF_SUPPORT
21 #include "dwarf-aux.h"
23 /* TODO: export debuginfo data structure even if no dwarf support */
25 /* debug information structure */
33 /* This also tries to open distro debuginfo */
34 extern struct debuginfo
*debuginfo__new(const char *path
);
35 extern void debuginfo__delete(struct debuginfo
*dbg
);
37 /* Find probe_trace_events specified by perf_probe_event from debuginfo */
38 extern int debuginfo__find_trace_events(struct debuginfo
*dbg
,
39 struct perf_probe_event
*pev
,
40 struct probe_trace_event
**tevs
,
43 /* Find a perf_probe_point from debuginfo */
44 extern int debuginfo__find_probe_point(struct debuginfo
*dbg
,
46 struct perf_probe_point
*ppt
);
48 /* Find a line range */
49 extern int debuginfo__find_line_range(struct debuginfo
*dbg
,
50 struct line_range
*lr
);
52 /* Find available variables */
53 extern int debuginfo__find_available_vars_at(struct debuginfo
*dbg
,
54 struct perf_probe_event
*pev
,
55 struct variable_list
**vls
,
56 int max_points
, bool externs
);
58 /* Find a src file from a DWARF tag path */
59 int get_real_path(const char *raw_path
, const char *comp_dir
,
63 struct perf_probe_event
*pev
; /* Target probe event */
65 /* Callback when a probe point is found */
66 int (*callback
)(Dwarf_Die
*sc_die
, struct probe_finder
*pf
);
68 /* For function searching */
69 int lno
; /* Line number */
70 Dwarf_Addr addr
; /* Address */
71 const char *fname
; /* Real file name */
72 Dwarf_Die cu_die
; /* Current CU */
74 struct intlist
*lcache
; /* Line cache for lazy match */
76 /* For variable searching */
77 #if _ELFUTILS_PREREQ(0, 142)
78 Dwarf_CFI
*cfi
; /* Call Frame Information */
80 Dwarf_Op
*fb_ops
; /* Frame base attribute */
81 struct perf_probe_arg
*pvar
; /* Current target variable */
82 struct probe_trace_arg
*tvar
; /* Current result variable */
85 struct trace_event_finder
{
86 struct probe_finder pf
;
87 Dwfl_Module
*mod
; /* For solving symbols */
88 struct probe_trace_event
*tevs
; /* Found trace events */
89 int ntevs
; /* Number of trace events */
90 int max_tevs
; /* Max number of trace events */
93 struct available_var_finder
{
94 struct probe_finder pf
;
95 Dwfl_Module
*mod
; /* For solving symbols */
96 struct variable_list
*vls
; /* Found variable lists */
97 int nvls
; /* Number of variable lists */
98 int max_vls
; /* Max no. of variable lists */
99 bool externs
; /* Find external vars too */
100 bool child
; /* Search child scopes */
104 struct line_range
*lr
; /* Target line range */
106 const char *fname
; /* File name */
107 int lno_s
; /* Start line number */
108 int lno_e
; /* End line number */
109 Dwarf_Die cu_die
; /* Current CU */
114 #endif /* HAVE_DWARF_SUPPORT */
116 #endif /*_PROBE_FINDER_H */