2009-10-08 14:17:38 -07:00
|
|
|
#ifndef _PROBE_FINDER_H
|
|
|
|
#define _PROBE_FINDER_H
|
|
|
|
|
|
|
|
#define MAX_PATH_LEN 256
|
|
|
|
#define MAX_PROBE_BUFFER 1024
|
|
|
|
#define MAX_PROBES 128
|
|
|
|
|
|
|
|
static inline int is_c_varname(const char *name)
|
|
|
|
{
|
|
|
|
/* TODO */
|
|
|
|
return isalpha(name[0]) || name[0] == '_';
|
|
|
|
}
|
|
|
|
|
|
|
|
struct probe_point {
|
|
|
|
/* Inputs */
|
|
|
|
char *file; /* File name */
|
|
|
|
int line; /* Line number */
|
|
|
|
|
|
|
|
char *function; /* Function name */
|
|
|
|
int offset; /* Offset bytes */
|
|
|
|
|
|
|
|
int nr_args; /* Number of arguments */
|
|
|
|
char **args; /* Arguments */
|
|
|
|
|
2009-10-27 13:43:10 -07:00
|
|
|
int retprobe; /* Return probe */
|
|
|
|
|
2009-10-08 14:17:38 -07:00
|
|
|
/* Output */
|
|
|
|
int found; /* Number of found probe points */
|
|
|
|
char *probes[MAX_PROBES]; /* Output buffers (will be allocated)*/
|
|
|
|
};
|
|
|
|
|
2009-10-07 15:28:30 -07:00
|
|
|
#ifndef NO_LIBDWARF
|
2009-10-08 14:17:38 -07:00
|
|
|
extern int find_probepoint(int fd, struct probe_point *pp);
|
|
|
|
|
|
|
|
#include <libdwarf/dwarf.h>
|
|
|
|
#include <libdwarf/libdwarf.h>
|
|
|
|
|
|
|
|
struct probe_finder {
|
|
|
|
struct probe_point *pp; /* Target probe point */
|
|
|
|
|
|
|
|
/* For function searching */
|
|
|
|
Dwarf_Addr addr; /* Address */
|
|
|
|
Dwarf_Unsigned fno; /* File number */
|
|
|
|
Dwarf_Off inl_offs; /* Inline offset */
|
|
|
|
|
|
|
|
/* For variable searching */
|
|
|
|
Dwarf_Addr cu_base; /* Current CU base address */
|
|
|
|
Dwarf_Locdesc fbloc; /* Location of Current Frame Base */
|
|
|
|
const char *var; /* Current variable name */
|
|
|
|
char *buf; /* Current output buffer */
|
|
|
|
int len; /* Length of output buffer */
|
|
|
|
};
|
2009-10-07 15:28:30 -07:00
|
|
|
#endif /* NO_LIBDWARF */
|
2009-10-08 14:17:38 -07:00
|
|
|
|
|
|
|
#endif /*_PROBE_FINDER_H */
|