aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/probe-finder.h
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@redhat.com>2010-03-16 18:06:12 -0400
committerIngo Molnar <mingo@elte.hu>2010-03-17 06:32:31 -0400
commit4235b0454ebeefc2295ad8417e18a8761425b19e (patch)
treee6b0a3c66618dede18117a71fd16d2e65f93cba1 /tools/perf/util/probe-finder.h
parentf4d7da499e4fc1fdff8f26fdeb1a058d475a7a6c (diff)
perf probe: Introduce kprobe_trace_event and perf_probe_event
Introduce kprobe_trace_event and perf_probe_event and replace old probe_point structure with it. probe_point structure is not enough flexible nor extensible. New data structures will help implementing further features. Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com> Cc: systemtap <systemtap@sources.redhat.com> Cc: DLE <dle-develop@lists.sourceforge.net> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <20100316220612.32050.33806.stgit@localhost6.localdomain6> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/probe-finder.h')
-rw-r--r--tools/perf/util/probe-finder.h58
1 files changed, 12 insertions, 46 deletions
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
index 21f7354397b4..494952619b9c 100644
--- a/tools/perf/util/probe-finder.h
+++ b/tools/perf/util/probe-finder.h
@@ -3,6 +3,7 @@
3 3
4#include <stdbool.h> 4#include <stdbool.h>
5#include "util.h" 5#include "util.h"
6#include "probe-event.h"
6 7
7#define MAX_PATH_LEN 256 8#define MAX_PATH_LEN 256
8#define MAX_PROBE_BUFFER 1024 9#define MAX_PROBE_BUFFER 1024
@@ -14,67 +15,32 @@ static inline int is_c_varname(const char *name)
14 return isalpha(name[0]) || name[0] == '_'; 15 return isalpha(name[0]) || name[0] == '_';
15} 16}
16 17
17struct probe_point {
18 char *event; /* Event name */
19 char *group; /* Event group */
20
21 /* Inputs */
22 char *file; /* File name */
23 int line; /* Line number */
24 char *lazy_line; /* Lazy line pattern */
25
26 char *function; /* Function name */
27 int offset; /* Offset bytes */
28
29 int nr_args; /* Number of arguments */
30 char **args; /* Arguments */
31
32 int retprobe; /* Return probe */
33
34 /* Output */
35 int found; /* Number of found probe points */
36 char *probes[MAX_PROBES]; /* Output buffers (will be allocated)*/
37};
38
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 */
51 int offset; /* Start line offset */
52 char *path; /* Real path name */
53 struct list_head line_list; /* Visible lines */
54};
55
56#ifndef NO_DWARF_SUPPORT 18#ifndef NO_DWARF_SUPPORT
57extern int find_probe_point(int fd, struct probe_point *pp); 19/* Find kprobe_trace_events specified by perf_probe_event from debuginfo */
20extern int find_kprobe_trace_events(int fd, struct perf_probe_event *pev,
21 struct kprobe_trace_event **tevs);
22
58extern int find_line_range(int fd, struct line_range *lr); 23extern int find_line_range(int fd, struct line_range *lr);
59 24
60#include <dwarf.h> 25#include <dwarf.h>
61#include <libdw.h> 26#include <libdw.h>
62 27
63struct probe_finder { 28struct probe_finder {
64 struct probe_point *pp; /* Target probe point */ 29 struct perf_probe_event *pev; /* Target probe event */
30 int ntevs; /* number of trace events */
31 struct kprobe_trace_event *tevs; /* Result trace events */
65 32
66 /* For function searching */ 33 /* For function searching */
67 Dwarf_Addr addr; /* Address */ 34 Dwarf_Addr addr; /* Address */
68 const char *fname; /* File name */ 35 const char *fname; /* Real file name */
69 int lno; /* Line number */ 36 int lno; /* Line number */
70 Dwarf_Die cu_die; /* Current CU */ 37 Dwarf_Die cu_die; /* Current CU */
38 struct list_head lcache; /* Line cache for lazy match */
71 39
72 /* For variable searching */ 40 /* For variable searching */
73 Dwarf_Op *fb_ops; /* Frame base attribute */ 41 Dwarf_Op *fb_ops; /* Frame base attribute */
74 const char *var; /* Current variable name */ 42 struct perf_probe_arg *pvar; /* Current target variable */
75 char *buf; /* Current output buffer */ 43 struct kprobe_trace_arg *tvar; /* Current result variable */
76 int len; /* Length of output buffer */
77 struct list_head lcache; /* Line cache for lazy match */
78}; 44};
79 45
80struct line_finder { 46struct line_finder {