probe-finder.h 1.6 KB
Newer Older
1 2 3
#ifndef _PROBE_FINDER_H
#define _PROBE_FINDER_H

4
#include <stdbool.h>
5
#include "util.h"
6
#include "probe-event.h"
7

8 9 10
#define MAX_PATH_LEN		 256
#define MAX_PROBE_BUFFER	1024
#define MAX_PROBES		 128
11 12 13 14 15 16 17

static inline int is_c_varname(const char *name)
{
	/* TODO */
	return isalpha(name[0]) || name[0] == '_';
}

18
#ifdef DWARF_SUPPORT
19 20 21 22
/* Find kprobe_trace_events specified by perf_probe_event from debuginfo */
extern int find_kprobe_trace_events(int fd, struct perf_probe_event *pev,
				    struct kprobe_trace_event **tevs);

23 24 25 26
/* Find a perf_probe_point from debuginfo */
extern int find_perf_probe_point(int fd, unsigned long addr,
				 struct perf_probe_point *ppt);

27
extern int find_line_range(int fd, struct line_range *lr);
28

29
#include <dwarf.h>
30
#include <libdw.h>
31 32

struct probe_finder {
33 34 35
	struct perf_probe_event	*pev;		/* Target probe event */
	int			ntevs;		/* number of trace events */
	struct kprobe_trace_event *tevs;	/* Result trace events */
36 37

	/* For function searching */
38
	Dwarf_Addr		addr;		/* Address */
39
	const char		*fname;		/* Real file name */
40 41
	int			lno;		/* Line number */
	Dwarf_Die		cu_die;		/* Current CU */
42
	struct list_head	lcache;		/* Line cache for lazy match */
43 44

	/* For variable searching */
45
	Dwarf_Op		*fb_ops;	/* Frame base attribute */
46 47
	struct perf_probe_arg	*pvar;		/* Current target variable */
	struct kprobe_trace_arg	*tvar;		/* Current result variable */
48
};
49 50

struct line_finder {
51 52 53 54 55 56
	struct line_range	*lr;		/* Target line range */

	const char		*fname;		/* File name */
	int			lno_s;		/* Start line number */
	int			lno_e;		/* End line number */
	Dwarf_Die		cu_die;		/* Current CU */
57 58 59
	int			found;
};

60
#endif /* DWARF_SUPPORT */
61 62

#endif /*_PROBE_FINDER_H */