Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 1 | /* |
| 2 | * builtin-probe.c |
| 3 | * |
| 4 | * Builtin probe command: Set up probe events by C expression |
| 5 | * |
| 6 | * Written by Masami Hiramatsu <mhiramat@redhat.com> |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 21 | * |
| 22 | */ |
| 23 | #define _GNU_SOURCE |
| 24 | #include <sys/utsname.h> |
| 25 | #include <sys/types.h> |
| 26 | #include <sys/stat.h> |
| 27 | #include <fcntl.h> |
| 28 | #include <errno.h> |
| 29 | #include <stdio.h> |
| 30 | #include <unistd.h> |
| 31 | #include <stdlib.h> |
| 32 | #include <string.h> |
| 33 | |
| 34 | #undef _GNU_SOURCE |
| 35 | #include "perf.h" |
| 36 | #include "builtin.h" |
| 37 | #include "util/util.h" |
Masami Hiramatsu | fa28244 | 2009-12-08 17:03:23 -0500 | [diff] [blame] | 38 | #include "util/strlist.h" |
Masami Hiramatsu | 89c69c0 | 2009-10-16 20:08:10 -0400 | [diff] [blame] | 39 | #include "util/event.h" |
| 40 | #include "util/debug.h" |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 41 | #include "util/parse-options.h" |
| 42 | #include "util/parse-events.h" /* For debugfs_path */ |
| 43 | #include "util/probe-finder.h" |
Masami Hiramatsu | 50656ee | 2009-11-30 19:19:58 -0500 | [diff] [blame] | 44 | #include "util/probe-event.h" |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 45 | |
| 46 | /* Default vmlinux search paths */ |
Masami Hiramatsu | f984f03 | 2009-12-08 17:03:09 -0500 | [diff] [blame] | 47 | #define NR_SEARCH_PATH 4 |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 48 | const char *default_search_path[NR_SEARCH_PATH] = { |
| 49 | "/lib/modules/%s/build/vmlinux", /* Custom build kernel */ |
| 50 | "/usr/lib/debug/lib/modules/%s/vmlinux", /* Red Hat debuginfo */ |
| 51 | "/boot/vmlinux-debug-%s", /* Ubuntu */ |
Masami Hiramatsu | f984f03 | 2009-12-08 17:03:09 -0500 | [diff] [blame] | 52 | "./vmlinux", /* CWD */ |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 53 | }; |
| 54 | |
| 55 | #define MAX_PATH_LEN 256 |
| 56 | #define MAX_PROBES 128 |
| 57 | |
| 58 | /* Session management structure */ |
| 59 | static struct { |
| 60 | char *vmlinux; |
| 61 | char *release; |
Masami Hiramatsu | fac13fd | 2009-12-15 10:31:14 -0500 | [diff] [blame^] | 62 | bool need_dwarf; |
| 63 | bool list_events; |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 64 | int nr_probe; |
| 65 | struct probe_point probes[MAX_PROBES]; |
Masami Hiramatsu | fa28244 | 2009-12-08 17:03:23 -0500 | [diff] [blame] | 66 | struct strlist *dellist; |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 67 | } session; |
| 68 | |
Masami Hiramatsu | 4de189f | 2009-11-30 19:20:17 -0500 | [diff] [blame] | 69 | |
Masami Hiramatsu | 253977b | 2009-10-27 16:43:10 -0400 | [diff] [blame] | 70 | /* Parse an event definition. Note that any error must die. */ |
| 71 | static void parse_probe_event(const char *str) |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 72 | { |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 73 | struct probe_point *pp = &session.probes[session.nr_probe]; |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 74 | |
Arnaldo Carvalho de Melo | b7cb10e | 2009-10-21 17:34:06 -0200 | [diff] [blame] | 75 | pr_debug("probe-definition(%d): %s\n", session.nr_probe, str); |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 76 | if (++session.nr_probe == MAX_PROBES) |
Masami Hiramatsu | 50656ee | 2009-11-30 19:19:58 -0500 | [diff] [blame] | 77 | die("Too many probes (> %d) are specified.", MAX_PROBES); |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 78 | |
Masami Hiramatsu | 50656ee | 2009-11-30 19:19:58 -0500 | [diff] [blame] | 79 | /* Parse perf-probe event into probe_point */ |
Masami Hiramatsu | fac13fd | 2009-12-15 10:31:14 -0500 | [diff] [blame^] | 80 | parse_perf_probe_event(str, pp, &session.need_dwarf); |
Masami Hiramatsu | 23e8ec0 | 2009-10-07 18:28:30 -0400 | [diff] [blame] | 81 | |
Arnaldo Carvalho de Melo | b7cb10e | 2009-10-21 17:34:06 -0200 | [diff] [blame] | 82 | pr_debug("%d arguments\n", pp->nr_args); |
Masami Hiramatsu | 46ab492 | 2009-10-27 16:43:02 -0400 | [diff] [blame] | 83 | } |
| 84 | |
Masami Hiramatsu | d1bde3f | 2009-12-08 17:02:54 -0500 | [diff] [blame] | 85 | static void parse_probe_event_argv(int argc, const char **argv) |
| 86 | { |
| 87 | int i, len; |
| 88 | char *buf; |
| 89 | |
| 90 | /* Bind up rest arguments */ |
| 91 | len = 0; |
| 92 | for (i = 0; i < argc; i++) |
| 93 | len += strlen(argv[i]) + 1; |
| 94 | buf = zalloc(len + 1); |
| 95 | if (!buf) |
| 96 | die("Failed to allocate memory for binding arguments."); |
| 97 | len = 0; |
| 98 | for (i = 0; i < argc; i++) |
| 99 | len += sprintf(&buf[len], "%s ", argv[i]); |
| 100 | parse_probe_event(buf); |
| 101 | free(buf); |
| 102 | } |
| 103 | |
Masami Hiramatsu | 253977b | 2009-10-27 16:43:10 -0400 | [diff] [blame] | 104 | static int opt_add_probe_event(const struct option *opt __used, |
Masami Hiramatsu | 46ab492 | 2009-10-27 16:43:02 -0400 | [diff] [blame] | 105 | const char *str, int unset __used) |
| 106 | { |
| 107 | if (str) |
Masami Hiramatsu | 253977b | 2009-10-27 16:43:10 -0400 | [diff] [blame] | 108 | parse_probe_event(str); |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 109 | return 0; |
| 110 | } |
| 111 | |
Masami Hiramatsu | fa28244 | 2009-12-08 17:03:23 -0500 | [diff] [blame] | 112 | static int opt_del_probe_event(const struct option *opt __used, |
| 113 | const char *str, int unset __used) |
| 114 | { |
| 115 | if (str) { |
| 116 | if (!session.dellist) |
| 117 | session.dellist = strlist__new(true, NULL); |
| 118 | strlist__add(session.dellist, str); |
| 119 | } |
| 120 | return 0; |
| 121 | } |
| 122 | |
Masami Hiramatsu | 23e8ec0 | 2009-10-07 18:28:30 -0400 | [diff] [blame] | 123 | #ifndef NO_LIBDWARF |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 124 | static int open_default_vmlinux(void) |
| 125 | { |
| 126 | struct utsname uts; |
| 127 | char fname[MAX_PATH_LEN]; |
| 128 | int fd, ret, i; |
| 129 | |
| 130 | ret = uname(&uts); |
| 131 | if (ret) { |
Arnaldo Carvalho de Melo | b7cb10e | 2009-10-21 17:34:06 -0200 | [diff] [blame] | 132 | pr_debug("uname() failed.\n"); |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 133 | return -errno; |
| 134 | } |
| 135 | session.release = uts.release; |
| 136 | for (i = 0; i < NR_SEARCH_PATH; i++) { |
| 137 | ret = snprintf(fname, MAX_PATH_LEN, |
| 138 | default_search_path[i], session.release); |
| 139 | if (ret >= MAX_PATH_LEN || ret < 0) { |
Arnaldo Carvalho de Melo | b7cb10e | 2009-10-21 17:34:06 -0200 | [diff] [blame] | 140 | pr_debug("Filename(%d,%s) is too long.\n", i, |
Masami Hiramatsu | 89c69c0 | 2009-10-16 20:08:10 -0400 | [diff] [blame] | 141 | uts.release); |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 142 | errno = E2BIG; |
| 143 | return -E2BIG; |
| 144 | } |
Arnaldo Carvalho de Melo | b7cb10e | 2009-10-21 17:34:06 -0200 | [diff] [blame] | 145 | pr_debug("try to open %s\n", fname); |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 146 | fd = open(fname, O_RDONLY); |
| 147 | if (fd >= 0) |
| 148 | break; |
| 149 | } |
| 150 | return fd; |
| 151 | } |
Masami Hiramatsu | 23e8ec0 | 2009-10-07 18:28:30 -0400 | [diff] [blame] | 152 | #endif |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 153 | |
| 154 | static const char * const probe_usage[] = { |
Masami Hiramatsu | 46ab492 | 2009-10-27 16:43:02 -0400 | [diff] [blame] | 155 | "perf probe [<options>] 'PROBEDEF' ['PROBEDEF' ...]", |
| 156 | "perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]", |
Masami Hiramatsu | fa28244 | 2009-12-08 17:03:23 -0500 | [diff] [blame] | 157 | "perf probe [<options>] --del '[GROUP:]EVENT' ...", |
Masami Hiramatsu | 4de189f | 2009-11-30 19:20:17 -0500 | [diff] [blame] | 158 | "perf probe --list", |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 159 | NULL |
| 160 | }; |
| 161 | |
| 162 | static const struct option options[] = { |
Masami Hiramatsu | 89c69c0 | 2009-10-16 20:08:10 -0400 | [diff] [blame] | 163 | OPT_BOOLEAN('v', "verbose", &verbose, |
| 164 | "be more verbose (show parsed arguments, etc)"), |
Masami Hiramatsu | 23e8ec0 | 2009-10-07 18:28:30 -0400 | [diff] [blame] | 165 | #ifndef NO_LIBDWARF |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 166 | OPT_STRING('k', "vmlinux", &session.vmlinux, "file", |
| 167 | "vmlinux/module pathname"), |
Masami Hiramatsu | 23e8ec0 | 2009-10-07 18:28:30 -0400 | [diff] [blame] | 168 | #endif |
Masami Hiramatsu | fac13fd | 2009-12-15 10:31:14 -0500 | [diff] [blame^] | 169 | OPT_BOOLEAN('l', "list", &session.list_events, |
| 170 | "list up current probe events"), |
Masami Hiramatsu | fa28244 | 2009-12-08 17:03:23 -0500 | [diff] [blame] | 171 | OPT_CALLBACK('d', "del", NULL, "[GROUP:]EVENT", "delete a probe event.", |
| 172 | opt_del_probe_event), |
Masami Hiramatsu | 46ab492 | 2009-10-27 16:43:02 -0400 | [diff] [blame] | 173 | OPT_CALLBACK('a', "add", NULL, |
Masami Hiramatsu | 23e8ec0 | 2009-10-07 18:28:30 -0400 | [diff] [blame] | 174 | #ifdef NO_LIBDWARF |
Masami Hiramatsu | 253977b | 2009-10-27 16:43:10 -0400 | [diff] [blame] | 175 | "FUNC[+OFFS|%return] [ARG ...]", |
Masami Hiramatsu | 23e8ec0 | 2009-10-07 18:28:30 -0400 | [diff] [blame] | 176 | #else |
Masami Hiramatsu | b0ef073 | 2009-10-27 16:43:19 -0400 | [diff] [blame] | 177 | "FUNC[+OFFS|%return|:RLN][@SRC]|SRC:ALN [ARG ...]", |
Masami Hiramatsu | 23e8ec0 | 2009-10-07 18:28:30 -0400 | [diff] [blame] | 178 | #endif |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 179 | "probe point definition, where\n" |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 180 | "\t\tGRP:\tGroup name (optional)\n" |
| 181 | "\t\tNAME:\tEvent name\n" |
| 182 | "\t\tFUNC:\tFunction name\n" |
| 183 | "\t\tOFFS:\tOffset from function entry (in byte)\n" |
Masami Hiramatsu | 253977b | 2009-10-27 16:43:10 -0400 | [diff] [blame] | 184 | "\t\t%return:\tPut the probe at function return\n" |
Masami Hiramatsu | 23e8ec0 | 2009-10-07 18:28:30 -0400 | [diff] [blame] | 185 | #ifdef NO_LIBDWARF |
| 186 | "\t\tARG:\tProbe argument (only \n" |
| 187 | #else |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 188 | "\t\tSRC:\tSource code path\n" |
Masami Hiramatsu | b0ef073 | 2009-10-27 16:43:19 -0400 | [diff] [blame] | 189 | "\t\tRLN:\tRelative line number from function entry.\n" |
| 190 | "\t\tALN:\tAbsolute line number in file.\n" |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 191 | "\t\tARG:\tProbe argument (local variable name or\n" |
Masami Hiramatsu | 23e8ec0 | 2009-10-07 18:28:30 -0400 | [diff] [blame] | 192 | #endif |
Masami Hiramatsu | 50656ee | 2009-11-30 19:19:58 -0500 | [diff] [blame] | 193 | "\t\t\tkprobe-tracer argument format.)\n", |
Masami Hiramatsu | 253977b | 2009-10-27 16:43:10 -0400 | [diff] [blame] | 194 | opt_add_probe_event), |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 195 | OPT_END() |
| 196 | }; |
| 197 | |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 198 | int cmd_probe(int argc, const char **argv, const char *prefix __used) |
| 199 | { |
Masami Hiramatsu | d1bde3f | 2009-12-08 17:02:54 -0500 | [diff] [blame] | 200 | int i, ret; |
Xiao Guangrong | bdad0db | 2009-12-02 16:08:41 +0800 | [diff] [blame] | 201 | #ifndef NO_LIBDWARF |
| 202 | int fd; |
| 203 | #endif |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 204 | struct probe_point *pp; |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 205 | |
| 206 | argc = parse_options(argc, argv, options, probe_usage, |
Masami Hiramatsu | 46ab492 | 2009-10-27 16:43:02 -0400 | [diff] [blame] | 207 | PARSE_OPT_STOP_AT_NON_OPTION); |
Masami Hiramatsu | d1bde3f | 2009-12-08 17:02:54 -0500 | [diff] [blame] | 208 | if (argc > 0) |
| 209 | parse_probe_event_argv(argc, argv); |
Masami Hiramatsu | 46ab492 | 2009-10-27 16:43:02 -0400 | [diff] [blame] | 210 | |
Masami Hiramatsu | fac13fd | 2009-12-15 10:31:14 -0500 | [diff] [blame^] | 211 | if ((!session.nr_probe && !session.dellist && !session.list_events)) |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 212 | usage_with_options(probe_usage, options); |
| 213 | |
Masami Hiramatsu | fac13fd | 2009-12-15 10:31:14 -0500 | [diff] [blame^] | 214 | if (session.list_events) { |
Masami Hiramatsu | fa28244 | 2009-12-08 17:03:23 -0500 | [diff] [blame] | 215 | if (session.nr_probe != 0 || session.dellist) { |
| 216 | pr_warning(" Error: Don't use --list with" |
| 217 | " --add/--del.\n"); |
| 218 | usage_with_options(probe_usage, options); |
| 219 | } |
Masami Hiramatsu | 4de189f | 2009-11-30 19:20:17 -0500 | [diff] [blame] | 220 | show_perf_probe_events(); |
| 221 | return 0; |
| 222 | } |
| 223 | |
Masami Hiramatsu | fa28244 | 2009-12-08 17:03:23 -0500 | [diff] [blame] | 224 | if (session.dellist) { |
| 225 | del_trace_kprobe_events(session.dellist); |
| 226 | strlist__delete(session.dellist); |
| 227 | if (session.nr_probe == 0) |
| 228 | return 0; |
| 229 | } |
| 230 | |
Masami Hiramatsu | 23e8ec0 | 2009-10-07 18:28:30 -0400 | [diff] [blame] | 231 | if (session.need_dwarf) |
Masami Hiramatsu | a225a1d | 2009-11-03 19:12:30 -0500 | [diff] [blame] | 232 | #ifdef NO_LIBDWARF |
Masami Hiramatsu | 50656ee | 2009-11-30 19:19:58 -0500 | [diff] [blame] | 233 | die("Debuginfo-analysis is not supported"); |
Masami Hiramatsu | a225a1d | 2009-11-03 19:12:30 -0500 | [diff] [blame] | 234 | #else /* !NO_LIBDWARF */ |
Masami Hiramatsu | f41b1e4 | 2009-11-30 19:19:27 -0500 | [diff] [blame] | 235 | pr_debug("Some probes require debuginfo.\n"); |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 236 | |
Masami Hiramatsu | f984f03 | 2009-12-08 17:03:09 -0500 | [diff] [blame] | 237 | if (session.vmlinux) { |
| 238 | pr_debug("Try to open %s.", session.vmlinux); |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 239 | fd = open(session.vmlinux, O_RDONLY); |
Masami Hiramatsu | f984f03 | 2009-12-08 17:03:09 -0500 | [diff] [blame] | 240 | } else |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 241 | fd = open_default_vmlinux(); |
Masami Hiramatsu | a225a1d | 2009-11-03 19:12:30 -0500 | [diff] [blame] | 242 | if (fd < 0) { |
| 243 | if (session.need_dwarf) |
Masami Hiramatsu | f984f03 | 2009-12-08 17:03:09 -0500 | [diff] [blame] | 244 | die("Could not open debuginfo file."); |
Masami Hiramatsu | a225a1d | 2009-11-03 19:12:30 -0500 | [diff] [blame] | 245 | |
Masami Hiramatsu | d3a2dbf | 2009-12-07 12:00:59 -0500 | [diff] [blame] | 246 | pr_debug("Could not open vmlinux/module file." |
| 247 | " Try to use symbols.\n"); |
Masami Hiramatsu | a225a1d | 2009-11-03 19:12:30 -0500 | [diff] [blame] | 248 | goto end_dwarf; |
| 249 | } |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 250 | |
| 251 | /* Searching probe points */ |
Masami Hiramatsu | d1bde3f | 2009-12-08 17:02:54 -0500 | [diff] [blame] | 252 | for (i = 0; i < session.nr_probe; i++) { |
| 253 | pp = &session.probes[i]; |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 254 | if (pp->found) |
| 255 | continue; |
| 256 | |
| 257 | lseek(fd, SEEK_SET, 0); |
| 258 | ret = find_probepoint(fd, pp); |
Masami Hiramatsu | a225a1d | 2009-11-03 19:12:30 -0500 | [diff] [blame] | 259 | if (ret < 0) { |
| 260 | if (session.need_dwarf) |
| 261 | die("Could not analyze debuginfo."); |
| 262 | |
| 263 | pr_warning("An error occurred in debuginfo analysis. Try to use symbols.\n"); |
| 264 | break; |
| 265 | } |
| 266 | if (ret == 0) /* No error but failed to find probe point. */ |
| 267 | die("No probe point found."); |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 268 | } |
| 269 | close(fd); |
| 270 | |
Masami Hiramatsu | a225a1d | 2009-11-03 19:12:30 -0500 | [diff] [blame] | 271 | end_dwarf: |
Masami Hiramatsu | 23e8ec0 | 2009-10-07 18:28:30 -0400 | [diff] [blame] | 272 | #endif /* !NO_LIBDWARF */ |
| 273 | |
Masami Hiramatsu | a225a1d | 2009-11-03 19:12:30 -0500 | [diff] [blame] | 274 | /* Synthesize probes without dwarf */ |
Masami Hiramatsu | d1bde3f | 2009-12-08 17:02:54 -0500 | [diff] [blame] | 275 | for (i = 0; i < session.nr_probe; i++) { |
| 276 | pp = &session.probes[i]; |
Masami Hiramatsu | a225a1d | 2009-11-03 19:12:30 -0500 | [diff] [blame] | 277 | if (pp->found) /* This probe is already found. */ |
| 278 | continue; |
| 279 | |
Masami Hiramatsu | 50656ee | 2009-11-30 19:19:58 -0500 | [diff] [blame] | 280 | ret = synthesize_trace_kprobe_event(pp); |
Masami Hiramatsu | a225a1d | 2009-11-03 19:12:30 -0500 | [diff] [blame] | 281 | if (ret == -E2BIG) |
Masami Hiramatsu | 50656ee | 2009-11-30 19:19:58 -0500 | [diff] [blame] | 282 | die("probe point definition becomes too long."); |
Masami Hiramatsu | a225a1d | 2009-11-03 19:12:30 -0500 | [diff] [blame] | 283 | else if (ret < 0) |
| 284 | die("Failed to synthesize a probe point."); |
| 285 | } |
| 286 | |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 287 | /* Settng up probe points */ |
Masami Hiramatsu | 50656ee | 2009-11-30 19:19:58 -0500 | [diff] [blame] | 288 | add_trace_kprobe_events(session.probes, session.nr_probe); |
Masami Hiramatsu | 4ea42b1 | 2009-10-08 17:17:38 -0400 | [diff] [blame] | 289 | return 0; |
| 290 | } |
| 291 | |