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