diff options
Diffstat (limited to 'tools/perf/util/probe-finder.h')
-rw-r--r-- | tools/perf/util/probe-finder.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h new file mode 100644 index 000000000000..bdebca6697d2 --- /dev/null +++ b/tools/perf/util/probe-finder.h | |||
@@ -0,0 +1,57 @@ | |||
1 | #ifndef _PROBE_FINDER_H | ||
2 | #define _PROBE_FINDER_H | ||
3 | |||
4 | #define MAX_PATH_LEN 256 | ||
5 | #define MAX_PROBE_BUFFER 1024 | ||
6 | #define MAX_PROBES 128 | ||
7 | |||
8 | static inline int is_c_varname(const char *name) | ||
9 | { | ||
10 | /* TODO */ | ||
11 | return isalpha(name[0]) || name[0] == '_'; | ||
12 | } | ||
13 | |||
14 | struct probe_point { | ||
15 | /* Inputs */ | ||
16 | char *file; /* File name */ | ||
17 | int line; /* Line number */ | ||
18 | |||
19 | char *function; /* Function name */ | ||
20 | int offset; /* Offset bytes */ | ||
21 | |||
22 | int nr_args; /* Number of arguments */ | ||
23 | char **args; /* Arguments */ | ||
24 | |||
25 | int retprobe; /* Return probe */ | ||
26 | |||
27 | /* Output */ | ||
28 | int found; /* Number of found probe points */ | ||
29 | char *probes[MAX_PROBES]; /* Output buffers (will be allocated)*/ | ||
30 | }; | ||
31 | |||
32 | #ifndef NO_LIBDWARF | ||
33 | extern int find_probepoint(int fd, struct probe_point *pp); | ||
34 | |||
35 | #include <libdwarf/dwarf.h> | ||
36 | #include <libdwarf/libdwarf.h> | ||
37 | |||
38 | struct probe_finder { | ||
39 | struct probe_point *pp; /* Target probe point */ | ||
40 | |||
41 | /* For function searching */ | ||
42 | Dwarf_Addr addr; /* Address */ | ||
43 | Dwarf_Unsigned fno; /* File number */ | ||
44 | Dwarf_Unsigned lno; /* Line number */ | ||
45 | Dwarf_Off inl_offs; /* Inline offset */ | ||
46 | Dwarf_Die cu_die; /* Current CU */ | ||
47 | |||
48 | /* For variable searching */ | ||
49 | Dwarf_Addr cu_base; /* Current CU base address */ | ||
50 | Dwarf_Locdesc fbloc; /* Location of Current Frame Base */ | ||
51 | const char *var; /* Current variable name */ | ||
52 | char *buf; /* Current output buffer */ | ||
53 | int len; /* Length of output buffer */ | ||
54 | }; | ||
55 | #endif /* NO_LIBDWARF */ | ||
56 | |||
57 | #endif /*_PROBE_FINDER_H */ | ||