probe-finder.h 1.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#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 {
15 16 17
	char	*event;		/* Event name */
	char	*group;		/* Event group */

18 19 20 21 22 23 24 25 26 27
	/* 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 */

28 29
	int	retprobe;	/* Return probe */

30 31 32 33 34
	/* Output */
	int	found;		/* Number of found probe points */
	char	*probes[MAX_PROBES];	/* Output buffers (will be allocated)*/
};

35
#ifndef NO_LIBDWARF
36 37 38 39 40 41 42 43 44 45 46
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 */
47
	Dwarf_Unsigned	lno;		/* Line number */
48
	Dwarf_Off	inl_offs;	/* Inline offset */
49
	Dwarf_Die	cu_die;		/* Current CU */
50 51 52 53 54 55 56 57

	/* 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 */
};
58
#endif /* NO_LIBDWARF */
59 60

#endif /*_PROBE_FINDER_H */