2009-10-08 14:17:38 -07:00
|
|
|
#ifndef _PROBE_FINDER_H
|
|
|
|
#define _PROBE_FINDER_H
|
|
|
|
|
2010-02-25 06:35:42 -07:00
|
|
|
#include <stdbool.h>
|
2009-12-27 16:37:00 -07:00
|
|
|
#include "util.h"
|
2010-03-16 15:06:12 -07:00
|
|
|
#include "probe-event.h"
|
2009-12-27 16:37:00 -07:00
|
|
|
|
2009-12-16 15:16:19 -07:00
|
|
|
#define MAX_PATH_LEN 256
|
|
|
|
#define MAX_PROBE_BUFFER 1024
|
|
|
|
#define MAX_PROBES 128
|
2009-10-08 14:17:38 -07:00
|
|
|
|
|
|
|
static inline int is_c_varname(const char *name)
|
|
|
|
{
|
|
|
|
/* TODO */
|
|
|
|
return isalpha(name[0]) || name[0] == '_';
|
|
|
|
}
|
|
|
|
|
2010-02-25 06:35:42 -07:00
|
|
|
#ifndef NO_DWARF_SUPPORT
|
2010-03-16 15:06:12 -07:00
|
|
|
/* 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);
|
|
|
|
|
2010-03-16 15:06:19 -07:00
|
|
|
/* Find a perf_probe_point from debuginfo */
|
|
|
|
extern int find_perf_probe_point(int fd, unsigned long addr,
|
|
|
|
struct perf_probe_point *ppt);
|
|
|
|
|
2010-01-06 07:45:34 -07:00
|
|
|
extern int find_line_range(int fd, struct line_range *lr);
|
2009-10-08 14:17:38 -07:00
|
|
|
|
2009-12-16 15:16:19 -07:00
|
|
|
#include <dwarf.h>
|
2010-02-25 06:35:42 -07:00
|
|
|
#include <libdw.h>
|
2009-10-08 14:17:38 -07:00
|
|
|
|
|
|
|
struct probe_finder {
|
2010-03-16 15:06:12 -07:00
|
|
|
struct perf_probe_event *pev; /* Target probe event */
|
|
|
|
int ntevs; /* number of trace events */
|
|
|
|
struct kprobe_trace_event *tevs; /* Result trace events */
|
2009-10-08 14:17:38 -07:00
|
|
|
|
|
|
|
/* For function searching */
|
2010-02-25 06:35:42 -07:00
|
|
|
Dwarf_Addr addr; /* Address */
|
2010-03-16 15:06:12 -07:00
|
|
|
const char *fname; /* Real file name */
|
2010-02-25 06:35:42 -07:00
|
|
|
int lno; /* Line number */
|
|
|
|
Dwarf_Die cu_die; /* Current CU */
|
2010-03-16 15:06:12 -07:00
|
|
|
struct list_head lcache; /* Line cache for lazy match */
|
2009-10-08 14:17:38 -07:00
|
|
|
|
|
|
|
/* For variable searching */
|
2010-02-25 06:35:42 -07:00
|
|
|
Dwarf_Op *fb_ops; /* Frame base attribute */
|
2010-03-16 15:06:12 -07:00
|
|
|
struct perf_probe_arg *pvar; /* Current target variable */
|
|
|
|
struct kprobe_trace_arg *tvar; /* Current result variable */
|
2009-10-08 14:17:38 -07:00
|
|
|
};
|
2010-01-06 07:45:34 -07:00
|
|
|
|
|
|
|
struct line_finder {
|
2010-02-25 06:35:42 -07:00
|
|
|
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 */
|
2010-01-06 07:45:34 -07:00
|
|
|
int found;
|
|
|
|
};
|
|
|
|
|
2010-02-25 06:35:42 -07:00
|
|
|
#endif /* NO_DWARF_SUPPORT */
|
2009-10-08 14:17:38 -07:00
|
|
|
|
|
|
|
#endif /*_PROBE_FINDER_H */
|