aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/probe-event.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/probe-event.c')
-rw-r--r--tools/perf/util/probe-event.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index fcc16e4349d..288ebe8279d 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -378,6 +378,72 @@ end:
378 return ret; 378 return ret;
379} 379}
380 380
381static int show_available_vars_at(int fd, struct perf_probe_event *pev,
382 int max_vls)
383{
384 char *buf;
385 int ret, i;
386 struct str_node *node;
387 struct variable_list *vls = NULL, *vl;
388
389 buf = synthesize_perf_probe_point(&pev->point);
390 if (!buf)
391 return -EINVAL;
392 pr_debug("Searching variables at %s\n", buf);
393
394 ret = find_available_vars_at(fd, pev, &vls, max_vls);
395 if (ret > 0) {
396 /* Some variables were found */
397 fprintf(stdout, "Available variables at %s\n", buf);
398 for (i = 0; i < ret; i++) {
399 vl = &vls[i];
400 /*
401 * A probe point might be converted to
402 * several trace points.
403 */
404 fprintf(stdout, "\t@<%s+%lu>\n", vl->point.symbol,
405 vl->point.offset);
406 free(vl->point.symbol);
407 if (vl->vars) {
408 strlist__for_each(node, vl->vars)
409 fprintf(stdout, "\t\t%s\n", node->s);
410 strlist__delete(vl->vars);
411 } else
412 fprintf(stdout, "(No variables)\n");
413 }
414 free(vls);
415 } else
416 pr_err("Failed to find variables at %s (%d)\n", buf, ret);
417
418 free(buf);
419 return ret;
420}
421
422/* Show available variables on given probe point */
423int show_available_vars(struct perf_probe_event *pevs, int npevs,
424 int max_vls)
425{
426 int i, fd, ret = 0;
427
428 ret = init_vmlinux();
429 if (ret < 0)
430 return ret;
431
432 fd = open_vmlinux();
433 if (fd < 0) {
434 pr_warning("Failed to open debuginfo file.\n");
435 return fd;
436 }
437
438 setup_pager();
439
440 for (i = 0; i < npevs && ret >= 0; i++)
441 ret = show_available_vars_at(fd, &pevs[i], max_vls);
442
443 close(fd);
444 return ret;
445}
446
381#else /* !DWARF_SUPPORT */ 447#else /* !DWARF_SUPPORT */
382 448
383static int kprobe_convert_to_perf_probe(struct probe_trace_point *tp, 449static int kprobe_convert_to_perf_probe(struct probe_trace_point *tp,
@@ -409,6 +475,12 @@ int show_line_range(struct line_range *lr __unused)
409 return -ENOSYS; 475 return -ENOSYS;
410} 476}
411 477
478int show_available_vars(struct perf_probe_event *pevs __unused,
479 int npevs __unused, int max_probe_points __unused)
480{
481 pr_warning("Debuginfo-analysis is not supported.\n");
482 return -ENOSYS;
483}
412#endif 484#endif
413 485
414int parse_line_range_desc(const char *arg, struct line_range *lr) 486int parse_line_range_desc(const char *arg, struct line_range *lr)