2015-07-15 17:14:07 +08:00
|
|
|
#ifndef __PROBE_FILE_H
|
|
|
|
#define __PROBE_FILE_H
|
|
|
|
|
|
|
|
#include "probe-event.h"
|
|
|
|
|
2017-04-18 21:57:25 +08:00
|
|
|
struct strlist;
|
|
|
|
struct strfilter;
|
|
|
|
|
2016-06-15 11:28:30 +08:00
|
|
|
/* Cache of probe definitions */
|
|
|
|
struct probe_cache_entry {
|
|
|
|
struct list_head node;
|
2016-07-01 16:04:10 +08:00
|
|
|
bool sdt;
|
2016-06-15 11:28:30 +08:00
|
|
|
struct perf_probe_event pev;
|
|
|
|
char *spev;
|
|
|
|
struct strlist *tevlist;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct probe_cache {
|
|
|
|
int fd;
|
|
|
|
struct list_head entries;
|
|
|
|
};
|
|
|
|
|
2016-08-18 16:58:31 +08:00
|
|
|
enum probe_type {
|
|
|
|
PROBE_TYPE_U = 0,
|
|
|
|
PROBE_TYPE_S,
|
|
|
|
PROBE_TYPE_X,
|
|
|
|
PROBE_TYPE_STRING,
|
|
|
|
PROBE_TYPE_BITFIELD,
|
|
|
|
PROBE_TYPE_END,
|
|
|
|
};
|
|
|
|
|
2015-07-15 17:14:07 +08:00
|
|
|
#define PF_FL_UPROBE 1
|
|
|
|
#define PF_FL_RW 2
|
2016-07-12 18:05:04 +08:00
|
|
|
#define for_each_probe_cache_entry(entry, pcache) \
|
|
|
|
list_for_each_entry(entry, &pcache->entries, node)
|
2015-07-15 17:14:07 +08:00
|
|
|
|
2016-06-24 17:06:46 +08:00
|
|
|
/* probe-file.c depends on libelf */
|
|
|
|
#ifdef HAVE_LIBELF_SUPPORT
|
2017-02-23 19:37:23 +08:00
|
|
|
int open_trace_file(const char *trace_file, bool readwrite);
|
2015-07-15 17:14:07 +08:00
|
|
|
int probe_file__open(int flag);
|
|
|
|
int probe_file__open_both(int *kfd, int *ufd, int flag);
|
|
|
|
struct strlist *probe_file__get_namelist(int fd);
|
|
|
|
struct strlist *probe_file__get_rawlist(int fd);
|
|
|
|
int probe_file__add_event(int fd, struct probe_trace_event *tev);
|
2017-04-18 21:57:25 +08:00
|
|
|
|
2015-07-15 17:14:07 +08:00
|
|
|
int probe_file__del_events(int fd, struct strfilter *filter);
|
2015-09-04 20:16:03 +08:00
|
|
|
int probe_file__get_events(int fd, struct strfilter *filter,
|
|
|
|
struct strlist *plist);
|
|
|
|
int probe_file__del_strlist(int fd, struct strlist *namelist);
|
|
|
|
|
2016-07-12 18:05:18 +08:00
|
|
|
int probe_cache_entry__get_event(struct probe_cache_entry *entry,
|
|
|
|
struct probe_trace_event **tevs);
|
|
|
|
|
2016-06-15 11:28:30 +08:00
|
|
|
struct probe_cache *probe_cache__new(const char *target);
|
|
|
|
int probe_cache__add_entry(struct probe_cache *pcache,
|
|
|
|
struct perf_probe_event *pev,
|
|
|
|
struct probe_trace_event *tevs, int ntevs);
|
2016-07-01 16:04:10 +08:00
|
|
|
int probe_cache__scan_sdt(struct probe_cache *pcache, const char *pathname);
|
2016-06-15 11:28:30 +08:00
|
|
|
int probe_cache__commit(struct probe_cache *pcache);
|
|
|
|
void probe_cache__purge(struct probe_cache *pcache);
|
|
|
|
void probe_cache__delete(struct probe_cache *pcache);
|
2016-07-01 16:03:36 +08:00
|
|
|
int probe_cache__filter_purge(struct probe_cache *pcache,
|
|
|
|
struct strfilter *filter);
|
2016-07-01 16:03:12 +08:00
|
|
|
struct probe_cache_entry *probe_cache__find(struct probe_cache *pcache,
|
|
|
|
struct perf_probe_event *pev);
|
|
|
|
struct probe_cache_entry *probe_cache__find_by_name(struct probe_cache *pcache,
|
|
|
|
const char *group, const char *event);
|
2016-07-01 16:03:26 +08:00
|
|
|
int probe_cache__show_all_caches(struct strfilter *filter);
|
2016-08-18 16:58:31 +08:00
|
|
|
bool probe_type_is_available(enum probe_type type);
|
2017-03-08 16:26:09 +08:00
|
|
|
bool kretprobe_offset_is_supported(void);
|
2016-06-24 17:06:46 +08:00
|
|
|
#else /* ! HAVE_LIBELF_SUPPORT */
|
|
|
|
static inline struct probe_cache *probe_cache__new(const char *tgt __maybe_unused)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
#define probe_cache__delete(pcache) do {} while (0)
|
|
|
|
#endif
|
2015-07-15 17:14:07 +08:00
|
|
|
#endif
|