2009-10-08 17:17:38 -04:00
|
|
|
#ifndef _PROBE_FINDER_H
|
|
|
|
#define _PROBE_FINDER_H
|
|
|
|
|
2010-02-25 08:35:42 -05:00
|
|
|
#include <stdbool.h>
|
2009-12-27 18:37:00 -05:00
|
|
|
#include "util.h"
|
2010-03-16 18:06:12 -04:00
|
|
|
#include "probe-event.h"
|
2009-12-27 18:37:00 -05:00
|
|
|
|
2009-12-16 17:16:19 -05:00
|
|
|
#define MAX_PATH_LEN 256
|
|
|
|
#define MAX_PROBE_BUFFER 1024
|
|
|
|
#define MAX_PROBES 128
|
2009-10-08 17:17:38 -04:00
|
|
|
|
|
|
|
static inline int is_c_varname(const char *name)
|
|
|
|
{
|
|
|
|
/* TODO */
|
|
|
|
return isalpha(name[0]) || name[0] == '_';
|
|
|
|
}
|
|
|
|
|
2010-03-22 12:10:26 -04:00
|
|
|
#ifdef DWARF_SUPPORT
|
2010-03-16 18:06:12 -04: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 18:06:19 -04: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 09:45:34 -05:00
|
|
|
extern int find_line_range(int fd, struct line_range *lr);
|
2009-10-08 17:17:38 -04:00
|
|
|
|
2009-12-16 17:16:19 -05:00
|
|
|
#include <dwarf.h>
|
2010-02-25 08:35:42 -05:00
|
|
|
#include <libdw.h>
|
2009-10-08 17:17:38 -04:00
|
|
|
|
|
|
|
struct probe_finder {
|
2010-03-16 18:06:12 -04: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 17:17:38 -04:00
|
|
|
|
|
|
|
/* For function searching */
|
2010-02-25 08:35:42 -05:00
|
|
|
Dwarf_Addr addr; /* Address */
|
2010-03-16 18:06:12 -04:00
|
|
|
const char *fname; /* Real file name */
|
2010-02-25 08:35:42 -05:00
|
|
|
int lno; /* Line number */
|
|
|
|
Dwarf_Die cu_die; /* Current CU */
|
2010-03-16 18:06:12 -04:00
|
|
|
struct list_head lcache; /* Line cache for lazy match */
|
2009-10-08 17:17:38 -04:00
|
|
|
|
|
|
|
/* For variable searching */
|
2010-02-25 08:35:42 -05:00
|
|
|
Dwarf_Op *fb_ops; /* Frame base attribute */
|
2010-03-16 18:06:12 -04:00
|
|
|
struct perf_probe_arg *pvar; /* Current target variable */
|
|
|
|
struct kprobe_trace_arg *tvar; /* Current result variable */
|
2009-10-08 17:17:38 -04:00
|
|
|
};
|
2010-01-06 09:45:34 -05:00
|
|
|
|
|
|
|
struct line_finder {
|
2010-02-25 08:35:42 -05: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 09:45:34 -05:00
|
|
|
int found;
|
|
|
|
};
|
|
|
|
|
2010-03-22 12:10:26 -04:00
|
|
|
#endif /* DWARF_SUPPORT */
|
2009-10-08 17:17:38 -04:00
|
|
|
|
|
|
|
#endif /*_PROBE_FINDER_H */
|