blob: bdebca6697d24a637f583295779f3c2697f8b319 [file] [log] [blame]
Masami Hiramatsu4ea42b12009-10-08 17:17:38 -04001#ifndef _PROBE_FINDER_H
2#define _PROBE_FINDER_H
3
Masami Hiramatsu4ea42b12009-10-08 17:17:38 -04004#define MAX_PATH_LEN 256
5#define MAX_PROBE_BUFFER 1024
6#define MAX_PROBES 128
7
8static inline int is_c_varname(const char *name)
9{
10 /* TODO */
11 return isalpha(name[0]) || name[0] == '_';
12}
13
14struct 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
Masami Hiramatsu253977b2009-10-27 16:43:10 -040025 int retprobe; /* Return probe */
26
Masami Hiramatsu4ea42b12009-10-08 17:17:38 -040027 /* Output */
28 int found; /* Number of found probe points */
29 char *probes[MAX_PROBES]; /* Output buffers (will be allocated)*/
30};
31
Masami Hiramatsu23e8ec02009-10-07 18:28:30 -040032#ifndef NO_LIBDWARF
Masami Hiramatsu4ea42b12009-10-08 17:17:38 -040033extern int find_probepoint(int fd, struct probe_point *pp);
34
35#include <libdwarf/dwarf.h>
36#include <libdwarf/libdwarf.h>
37
38struct 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 */
Masami Hiramatsub0ef0732009-10-27 16:43:19 -040044 Dwarf_Unsigned lno; /* Line number */
Masami Hiramatsu4ea42b12009-10-08 17:17:38 -040045 Dwarf_Off inl_offs; /* Inline offset */
Masami Hiramatsub0ef0732009-10-27 16:43:19 -040046 Dwarf_Die cu_die; /* Current CU */
Masami Hiramatsu4ea42b12009-10-08 17:17:38 -040047
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};
Masami Hiramatsu23e8ec02009-10-07 18:28:30 -040055#endif /* NO_LIBDWARF */
Masami Hiramatsu4ea42b12009-10-08 17:17:38 -040056
57#endif /*_PROBE_FINDER_H */