]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - tools/perf/util/probe-finder.h
perf probe: Add --dry-run option
[mirror_ubuntu-artful-kernel.git] / tools / perf / util / probe-finder.h
CommitLineData
4ea42b18
MH
1#ifndef _PROBE_FINDER_H
2#define _PROBE_FINDER_H
3
804b3606 4#include <stdbool.h>
4a58e611
ACM
5#include "util.h"
6
27f3b24d
MH
7#define MAX_PATH_LEN 256
8#define MAX_PROBE_BUFFER 1024
9#define MAX_PROBES 128
4ea42b18
MH
10
11static inline int is_c_varname(const char *name)
12{
13 /* TODO */
14 return isalpha(name[0]) || name[0] == '_';
15}
16
17struct probe_point {
27f3b24d
MH
18 char *event; /* Event name */
19 char *group; /* Event group */
af663d75 20
4ea42b18 21 /* Inputs */
27f3b24d
MH
22 char *file; /* File name */
23 int line; /* Line number */
2a9c8c36 24 char *lazy_line; /* Lazy line pattern */
4ea42b18 25
27f3b24d
MH
26 char *function; /* Function name */
27 int offset; /* Offset bytes */
4ea42b18 28
27f3b24d
MH
29 int nr_args; /* Number of arguments */
30 char **args; /* Arguments */
4ea42b18 31
27f3b24d 32 int retprobe; /* Return probe */
253977b0 33
4ea42b18 34 /* Output */
27f3b24d
MH
35 int found; /* Number of found probe points */
36 char *probes[MAX_PROBES]; /* Output buffers (will be allocated)*/
4ea42b18
MH
37};
38
631c9def
MH
39/* Line number container */
40struct line_node {
41 struct list_head list;
42 unsigned int line;
43};
44
45/* Line range */
46struct line_range {
47 char *file; /* File name */
48 char *function; /* Function name */
49 unsigned int start; /* Start line number */
50 unsigned int end; /* End line number */
804b3606 51 int offset; /* Start line offset */
631c9def
MH
52 char *path; /* Real path name */
53 struct list_head line_list; /* Visible lines */
54};
55
804b3606 56#ifndef NO_DWARF_SUPPORT
81cb8aa3 57extern int find_probe_point(int fd, struct probe_point *pp);
631c9def 58extern int find_line_range(int fd, struct line_range *lr);
4ea42b18 59
27f3b24d 60#include <dwarf.h>
804b3606 61#include <libdw.h>
4ea42b18
MH
62
63struct probe_finder {
804b3606 64 struct probe_point *pp; /* Target probe point */
4ea42b18
MH
65
66 /* For function searching */
804b3606
MH
67 Dwarf_Addr addr; /* Address */
68 const char *fname; /* File name */
69 int lno; /* Line number */
804b3606 70 Dwarf_Die cu_die; /* Current CU */
4ea42b18
MH
71
72 /* For variable searching */
804b3606 73 Dwarf_Op *fb_ops; /* Frame base attribute */
804b3606
MH
74 const char *var; /* Current variable name */
75 char *buf; /* Current output buffer */
76 int len; /* Length of output buffer */
2a9c8c36 77 struct list_head lcache; /* Line cache for lazy match */
4ea42b18 78};
631c9def
MH
79
80struct line_finder {
804b3606
MH
81 struct line_range *lr; /* Target line range */
82
83 const char *fname; /* File name */
84 int lno_s; /* Start line number */
85 int lno_e; /* End line number */
804b3606 86 Dwarf_Die cu_die; /* Current CU */
631c9def
MH
87 int found;
88};
89
804b3606 90#endif /* NO_DWARF_SUPPORT */
4ea42b18
MH
91
92#endif /*_PROBE_FINDER_H */