Lines Matching refs:pev
423 struct perf_probe_event *pev, in get_alternative_probe_event() argument
428 memcpy(tmp, &pev->point, sizeof(*tmp)); in get_alternative_probe_event()
429 memset(&pev->point, 0, sizeof(pev->point)); in get_alternative_probe_event()
430 ret = find_alternative_probe_point(dinfo, tmp, &pev->point, pev->target, in get_alternative_probe_event()
431 pev->nsi, pev->uprobes); in get_alternative_probe_event()
433 memcpy(&pev->point, tmp, sizeof(*tmp)); in get_alternative_probe_event()
869 arch__post_process_probe_trace_events(struct perf_probe_event *pev __maybe_unused, in arch__post_process_probe_trace_events()
875 static int post_process_probe_trace_events(struct perf_probe_event *pev, in post_process_probe_trace_events() argument
884 pev->nsi); in post_process_probe_trace_events()
893 arch__post_process_probe_trace_events(pev, ntevs); in post_process_probe_trace_events()
899 static int try_to_find_probe_trace_events(struct perf_probe_event *pev, in try_to_find_probe_trace_events() argument
902 bool need_dwarf = perf_probe_event_need_dwarf(pev); in try_to_find_probe_trace_events()
914 if (pev->point.retprobe) in try_to_find_probe_trace_events()
917 dinfo = open_debuginfo(pev->target, pev->nsi, !need_dwarf); in try_to_find_probe_trace_events()
927 ntevs = debuginfo__find_trace_events(dinfo, pev, tevs); in try_to_find_probe_trace_events()
930 ret = get_alternative_probe_event(dinfo, pev, &tmp); in try_to_find_probe_trace_events()
932 ntevs = debuginfo__find_trace_events(dinfo, pev, tevs); in try_to_find_probe_trace_events()
937 clear_perf_probe_point(&pev->point); in try_to_find_probe_trace_events()
938 memcpy(&pev->point, &tmp, sizeof(tmp)); in try_to_find_probe_trace_events()
944 ret = post_process_probe_trace_events(pev, *tevs, ntevs, in try_to_find_probe_trace_events()
945 pev->target, pev->uprobes, dinfo); in try_to_find_probe_trace_events()
958 synthesize_perf_probe_point(&pev->point)); in try_to_find_probe_trace_events()
1137 struct perf_probe_event *pev, in show_available_vars_at() argument
1147 buf = synthesize_perf_probe_point(&pev->point); in show_available_vars_at()
1152 ret = debuginfo__find_available_vars_at(dinfo, pev, &vls); in show_available_vars_at()
1154 ret = get_alternative_probe_event(dinfo, pev, &tmp); in show_available_vars_at()
1156 ret = debuginfo__find_available_vars_at(dinfo, pev, in show_available_vars_at()
1244 static int try_to_find_probe_trace_events(struct perf_probe_event *pev, in try_to_find_probe_trace_events() argument
1247 if (perf_probe_event_need_dwarf(pev)) { in try_to_find_probe_trace_events()
1401 static int parse_perf_probe_event_name(char **arg, struct perf_probe_event *pev) in parse_perf_probe_event_name() argument
1408 if (!pev->sdt && !is_c_func_name(*arg)) in parse_perf_probe_event_name()
1410 pev->group = strdup_esc(*arg); in parse_perf_probe_event_name()
1411 if (!pev->group) in parse_perf_probe_event_name()
1415 pev->group = NULL; in parse_perf_probe_event_name()
1417 pev->event = strdup_esc(*arg); in parse_perf_probe_event_name()
1418 if (pev->event == NULL) in parse_perf_probe_event_name()
1421 if (!pev->sdt && !is_c_func_name(pev->event)) { in parse_perf_probe_event_name()
1422 zfree(&pev->event); in parse_perf_probe_event_name()
1424 zfree(&pev->group); in parse_perf_probe_event_name()
1433 static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev) in parse_perf_probe_point() argument
1435 struct perf_probe_point *pp = &pev->point; in parse_perf_probe_point()
1451 pev->sdt = true; in parse_perf_probe_point()
1457 if (pev->sdt) { in parse_perf_probe_point()
1467 pev->target = build_id_cache__origname(tmp); in parse_perf_probe_point()
1470 pev->target = strdup_esc(ptr + 1); in parse_perf_probe_point()
1471 if (!pev->target) in parse_perf_probe_point()
1475 ret = parse_perf_probe_event_name(&arg, pev); in parse_perf_probe_point()
1477 if (asprintf(&pev->point.function, "%%%s", pev->event) < 0) in parse_perf_probe_point()
1486 ret = parse_perf_probe_event_name(&arg, pev); in parse_perf_probe_point()
1757 int parse_perf_probe_command(const char *cmd, struct perf_probe_event *pev) in parse_perf_probe_command() argument
1773 ret = parse_perf_probe_point(argv[0], pev); in parse_perf_probe_command()
1778 if (!pev->event && pev->point.function && pev->point.line in parse_perf_probe_command()
1779 && !pev->point.lazy_line && !pev->point.offset) { in parse_perf_probe_command()
1780 if (asprintf(&pev->event, "%s_L%d", pev->point.function, in parse_perf_probe_command()
1781 pev->point.line) < 0) { in parse_perf_probe_command()
1788 pev->nargs = argc - 1; in parse_perf_probe_command()
1789 pev->args = zalloc(sizeof(struct perf_probe_arg) * pev->nargs); in parse_perf_probe_command()
1790 if (pev->args == NULL) { in parse_perf_probe_command()
1794 for (i = 0; i < pev->nargs && ret >= 0; i++) { in parse_perf_probe_command()
1795 ret = parse_perf_probe_arg(argv[i + 1], &pev->args[i]); in parse_perf_probe_command()
1797 is_c_varname(pev->args[i].var) && pev->point.retprobe) { in parse_perf_probe_command()
1810 bool perf_probe_with_var(struct perf_probe_event *pev) in perf_probe_with_var() argument
1814 for (i = 0; i < pev->nargs; i++) in perf_probe_with_var()
1815 if (is_c_varname(pev->args[i].var) || in perf_probe_with_var()
1816 !strcmp(pev->args[i].var, PROBE_ARG_PARAMS) || in perf_probe_with_var()
1817 !strcmp(pev->args[i].var, PROBE_ARG_VARS)) in perf_probe_with_var()
1823 bool perf_probe_event_need_dwarf(struct perf_probe_event *pev) in perf_probe_event_need_dwarf() argument
1825 if (pev->point.file || pev->point.line || pev->point.lazy_line) in perf_probe_event_need_dwarf()
1828 if (perf_probe_with_var(pev)) in perf_probe_event_need_dwarf()
2044 char *synthesize_perf_probe_command(struct perf_probe_event *pev) in synthesize_perf_probe_command() argument
2052 if (pev->event) in synthesize_perf_probe_command()
2053 if (strbuf_addf(&buf, "%s:%s=", pev->group ?: PERFPROBE_GROUP, in synthesize_perf_probe_command()
2054 pev->event) < 0) in synthesize_perf_probe_command()
2057 tmp = synthesize_perf_probe_point(&pev->point); in synthesize_perf_probe_command()
2062 for (i = 0; i < pev->nargs; i++) { in synthesize_perf_probe_command()
2063 tmp = synthesize_perf_probe_arg(pev->args + i); in synthesize_perf_probe_command()
2292 struct perf_probe_event *pev, bool is_kprobe) in convert_to_perf_probe_event() argument
2298 pev->event = strdup(tev->event); in convert_to_perf_probe_event()
2299 pev->group = strdup(tev->group); in convert_to_perf_probe_event()
2300 if (pev->event == NULL || pev->group == NULL) in convert_to_perf_probe_event()
2304 ret = convert_to_perf_probe_point(&tev->point, &pev->point, is_kprobe); in convert_to_perf_probe_event()
2309 pev->nargs = tev->nargs; in convert_to_perf_probe_event()
2310 pev->args = zalloc(sizeof(struct perf_probe_arg) * pev->nargs); in convert_to_perf_probe_event()
2311 if (pev->args == NULL) in convert_to_perf_probe_event()
2315 pev->args[i].name = strdup(tev->args[i].name); in convert_to_perf_probe_event()
2320 pev->args[i].name = strbuf_detach(&buf, NULL); in convert_to_perf_probe_event()
2322 if (pev->args[i].name == NULL && ret >= 0) in convert_to_perf_probe_event()
2327 clear_perf_probe_event(pev); in convert_to_perf_probe_event()
2332 void clear_perf_probe_event(struct perf_probe_event *pev) in clear_perf_probe_event() argument
2337 zfree(&pev->event); in clear_perf_probe_event()
2338 zfree(&pev->group); in clear_perf_probe_event()
2339 zfree(&pev->target); in clear_perf_probe_event()
2340 clear_perf_probe_point(&pev->point); in clear_perf_probe_event()
2342 for (i = 0; i < pev->nargs; i++) { in clear_perf_probe_event()
2343 zfree(&pev->args[i].name); in clear_perf_probe_event()
2344 zfree(&pev->args[i].var); in clear_perf_probe_event()
2345 zfree(&pev->args[i].type); in clear_perf_probe_event()
2346 field = pev->args[i].field; in clear_perf_probe_event()
2354 pev->nargs = 0; in clear_perf_probe_event()
2355 zfree(&pev->args); in clear_perf_probe_event()
2566 struct perf_probe_event *pev, in perf_probe_event__sprintf() argument
2581 buf = synthesize_perf_probe_point(&pev->point); in perf_probe_event__sprintf()
2590 if (!ret && pev->nargs > 0) { in perf_probe_event__sprintf()
2592 for (i = 0; !ret && i < pev->nargs; i++) { in perf_probe_event__sprintf()
2593 buf = synthesize_perf_probe_arg(&pev->args[i]); in perf_probe_event__sprintf()
2608 struct perf_probe_event *pev, in show_perf_probe_event() argument
2614 ret = perf_probe_event__sprintf(group, event, pev, module, &buf); in show_perf_probe_event()
2646 struct perf_probe_event pev; in __show_perf_probe_events() local
2651 memset(&pev, 0, sizeof(pev)); in __show_perf_probe_events()
2662 ret = convert_to_perf_probe_event(&tev, &pev, in __show_perf_probe_events()
2666 ret = show_perf_probe_event(pev.group, pev.event, in __show_perf_probe_events()
2667 &pev, tev.point.module, in __show_perf_probe_events()
2671 clear_perf_probe_event(&pev); in __show_perf_probe_events()
2809 struct perf_probe_event *pev, in probe_trace_event__set_name() argument
2818 if (pev->event && !pev->sdt) in probe_trace_event__set_name()
2819 event = pev->event; in probe_trace_event__set_name()
2824 if (pev->point.function && in probe_trace_event__set_name()
2825 (strncmp(pev->point.function, "0x", 2) != 0) && in probe_trace_event__set_name()
2826 !strisglob(pev->point.function)) in probe_trace_event__set_name()
2827 event = pev->point.function; in probe_trace_event__set_name()
2831 if (pev->group && !pev->sdt) in probe_trace_event__set_name()
2832 group = pev->group; in probe_trace_event__set_name()
2880 static int __add_probe_trace_events(struct perf_probe_event *pev, in __add_probe_trace_events() argument
2890 up = pev->uprobes ? 1 : 0; in __add_probe_trace_events()
2906 if (!tev->point.symbol && !pev->uprobes) in __add_probe_trace_events()
2910 ret = probe_trace_event__set_name(tev, pev, namelist[up], in __add_probe_trace_events()
2915 nsinfo__mountns_enter(pev->nsi, &nsc); in __add_probe_trace_events()
2929 if (ret == -EINVAL && pev->uprobes) in __add_probe_trace_events()
2932 cache = probe_cache__new(pev->target, pev->nsi); in __add_probe_trace_events()
2934 probe_cache__add_entry(cache, pev, tevs, ntevs) < 0 || in __add_probe_trace_events()
2994 void __weak arch__fix_tev_from_maps(struct perf_probe_event *pev __maybe_unused, in arch__fix_tev_from_maps()
3014 static int find_probe_trace_events_from_map(struct perf_probe_event *pev, in find_probe_trace_events_from_map() argument
3022 struct perf_probe_point *pp = &pev->point; in find_probe_trace_events_from_map()
3028 map = get_target_map(pev->target, pev->nsi, pev->uprobes); in find_probe_trace_events_from_map()
3048 pev->target ?: "/proc/kallsyms"); in find_probe_trace_events_from_map()
3049 if (pev->target) in find_probe_trace_events_from_map()
3055 pev->target ? : "kernel"); in find_probe_trace_events_from_map()
3060 pev->target ? : "kernel"); in find_probe_trace_events_from_map()
3066 if (!pev->uprobes && !pev->target && in find_probe_trace_events_from_map()
3122 if (!pev->uprobes && !pev->target && in find_probe_trace_events_from_map()
3136 if (pev->target) { in find_probe_trace_events_from_map()
3137 if (pev->uprobes) { in find_probe_trace_events_from_map()
3138 tev->point.module = strdup_or_goto(pev->target, in find_probe_trace_events_from_map()
3141 mod_name = find_module_name(pev->target); in find_probe_trace_events_from_map()
3143 strdup(mod_name ? mod_name : pev->target); in find_probe_trace_events_from_map()
3149 tev->uprobes = pev->uprobes; in find_probe_trace_events_from_map()
3150 tev->nargs = pev->nargs; in find_probe_trace_events_from_map()
3158 if (pev->args[i].name) in find_probe_trace_events_from_map()
3160 strdup_or_goto(pev->args[i].name, in find_probe_trace_events_from_map()
3163 tev->args[i].value = strdup_or_goto(pev->args[i].var, in find_probe_trace_events_from_map()
3165 if (pev->args[i].type) in find_probe_trace_events_from_map()
3167 strdup_or_goto(pev->args[i].type, in find_probe_trace_events_from_map()
3170 arch__fix_tev_from_maps(pev, tev, map, sym); in find_probe_trace_events_from_map()
3190 static int try_to_find_absolute_address(struct perf_probe_event *pev, in try_to_find_absolute_address() argument
3193 struct perf_probe_point *pp = &pev->point; in try_to_find_absolute_address()
3198 if (!(pev->point.function && !strncmp(pev->point.function, "0x", 2))) in try_to_find_absolute_address()
3200 if (perf_probe_event_need_dwarf(pev)) in try_to_find_absolute_address()
3221 tp->address = pev->point.abs_address; in try_to_find_absolute_address()
3223 tev->uprobes = pev->uprobes; in try_to_find_absolute_address()
3245 if (pev->target) { in try_to_find_absolute_address()
3246 tp->module = strdup(pev->target); in try_to_find_absolute_address()
3252 tev->group = strdup(pev->group); in try_to_find_absolute_address()
3257 if (pev->event) { in try_to_find_absolute_address()
3258 tev->event = strdup(pev->event); in try_to_find_absolute_address()
3263 tev->nargs = pev->nargs; in try_to_find_absolute_address()
3269 copy_to_probe_trace_arg(&tev->args[i], &pev->args[i]); in try_to_find_absolute_address()
3331 static int find_cached_events(struct perf_probe_event *pev, in find_cached_events() argument
3341 cache = probe_cache__new(target, pev->nsi); in find_cached_events()
3348 if (!entry->pev.event || !entry->pev.group) in find_cached_events()
3350 if ((!pev->group || strglobmatch(entry->pev.group, pev->group)) && in find_cached_events()
3351 strglobmatch(entry->pev.event, pev->event)) { in find_cached_events()
3367 pev->uprobes = true; in find_cached_events()
3374 static int find_cached_events_all(struct perf_probe_event *pev, in find_cached_events_all() argument
3395 ret = find_cached_events(pev, &tmp_tevs, pathname); in find_cached_events_all()
3415 static int find_probe_trace_events_from_cache(struct perf_probe_event *pev, in find_probe_trace_events_from_cache() argument
3424 if (pev->sdt) { in find_probe_trace_events_from_cache()
3426 if (!pev->target) in find_probe_trace_events_from_cache()
3427 return find_cached_events_all(pev, tevs); in find_probe_trace_events_from_cache()
3429 return find_cached_events(pev, tevs, pev->target); in find_probe_trace_events_from_cache()
3431 cache = probe_cache__new(pev->target, pev->nsi); in find_probe_trace_events_from_cache()
3435 entry = probe_cache__find(cache, pev); in find_probe_trace_events_from_cache()
3438 ret = pev->sdt ? -ENOENT : 0; in find_probe_trace_events_from_cache()
3445 pev->target ? : "kernel"); in find_probe_trace_events_from_cache()
3463 tev->uprobes = pev->uprobes; in find_probe_trace_events_from_cache()
3472 static int convert_to_probe_trace_events(struct perf_probe_event *pev, in convert_to_probe_trace_events() argument
3477 if (!pev->group && !pev->sdt) { in convert_to_probe_trace_events()
3479 if (!pev->uprobes) { in convert_to_probe_trace_events()
3480 pev->group = strdup(PERFPROBE_GROUP); in convert_to_probe_trace_events()
3481 ret = pev->group ? 0 : -ENOMEM; in convert_to_probe_trace_events()
3483 ret = convert_exec_to_group(pev->target, &pev->group); in convert_to_probe_trace_events()
3490 ret = try_to_find_absolute_address(pev, tevs); in convert_to_probe_trace_events()
3495 ret = find_probe_trace_events_from_cache(pev, tevs); in convert_to_probe_trace_events()
3496 if (ret > 0 || pev->sdt) /* SDT can be found only in the cache */ in convert_to_probe_trace_events()
3500 ret = try_to_find_probe_trace_events(pev, tevs); in convert_to_probe_trace_events()
3504 return find_probe_trace_events_from_map(pev, tevs); in convert_to_probe_trace_events()
3548 struct perf_probe_event *pev; in show_probe_trace_events() local
3555 pev = &pevs[j]; in show_probe_trace_events()
3556 for (i = 0; i < pev->ntevs && !ret; i++) { in show_probe_trace_events()
3557 tev = &pev->tevs[i]; in show_probe_trace_events()
3559 if (!tev->point.symbol && !pev->uprobes) in show_probe_trace_events()
3563 ret = probe_trace_event__set_name(tev, pev, in show_probe_trace_events()
3603 struct perf_probe_event *pev; in show_bootconfig_events() local
3611 pev = &pevs[j]; in show_bootconfig_events()
3612 if (pev->group && strcmp(pev->group, "probe")) in show_bootconfig_events()
3613 pr_warning("WARN: Group name %s is ignored\n", pev->group); in show_bootconfig_events()
3614 if (pev->uprobes) { in show_bootconfig_events()
3619 for (i = 0; i < pev->ntevs && !ret; i++) { in show_bootconfig_events()
3620 tev = &pev->tevs[i]; in show_bootconfig_events()
3622 if (!tev->point.symbol && !pev->uprobes) in show_bootconfig_events()
3626 ret = probe_trace_event__set_name(tev, pev, in show_bootconfig_events()
3664 struct perf_probe_event *pev; in cleanup_perf_probe_events() local
3668 pev = &pevs[i]; in cleanup_perf_probe_events()
3673 nsinfo__zput(pev->nsi); in cleanup_perf_probe_events()