1#ifndef _PROBE_FINDER_H
2#define _PROBE_FINDER_H
3
4#include <stdbool.h>
5#include "util.h"
6#include "probe-event.h"
7
8#define MAX_PATH_LEN 256
9#define MAX_PROBE_BUFFER 1024
10#define MAX_PROBES 128
11
12static inline int is_c_varname(const char *name)
13{
14
15 return isalpha(name[0]) || name[0] == '_';
16}
17
18#ifdef DWARF_SUPPORT
19
20extern int find_probe_trace_events(int fd, struct perf_probe_event *pev,
21 struct probe_trace_event **tevs,
22 int max_tevs);
23
24
25extern int find_perf_probe_point(unsigned long addr,
26 struct perf_probe_point *ppt);
27
28
29extern int find_line_range(int fd, struct line_range *lr);
30
31
32extern int find_available_vars_at(int fd, struct perf_probe_event *pev,
33 struct variable_list **vls, int max_points,
34 bool externs);
35
36#include <dwarf.h>
37#include <elfutils/libdw.h>
38#include <elfutils/libdwfl.h>
39#include <elfutils/version.h>
40
41struct probe_finder {
42 struct perf_probe_event *pev;
43
44
45 int (*callback)(Dwarf_Die *sp_die, struct probe_finder *pf);
46
47
48 int lno;
49 Dwarf_Addr addr;
50 const char *fname;
51 Dwarf_Die cu_die;
52 Dwarf_Die sp_die;
53 struct list_head lcache;
54
55
56#if _ELFUTILS_PREREQ(0, 142)
57 Dwarf_CFI *cfi;
58#endif
59 Dwarf_Op *fb_ops;
60 struct perf_probe_arg *pvar;
61 struct probe_trace_arg *tvar;
62};
63
64struct trace_event_finder {
65 struct probe_finder pf;
66 struct probe_trace_event *tevs;
67 int ntevs;
68 int max_tevs;
69};
70
71struct available_var_finder {
72 struct probe_finder pf;
73 struct variable_list *vls;
74 int nvls;
75 int max_vls;
76 bool externs;
77 bool child;
78};
79
80struct line_finder {
81 struct line_range *lr;
82
83 const char *fname;
84 int lno_s;
85 int lno_e;
86 Dwarf_Die cu_die;
87 Dwarf_Die sp_die;
88 int found;
89};
90
91#endif
92
93#endif
94