diff options
Diffstat (limited to 'tools/perf/builtin-probe.c')
-rw-r--r-- | tools/perf/builtin-probe.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index ad47bd4c50ef..c30a33592340 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c | |||
@@ -128,7 +128,7 @@ static void evaluate_probe_point(struct probe_point *pp) | |||
128 | pp->function); | 128 | pp->function); |
129 | } | 129 | } |
130 | 130 | ||
131 | #ifndef NO_LIBDWARF | 131 | #ifndef NO_DWARF_SUPPORT |
132 | static int open_vmlinux(void) | 132 | static int open_vmlinux(void) |
133 | { | 133 | { |
134 | if (map__load(session.kmaps[MAP__FUNCTION], NULL) < 0) { | 134 | if (map__load(session.kmaps[MAP__FUNCTION], NULL) < 0) { |
@@ -156,14 +156,16 @@ static const char * const probe_usage[] = { | |||
156 | "perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]", | 156 | "perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]", |
157 | "perf probe [<options>] --del '[GROUP:]EVENT' ...", | 157 | "perf probe [<options>] --del '[GROUP:]EVENT' ...", |
158 | "perf probe --list", | 158 | "perf probe --list", |
159 | #ifndef NO_DWARF_SUPPORT | ||
159 | "perf probe --line 'LINEDESC'", | 160 | "perf probe --line 'LINEDESC'", |
161 | #endif | ||
160 | NULL | 162 | NULL |
161 | }; | 163 | }; |
162 | 164 | ||
163 | static const struct option options[] = { | 165 | static const struct option options[] = { |
164 | OPT_BOOLEAN('v', "verbose", &verbose, | 166 | OPT_BOOLEAN('v', "verbose", &verbose, |
165 | "be more verbose (show parsed arguments, etc)"), | 167 | "be more verbose (show parsed arguments, etc)"), |
166 | #ifndef NO_LIBDWARF | 168 | #ifndef NO_DWARF_SUPPORT |
167 | OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name, | 169 | OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name, |
168 | "file", "vmlinux pathname"), | 170 | "file", "vmlinux pathname"), |
169 | #endif | 171 | #endif |
@@ -172,30 +174,32 @@ static const struct option options[] = { | |||
172 | OPT_CALLBACK('d', "del", NULL, "[GROUP:]EVENT", "delete a probe event.", | 174 | OPT_CALLBACK('d', "del", NULL, "[GROUP:]EVENT", "delete a probe event.", |
173 | opt_del_probe_event), | 175 | opt_del_probe_event), |
174 | OPT_CALLBACK('a', "add", NULL, | 176 | OPT_CALLBACK('a', "add", NULL, |
175 | #ifdef NO_LIBDWARF | 177 | #ifdef NO_DWARF_SUPPORT |
176 | "[EVENT=]FUNC[+OFFS|%return] [ARG ...]", | 178 | "[EVENT=]FUNC[+OFF|%return] [ARG ...]", |
177 | #else | 179 | #else |
178 | "[EVENT=]FUNC[+OFFS|%return|:RLN][@SRC]|SRC:ALN [ARG ...]", | 180 | "[EVENT=]FUNC[@SRC][+OFF|%return|:RL|;PT]|SRC:AL|SRC;PT" |
181 | " [ARG ...]", | ||
179 | #endif | 182 | #endif |
180 | "probe point definition, where\n" | 183 | "probe point definition, where\n" |
181 | "\t\tGROUP:\tGroup name (optional)\n" | 184 | "\t\tGROUP:\tGroup name (optional)\n" |
182 | "\t\tEVENT:\tEvent name\n" | 185 | "\t\tEVENT:\tEvent name\n" |
183 | "\t\tFUNC:\tFunction name\n" | 186 | "\t\tFUNC:\tFunction name\n" |
184 | "\t\tOFFS:\tOffset from function entry (in byte)\n" | 187 | "\t\tOFF:\tOffset from function entry (in byte)\n" |
185 | "\t\t%return:\tPut the probe at function return\n" | 188 | "\t\t%return:\tPut the probe at function return\n" |
186 | #ifdef NO_LIBDWARF | 189 | #ifdef NO_DWARF_SUPPORT |
187 | "\t\tARG:\tProbe argument (only \n" | 190 | "\t\tARG:\tProbe argument (only \n" |
188 | #else | 191 | #else |
189 | "\t\tSRC:\tSource code path\n" | 192 | "\t\tSRC:\tSource code path\n" |
190 | "\t\tRLN:\tRelative line number from function entry.\n" | 193 | "\t\tRL:\tRelative line number from function entry.\n" |
191 | "\t\tALN:\tAbsolute line number in file.\n" | 194 | "\t\tAL:\tAbsolute line number in file.\n" |
195 | "\t\tPT:\tLazy expression of line code.\n" | ||
192 | "\t\tARG:\tProbe argument (local variable name or\n" | 196 | "\t\tARG:\tProbe argument (local variable name or\n" |
193 | #endif | 197 | #endif |
194 | "\t\t\tkprobe-tracer argument format.)\n", | 198 | "\t\t\tkprobe-tracer argument format.)\n", |
195 | opt_add_probe_event), | 199 | opt_add_probe_event), |
196 | OPT_BOOLEAN('f', "force", &session.force_add, "forcibly add events" | 200 | OPT_BOOLEAN('f', "force", &session.force_add, "forcibly add events" |
197 | " with existing name"), | 201 | " with existing name"), |
198 | #ifndef NO_LIBDWARF | 202 | #ifndef NO_DWARF_SUPPORT |
199 | OPT_CALLBACK('L', "line", NULL, | 203 | OPT_CALLBACK('L', "line", NULL, |
200 | "FUNC[:RLN[+NUM|:RLN2]]|SRC:ALN[+NUM|:ALN2]", | 204 | "FUNC[:RLN[+NUM|:RLN2]]|SRC:ALN[+NUM|:ALN2]", |
201 | "Show source code lines.", opt_show_lines), | 205 | "Show source code lines.", opt_show_lines), |
@@ -223,7 +227,7 @@ static void init_vmlinux(void) | |||
223 | int cmd_probe(int argc, const char **argv, const char *prefix __used) | 227 | int cmd_probe(int argc, const char **argv, const char *prefix __used) |
224 | { | 228 | { |
225 | int i, ret; | 229 | int i, ret; |
226 | #ifndef NO_LIBDWARF | 230 | #ifndef NO_DWARF_SUPPORT |
227 | int fd; | 231 | int fd; |
228 | #endif | 232 | #endif |
229 | struct probe_point *pp; | 233 | struct probe_point *pp; |
@@ -259,7 +263,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used) | |||
259 | return 0; | 263 | return 0; |
260 | } | 264 | } |
261 | 265 | ||
262 | #ifndef NO_LIBDWARF | 266 | #ifndef NO_DWARF_SUPPORT |
263 | if (session.show_lines) { | 267 | if (session.show_lines) { |
264 | if (session.nr_probe != 0 || session.dellist) { | 268 | if (session.nr_probe != 0 || session.dellist) { |
265 | pr_warning(" Error: Don't use --line with" | 269 | pr_warning(" Error: Don't use --line with" |
@@ -290,9 +294,9 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used) | |||
290 | init_vmlinux(); | 294 | init_vmlinux(); |
291 | 295 | ||
292 | if (session.need_dwarf) | 296 | if (session.need_dwarf) |
293 | #ifdef NO_LIBDWARF | 297 | #ifdef NO_DWARF_SUPPORT |
294 | die("Debuginfo-analysis is not supported"); | 298 | die("Debuginfo-analysis is not supported"); |
295 | #else /* !NO_LIBDWARF */ | 299 | #else /* !NO_DWARF_SUPPORT */ |
296 | pr_debug("Some probes require debuginfo.\n"); | 300 | pr_debug("Some probes require debuginfo.\n"); |
297 | 301 | ||
298 | fd = open_vmlinux(); | 302 | fd = open_vmlinux(); |
@@ -312,7 +316,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used) | |||
312 | continue; | 316 | continue; |
313 | 317 | ||
314 | lseek(fd, SEEK_SET, 0); | 318 | lseek(fd, SEEK_SET, 0); |
315 | ret = find_probepoint(fd, pp); | 319 | ret = find_probe_point(fd, pp); |
316 | if (ret > 0) | 320 | if (ret > 0) |
317 | continue; | 321 | continue; |
318 | if (ret == 0) { /* No error but failed to find probe point. */ | 322 | if (ret == 0) { /* No error but failed to find probe point. */ |
@@ -333,7 +337,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __used) | |||
333 | close(fd); | 337 | close(fd); |
334 | 338 | ||
335 | end_dwarf: | 339 | end_dwarf: |
336 | #endif /* !NO_LIBDWARF */ | 340 | #endif /* !NO_DWARF_SUPPORT */ |
337 | 341 | ||
338 | /* Synthesize probes without dwarf */ | 342 | /* Synthesize probes without dwarf */ |
339 | for (i = 0; i < session.nr_probe; i++) { | 343 | for (i = 0; i < session.nr_probe; i++) { |