2009-10-09 05:17:38 +08:00
|
|
|
#ifndef _PROBE_FINDER_H
|
|
|
|
#define _PROBE_FINDER_H
|
|
|
|
|
2009-12-17 06:16:19 +08:00
|
|
|
#define MAX_PATH_LEN 256
|
|
|
|
#define MAX_PROBE_BUFFER 1024
|
|
|
|
#define MAX_PROBES 128
|
2009-10-09 05:17:38 +08:00
|
|
|
|
|
|
|
static inline int is_c_varname(const char *name)
|
|
|
|
{
|
|
|
|
/* TODO */
|
|
|
|
return isalpha(name[0]) || name[0] == '_';
|
|
|
|
}
|
|
|
|
|
|
|
|
struct probe_point {
|
2009-12-17 06:16:19 +08:00
|
|
|
char *event; /* Event name */
|
|
|
|
char *group; /* Event group */
|
2009-12-15 23:32:18 +08:00
|
|
|
|
2009-10-09 05:17:38 +08:00
|
|
|
/* Inputs */
|
2009-12-17 06:16:19 +08:00
|
|
|
char *file; /* File name */
|
|
|
|
int line; /* Line number */
|
2009-10-09 05:17:38 +08:00
|
|
|
|
2009-12-17 06:16:19 +08:00
|
|
|
char *function; /* Function name */
|
|
|
|
int offset; /* Offset bytes */
|
2009-10-09 05:17:38 +08:00
|
|
|
|
2009-12-17 06:16:19 +08:00
|
|
|
int nr_args; /* Number of arguments */
|
|
|
|
char **args; /* Arguments */
|
2009-10-09 05:17:38 +08:00
|
|
|
|
2009-12-17 06:16:19 +08:00
|
|
|
int retprobe; /* Return probe */
|
2009-10-28 04:43:10 +08:00
|
|
|
|
2009-10-09 05:17:38 +08:00
|
|
|
/* Output */
|
2009-12-17 06:16:19 +08:00
|
|
|
int found; /* Number of found probe points */
|
|
|
|
char *probes[MAX_PROBES]; /* Output buffers (will be allocated)*/
|
2009-10-09 05:17:38 +08:00
|
|
|
};
|
|
|
|
|
2009-10-08 06:28:30 +08:00
|
|
|
#ifndef NO_LIBDWARF
|
2009-10-09 05:17:38 +08:00
|
|
|
extern int find_probepoint(int fd, struct probe_point *pp);
|
|
|
|
|
2009-12-17 06:16:19 +08:00
|
|
|
/* Workaround for undefined _MIPS_SZLONG bug in libdwarf.h: */
|
|
|
|
#ifndef _MIPS_SZLONG
|
|
|
|
# define _MIPS_SZLONG 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <dwarf.h>
|
|
|
|
#include <libdwarf.h>
|
2009-10-09 05:17:38 +08:00
|
|
|
|
|
|
|
struct probe_finder {
|
2009-12-17 06:16:19 +08:00
|
|
|
struct probe_point *pp; /* Target probe point */
|
2009-10-09 05:17:38 +08:00
|
|
|
|
|
|
|
/* For function searching */
|
2009-12-17 06:16:19 +08:00
|
|
|
Dwarf_Addr addr; /* Address */
|
|
|
|
Dwarf_Unsigned fno; /* File number */
|
|
|
|
Dwarf_Unsigned lno; /* Line number */
|
|
|
|
Dwarf_Off inl_offs; /* Inline offset */
|
|
|
|
Dwarf_Die cu_die; /* Current CU */
|
2009-10-09 05:17:38 +08:00
|
|
|
|
|
|
|
/* For variable searching */
|
2009-12-17 06:16:19 +08:00
|
|
|
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-09 05:17:38 +08:00
|
|
|
};
|
2009-10-08 06:28:30 +08:00
|
|
|
#endif /* NO_LIBDWARF */
|
2009-10-09 05:17:38 +08:00
|
|
|
|
|
|
|
#endif /*_PROBE_FINDER_H */
|