Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 1 | #ifndef _PROBE_FINDER_H |
| 2 | #define _PROBE_FINDER_H |
| 3 | |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 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 { |
Masami Hiramatsu | af663d7 | 2009-12-15 10:32:18 -0500 | [diff] [blame^] | 15 | char *event; /* Event name */ |
| 16 | char *group; /* Event group */ |
| 17 | |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 18 | /* Inputs */ |
| 19 | char *file; /* File name */ |
| 20 | int line; /* Line number */ |
| 21 | |
| 22 | char *function; /* Function name */ |
| 23 | int offset; /* Offset bytes */ |
| 24 | |
| 25 | int nr_args; /* Number of arguments */ |
| 26 | char **args; /* Arguments */ |
| 27 | |
Masami Hiramatsu | 253977b | 2009-10-27 16:43:10 -0400 | [diff] [blame] | 28 | int retprobe; /* Return probe */ |
| 29 | |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 30 | /* Output */ |
| 31 | int found; /* Number of found probe points */ |
| 32 | char *probes[MAX_PROBES]; /* Output buffers (will be allocated)*/ |
| 33 | }; |
| 34 | |
Masami Hiramatsu | 23e8ec0 | 2009-10-07 18:28:30 -0400 | [diff] [blame] | 35 | #ifndef NO_LIBDWARF |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 36 | extern int find_probepoint(int fd, struct probe_point *pp); |
| 37 | |
| 38 | #include <libdwarf/dwarf.h> |
| 39 | #include <libdwarf/libdwarf.h> |
| 40 | |
| 41 | struct probe_finder { |
| 42 | struct probe_point *pp; /* Target probe point */ |
| 43 | |
| 44 | /* For function searching */ |
| 45 | Dwarf_Addr addr; /* Address */ |
| 46 | Dwarf_Unsigned fno; /* File number */ |
Masami Hiramatsu | b0ef073 | 2009-10-27 16:43:19 -0400 | [diff] [blame] | 47 | Dwarf_Unsigned lno; /* Line number */ |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 48 | Dwarf_Off inl_offs; /* Inline offset */ |
Masami Hiramatsu | b0ef073 | 2009-10-27 16:43:19 -0400 | [diff] [blame] | 49 | Dwarf_Die cu_die; /* Current CU */ |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 50 | |
| 51 | /* For variable searching */ |
| 52 | Dwarf_Addr cu_base; /* Current CU base address */ |
| 53 | Dwarf_Locdesc fbloc; /* Location of Current Frame Base */ |
| 54 | const char *var; /* Current variable name */ |
| 55 | char *buf; /* Current output buffer */ |
| 56 | int len; /* Length of output buffer */ |
| 57 | }; |
Masami Hiramatsu | 23e8ec0 | 2009-10-07 18:28:30 -0400 | [diff] [blame] | 58 | #endif /* NO_LIBDWARF */ |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 59 | |
| 60 | #endif /*_PROBE_FINDER_H */ |