]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - tools/perf/util/probe-finder.h
Merge tag 'stable/for-linus-3.14-rc5-tag' of git://git.kernel.org/pub/scm/linux/kerne...
[mirror_ubuntu-artful-kernel.git] / tools / perf / util / probe-finder.h
CommitLineData
4ea42b18
MH
1#ifndef _PROBE_FINDER_H
2#define _PROBE_FINDER_H
3
804b3606 4#include <stdbool.h>
4a58e611 5#include "util.h"
4235b045 6#include "probe-event.h"
4a58e611 7
27f3b24d
MH
8#define MAX_PROBE_BUFFER 1024
9#define MAX_PROBES 128
7969ec77 10#define MAX_PROBE_ARGS 128
4ea42b18
MH
11
12static inline int is_c_varname(const char *name)
13{
14 /* TODO */
15 return isalpha(name[0]) || name[0] == '_';
16}
17
89fe808a 18#ifdef HAVE_DWARF_SUPPORT
ff741783
MH
19
20#include "dwarf-aux.h"
21
22/* TODO: export debuginfo data structure even if no dwarf support */
23
24/* debug information structure */
25struct debuginfo {
26 Dwarf *dbg;
576b5237 27 Dwfl_Module *mod;
ff741783
MH
28 Dwfl *dwfl;
29 Dwarf_Addr bias;
30};
31
32extern struct debuginfo *debuginfo__new(const char *path);
33extern struct debuginfo *debuginfo__new_online_kernel(unsigned long addr);
316c7136 34extern void debuginfo__delete(struct debuginfo *dbg);
ff741783 35
0e60836b 36/* Find probe_trace_events specified by perf_probe_event from debuginfo */
316c7136 37extern int debuginfo__find_trace_events(struct debuginfo *dbg,
ff741783
MH
38 struct perf_probe_event *pev,
39 struct probe_trace_event **tevs,
40 int max_tevs);
4235b045 41
fb1587d8 42/* Find a perf_probe_point from debuginfo */
316c7136 43extern int debuginfo__find_probe_point(struct debuginfo *dbg,
ff741783
MH
44 unsigned long addr,
45 struct perf_probe_point *ppt);
fb1587d8 46
cf6eb489 47/* Find a line range */
316c7136 48extern int debuginfo__find_line_range(struct debuginfo *dbg,
ff741783 49 struct line_range *lr);
4ea42b18 50
cf6eb489 51/* Find available variables */
316c7136 52extern int debuginfo__find_available_vars_at(struct debuginfo *dbg,
ff741783
MH
53 struct perf_probe_event *pev,
54 struct variable_list **vls,
55 int max_points, bool externs);
4ea42b18
MH
56
57struct probe_finder {
4235b045 58 struct perf_probe_event *pev; /* Target probe event */
cf6eb489
MH
59
60 /* Callback when a probe point is found */
221d0611 61 int (*callback)(Dwarf_Die *sc_die, struct probe_finder *pf);
4ea42b18
MH
62
63 /* For function searching */
eed05fe7 64 int lno; /* Line number */
804b3606 65 Dwarf_Addr addr; /* Address */
4235b045 66 const char *fname; /* Real file name */
804b3606 67 Dwarf_Die cu_die; /* Current CU */
cd25f8bc 68 Dwarf_Die sp_die;
4235b045 69 struct list_head lcache; /* Line cache for lazy match */
4ea42b18
MH
70
71 /* For variable searching */
7752f1b0 72#if _ELFUTILS_PREREQ(0, 142)
a34a9854 73 Dwarf_CFI *cfi; /* Call Frame Information */
7752f1b0 74#endif
804b3606 75 Dwarf_Op *fb_ops; /* Frame base attribute */
4235b045 76 struct perf_probe_arg *pvar; /* Current target variable */
0e60836b 77 struct probe_trace_arg *tvar; /* Current result variable */
4ea42b18 78};
631c9def 79
cf6eb489
MH
80struct trace_event_finder {
81 struct probe_finder pf;
576b5237 82 Dwfl_Module *mod; /* For solving symbols */
cf6eb489
MH
83 struct probe_trace_event *tevs; /* Found trace events */
84 int ntevs; /* Number of trace events */
85 int max_tevs; /* Max number of trace events */
86};
87
88struct available_var_finder {
89 struct probe_finder pf;
576b5237 90 Dwfl_Module *mod; /* For solving symbols */
cf6eb489
MH
91 struct variable_list *vls; /* Found variable lists */
92 int nvls; /* Number of variable lists */
93 int max_vls; /* Max no. of variable lists */
fb8c5a56
MH
94 bool externs; /* Find external vars too */
95 bool child; /* Search child scopes */
cf6eb489
MH
96};
97
631c9def 98struct line_finder {
804b3606
MH
99 struct line_range *lr; /* Target line range */
100
101 const char *fname; /* File name */
102 int lno_s; /* Start line number */
103 int lno_e; /* End line number */
804b3606 104 Dwarf_Die cu_die; /* Current CU */
cd25f8bc 105 Dwarf_Die sp_die;
631c9def
MH
106 int found;
107};
108
89fe808a 109#endif /* HAVE_DWARF_SUPPORT */
4ea42b18
MH
110
111#endif /*_PROBE_FINDER_H */