1
2#ifndef _PROBE_FINDER_H
3#define _PROBE_FINDER_H
4
5#include <stdbool.h>
6#include "intlist.h"
7#include "build-id.h"
8#include "probe-event.h"
9#include <linux/ctype.h>
10
11#define MAX_PROBE_BUFFER 1024
12#define MAX_PROBES 128
13#define MAX_PROBE_ARGS 128
14
15#define PROBE_ARG_VARS "$vars"
16#define PROBE_ARG_PARAMS "$params"
17
18static inline int is_c_varname(const char *name)
19{
20
21 return isalpha(name[0]) || name[0] == '_';
22}
23
24#ifdef HAVE_DWARF_SUPPORT
25
26#include "dwarf-aux.h"
27
28
29
30
31struct debuginfo {
32 Dwarf *dbg;
33 Dwfl_Module *mod;
34 Dwfl *dwfl;
35 Dwarf_Addr bias;
36 const unsigned char *build_id;
37};
38
39
40struct debuginfo *debuginfo__new(const char *path);
41void debuginfo__delete(struct debuginfo *dbg);
42
43
44int debuginfo__find_trace_events(struct debuginfo *dbg,
45 struct perf_probe_event *pev,
46 struct probe_trace_event **tevs);
47
48
49int debuginfo__find_probe_point(struct debuginfo *dbg, u64 addr,
50 struct perf_probe_point *ppt);
51
52int debuginfo__get_text_offset(struct debuginfo *dbg, Dwarf_Addr *offs,
53 bool adjust_offset);
54
55
56int debuginfo__find_line_range(struct debuginfo *dbg, struct line_range *lr);
57
58
59int debuginfo__find_available_vars_at(struct debuginfo *dbg,
60 struct perf_probe_event *pev,
61 struct variable_list **vls);
62
63
64int find_source_path(const char *raw_path, const char *sbuild_id,
65 const char *comp_dir, char **new_path);
66
67struct probe_finder {
68 struct perf_probe_event *pev;
69 struct debuginfo *dbg;
70
71
72 int (*callback)(Dwarf_Die *sc_die, struct probe_finder *pf);
73
74
75 int lno;
76 Dwarf_Addr addr;
77 const char *fname;
78 Dwarf_Die cu_die;
79 Dwarf_Die sp_die;
80 struct intlist *lcache;
81
82
83#if _ELFUTILS_PREREQ(0, 142)
84
85 Dwarf_CFI *cfi_eh;
86
87 Dwarf_CFI *cfi_dbg;
88#endif
89 Dwarf_Op *fb_ops;
90 unsigned int machine;
91 struct perf_probe_arg *pvar;
92 struct probe_trace_arg *tvar;
93 bool skip_empty_arg;
94};
95
96struct trace_event_finder {
97 struct probe_finder pf;
98 Dwfl_Module *mod;
99 struct probe_trace_event *tevs;
100 int ntevs;
101 int max_tevs;
102};
103
104struct available_var_finder {
105 struct probe_finder pf;
106 Dwfl_Module *mod;
107 struct variable_list *vls;
108 int nvls;
109 int max_vls;
110 bool child;
111};
112
113struct line_finder {
114 struct line_range *lr;
115
116 const char *fname;
117 int lno_s;
118 int lno_e;
119 Dwarf_Die cu_die;
120 Dwarf_Die sp_die;
121 int found;
122};
123
124#endif
125
126#endif
127