Commit | Line | Data |
---|---|---|
4ea42b18 MH |
1 | #ifndef _PROBE_FINDER_H |
2 | #define _PROBE_FINDER_H | |
3 | ||
4a58e611 ACM |
4 | #include "util.h" |
5 | ||
27f3b24d MH |
6 | #define MAX_PATH_LEN 256 |
7 | #define MAX_PROBE_BUFFER 1024 | |
8 | #define MAX_PROBES 128 | |
4ea42b18 MH |
9 | |
10 | static inline int is_c_varname(const char *name) | |
11 | { | |
12 | /* TODO */ | |
13 | return isalpha(name[0]) || name[0] == '_'; | |
14 | } | |
15 | ||
16 | struct probe_point { | |
27f3b24d MH |
17 | char *event; /* Event name */ |
18 | char *group; /* Event group */ | |
af663d75 | 19 | |
4ea42b18 | 20 | /* Inputs */ |
27f3b24d MH |
21 | char *file; /* File name */ |
22 | int line; /* Line number */ | |
4ea42b18 | 23 | |
27f3b24d MH |
24 | char *function; /* Function name */ |
25 | int offset; /* Offset bytes */ | |
4ea42b18 | 26 | |
27f3b24d MH |
27 | int nr_args; /* Number of arguments */ |
28 | char **args; /* Arguments */ | |
4ea42b18 | 29 | |
27f3b24d | 30 | int retprobe; /* Return probe */ |
253977b0 | 31 | |
4ea42b18 | 32 | /* Output */ |
27f3b24d MH |
33 | int found; /* Number of found probe points */ |
34 | char *probes[MAX_PROBES]; /* Output buffers (will be allocated)*/ | |
4ea42b18 MH |
35 | }; |
36 | ||
23e8ec0d | 37 | #ifndef NO_LIBDWARF |
4ea42b18 MH |
38 | extern int find_probepoint(int fd, struct probe_point *pp); |
39 | ||
27f3b24d MH |
40 | /* Workaround for undefined _MIPS_SZLONG bug in libdwarf.h: */ |
41 | #ifndef _MIPS_SZLONG | |
42 | # define _MIPS_SZLONG 0 | |
43 | #endif | |
44 | ||
45 | #include <dwarf.h> | |
46 | #include <libdwarf.h> | |
4ea42b18 MH |
47 | |
48 | struct probe_finder { | |
27f3b24d | 49 | struct probe_point *pp; /* Target probe point */ |
4ea42b18 MH |
50 | |
51 | /* For function searching */ | |
27f3b24d MH |
52 | Dwarf_Addr addr; /* Address */ |
53 | Dwarf_Unsigned fno; /* File number */ | |
54 | Dwarf_Unsigned lno; /* Line number */ | |
55 | Dwarf_Off inl_offs; /* Inline offset */ | |
56 | Dwarf_Die cu_die; /* Current CU */ | |
4ea42b18 MH |
57 | |
58 | /* For variable searching */ | |
27f3b24d MH |
59 | Dwarf_Addr cu_base; /* Current CU base address */ |
60 | Dwarf_Locdesc fbloc; /* Location of Current Frame Base */ | |
61 | const char *var; /* Current variable name */ | |
62 | char *buf; /* Current output buffer */ | |
63 | int len; /* Length of output buffer */ | |
4ea42b18 | 64 | }; |
23e8ec0d | 65 | #endif /* NO_LIBDWARF */ |
4ea42b18 MH |
66 | |
67 | #endif /*_PROBE_FINDER_H */ |