Lines Matching +full:x +full:- +full:tal
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * builtin-probe.c
21 #include "util/build-id.h"
26 #include <subcmd/parse-options.h>
27 #include "util/probe-finder.h"
28 #include "util/probe-event.h"
29 #include "util/probe-file.h"
58 pr_debug("probe-definition(%d): %s\n", params.nevents, str); in parse_probe_event()
61 return -1; in parse_probe_event()
64 pev->uprobes = params.uprobes; in parse_probe_event()
66 pev->target = strdup(params.target); in parse_probe_event()
67 if (!pev->target) in parse_probe_event()
68 return -ENOMEM; in parse_probe_event()
72 pev->nsi = nsinfo__get(params.nsi); in parse_probe_event()
74 /* Parse a perf-probe command into event */ in parse_probe_event()
76 pr_debug("%d arguments\n", pev->nargs); in parse_probe_event()
90 ret = err ? -EINVAL : -ENOMEM; in params_add_filter()
94 if (ret == -EINVAL) { in params_add_filter()
95 pr_err("Filter parse error at %td.\n", err - str + 1); in params_add_filter()
97 pr_err(" %*c\n", (int)(err - str + 1), '^'); in params_add_filter()
118 return -ENOMEM; in set_target()
122 buf = ptr + (strlen(ptr) - 3); in set_target()
154 return -ENOMEM; in parse_probe_event_argv()
170 int ret = -ENOENT; in opt_set_target()
174 if (!strcmp(opt->long_name, "exec")) in opt_set_target()
176 else if (!strcmp(opt->long_name, "module")) in opt_set_target()
191 return -ENOMEM; in opt_set_target()
205 int ret = -ENOENT; in opt_set_target_ns()
213 ret = -errno; in opt_set_target_ns()
219 if (nsip && nsip->need_setns) in opt_set_target_ns()
242 pr_warning("Warning: more than one --line options are" in opt_show_lines()
247 params.command = opt->short_name; in opt_show_lines()
263 if (!ret && pev->nargs != 0) { in opt_show_vars()
264 pr_err(" Error: '--vars' doesn't accept arguments.\n"); in opt_show_vars()
265 return -EINVAL; in opt_show_vars()
267 params.command = opt->short_name; in opt_show_vars()
279 params.command = opt->short_name; in opt_add_probe_event()
290 params.command = opt->short_name; in opt_set_filter_with_command()
331 str_error_r(-err, sbuf, sizeof(sbuf)), err); in pr_err_with_code()
341 ret = init_probe_symbol_maps(pevs->uprobes); in perf_add_probe_events()
365 for (k = 0; k < pev->ntevs; k++) { in perf_add_probe_events()
366 struct probe_trace_event *tev = &pev->tevs[k]; in perf_add_probe_events()
368 if (!tev->event) in perf_add_probe_events()
372 show_perf_probe_event(tev->group, tev->event, pev, in perf_add_probe_events()
373 tev->point.module, false); in perf_add_probe_events()
376 event = tev->event; in perf_add_probe_events()
377 group = tev->group; in perf_add_probe_events()
385 pr_info("\tperf record -e %s:%s -aR sleep 1\n\n", group, event); in perf_add_probe_events()
403 ret = -errno; in del_perf_probe_caches()
405 return ret ?: -ENOMEM; in del_perf_probe_caches()
409 cache = probe_cache__new(nd->s, NULL); in del_perf_probe_caches()
414 pr_warning("Failed to remove entries for %s\n", nd->s); in del_perf_probe_caches()
422 int ret, ret2, ufd = -1, kfd = -1; in perf_del_probe_events()
428 return -EINVAL; in perf_del_probe_events()
443 ret = -ENOMEM; in perf_del_probe_events()
450 pr_info("Removed event: %s\n", ent->s); in perf_del_probe_events()
455 } else if (ret == -ENOMEM) in perf_del_probe_events()
461 pr_info("Removed event: %s\n", ent->s); in perf_del_probe_events()
466 } else if (ret2 == -ENOMEM) in perf_del_probe_events()
469 if (ret == -ENOENT && ret2 == -ENOENT) in perf_del_probe_events()
500 "perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]", in __cmd_probe()
501 "perf probe [<options>] --del '[GROUP:]EVENT' ...", in __cmd_probe()
502 "perf probe --list [GROUP:]EVENT ...", in __cmd_probe()
504 "perf probe [<options>] --line 'LINEDESC'", in __cmd_probe()
505 "perf probe [<options>] --vars 'PROBEPOINT'", in __cmd_probe()
507 "perf probe [<options>] --funcs", in __cmd_probe()
530 "\t\tAL:\tAbsolute line number in file.\n" in __cmd_probe()
533 "\t\t\tkprobe-tracer argument format.)\n", in __cmd_probe()
535 "\t\tARG:\tProbe argument (kprobe-tracer argument format.)\n", in __cmd_probe()
544 "FUNC[:RLN[+NUM|-RLN2]]|SRC:ALN[+NUM|-ALN2]", in __cmd_probe()
550 "Show external variables too (with --vars only)"), in __cmd_probe()
552 "Show variables location range in scope (with --vars only)"), in __cmd_probe()
557 OPT_BOOLEAN('\0', "no-inlines", &probe_conf.no_inlines, in __cmd_probe()
560 OPT_INTEGER('\0', "max-probes", &probe_conf.max_probes, in __cmd_probe()
563 "Show potential probe-able functions.", in __cmd_probe()
566 "[!]FILTER", "Set a filter (with --vars/funcs only)\n" in __cmd_probe()
567 "\t\t\t(default: \"" DEFAULT_VAR_FILTER "\" for --vars,\n" in __cmd_probe()
568 "\t\t\t \"" DEFAULT_FUNC_FILTER "\" for --funcs)", in __cmd_probe()
570 OPT_CALLBACK('x', "exec", NULL, "executable|path", in __cmd_probe()
577 OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel, in __cmd_probe()
582 OPT_CALLBACK(0, "target-ns", NULL, "pid", in __cmd_probe()
603 set_nobuild('\0', "no-inlines", true); in __cmd_probe()
611 if (strcmp(argv[0], "-") == 0) { in __cmd_probe()
613 "'-' is not supported.\n"); in __cmd_probe()
617 "another command except --add is set.\n"); in __cmd_probe()
629 pr_err(" Error: -v and -q are exclusive.\n"); in __cmd_probe()
630 return -EINVAL; in __cmd_probe()
632 verbose = -1; in __cmd_probe()
644 * Except for --list, --del and --add, other command doesn't depend in __cmd_probe()
654 pr_err(" Error: Don't use --list with --exec.\n"); in __cmd_probe()
656 parse_options_usage(NULL, options, "x", true); in __cmd_probe()
657 return -EINVAL; in __cmd_probe()
699 pr_err(" Error: -x/-m must follow the probe definitions.\n"); in __cmd_probe()
701 parse_options_usage(NULL, options, "x", true); in __cmd_probe()
702 return -EINVAL; in __cmd_probe()