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 { |
| 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 Hiramatsu | 253977b | 2009-10-27 16:43:10 -0400 | [diff] [blame] | 25 | int retprobe; /* Return probe */ |
| 26 | |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 27 | /* Output */ |
| 28 | int found; /* Number of found probe points */ |
| 29 | char *probes[MAX_PROBES]; /* Output buffers (will be allocated)*/ |
| 30 | }; |
| 31 | |
Masami Hiramatsu | 23e8ec0 | 2009-10-07 18:28:30 -0400 | [diff] [blame] | 32 | #ifndef NO_LIBDWARF |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 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 */ |
Masami Hiramatsu | b0ef073 | 2009-10-27 16:43:19 -0400 | [diff] [blame] | 44 | Dwarf_Unsigned lno; /* Line number */ |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 45 | Dwarf_Off inl_offs; /* Inline offset */ |
Masami Hiramatsu | b0ef073 | 2009-10-27 16:43:19 -0400 | [diff] [blame] | 46 | Dwarf_Die cu_die; /* Current CU */ |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 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 | }; |
Masami Hiramatsu | 23e8ec0 | 2009-10-07 18:28:30 -0400 | [diff] [blame] | 55 | #endif /* NO_LIBDWARF */ |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 56 | |
| 57 | #endif /*_PROBE_FINDER_H */ |