• Home
  • Raw
  • Download

Lines Matching refs:pf

560 static int convert_variable(Dwarf_Die *vr_die, struct probe_finder *pf)  in convert_variable()  argument
568 ret = convert_variable_location(vr_die, pf->addr, pf->fb_ops, in convert_variable()
569 &pf->sp_die, pf->machine, pf->tvar); in convert_variable()
570 if (ret == -ENOENT && pf->skip_empty_arg) in convert_variable()
574 print_var_not_found(pf->pvar->var); in convert_variable()
577 else if (ret == 0 && pf->pvar->field) { in convert_variable()
578 ret = convert_variable_fields(vr_die, pf->pvar->var, in convert_variable()
579 pf->pvar->field, &pf->tvar->ref, in convert_variable()
580 &die_mem, pf->pvar->user_access); in convert_variable()
584 ret = convert_variable_type(vr_die, pf->tvar, pf->pvar->type, in convert_variable()
585 pf->pvar->user_access); in convert_variable()
591 static int find_variable(Dwarf_Die *sc_die, struct probe_finder *pf) in find_variable() argument
598 if (!is_c_varname(pf->pvar->var)) in find_variable()
599 return copy_to_probe_trace_arg(pf->tvar, pf->pvar); in find_variable()
601 if (pf->pvar->name) in find_variable()
602 pf->tvar->name = strdup(pf->pvar->name); in find_variable()
604 buf = synthesize_perf_probe_arg(pf->pvar); in find_variable()
610 pf->tvar->name = buf; in find_variable()
612 if (pf->tvar->name == NULL) in find_variable()
615 pr_debug("Searching '%s' variable in context.\n", pf->pvar->var); in find_variable()
617 if (!die_find_variable_at(sc_die, pf->pvar->var, pf->addr, &vr_die)) { in find_variable()
619 if (!die_find_variable_at(&pf->cu_die, pf->pvar->var, in find_variable()
621 if (pf->skip_empty_arg) in find_variable()
624 pf->pvar->var); in find_variable()
629 ret = convert_variable(&vr_die, pf); in find_variable()
687 static int call_probe_finder(Dwarf_Die *sc_die, struct probe_finder *pf) in call_probe_finder() argument
701 if (!die_find_realfunc(&pf->cu_die, pf->addr, &pf->sp_die)) { in call_probe_finder()
702 if (die_find_tailfunc(&pf->cu_die, pf->addr, &pf->sp_die)) { in call_probe_finder()
704 dwarf_diename(&pf->sp_die)); in call_probe_finder()
713 memcpy(&pf->sp_die, sc_die, sizeof(Dwarf_Die)); in call_probe_finder()
716 dwarf_attr(&pf->sp_die, DW_AT_frame_base, &fb_attr); in call_probe_finder()
717 ret = dwarf_getlocation_addr(&fb_attr, pf->addr, &pf->fb_ops, &nops, 1); in call_probe_finder()
719 pf->fb_ops = NULL; in call_probe_finder()
721 } else if (nops == 1 && pf->fb_ops[0].atom == DW_OP_call_frame_cfa && in call_probe_finder()
722 (pf->cfi_eh != NULL || pf->cfi_dbg != NULL)) { in call_probe_finder()
723 if ((dwarf_cfi_addrframe(pf->cfi_eh, pf->addr, &frame) != 0 && in call_probe_finder()
724 (dwarf_cfi_addrframe(pf->cfi_dbg, pf->addr, &frame) != 0)) || in call_probe_finder()
725 dwarf_frame_cfa(frame, &pf->fb_ops, &nops) != 0) { in call_probe_finder()
727 (uintmax_t)pf->addr); in call_probe_finder()
735 ret = pf->callback(sc_die, pf); in call_probe_finder()
739 pf->fb_ops = NULL; in call_probe_finder()
796 static Dwarf_Die *find_best_scope(struct probe_finder *pf, Dwarf_Die *die_mem) in find_best_scope() argument
799 .function = pf->pev->point.function, in find_best_scope()
800 .file = pf->fname, in find_best_scope()
801 .line = pf->lno, in find_best_scope()
808 ret = cu_walk_functions_at(&pf->cu_die, pf->addr, find_best_scope_cb, in find_best_scope()
811 cu_walk_functions_at(&pf->cu_die, pf->addr, in find_best_scope()
817 static int verify_representive_line(struct probe_finder *pf, const char *fname, in verify_representive_line() argument
825 if (cu_find_lineinfo(&pf->cu_die, addr, &__fname, &__lineno) < 0) in verify_representive_line()
834 if (pf->pev->point.function) { in verify_representive_line()
836 pf->addr = addr; in verify_representive_line()
837 if (find_best_scope(pf, &die_mem) in verify_representive_line()
838 && die_match_name(&die_mem, pf->pev->point.function) in verify_representive_line()
853 struct probe_finder *pf = data; in probe_point_line_walker() local
857 if (lineno != pf->lno || strtailcmp(fname, pf->fname) != 0) in probe_point_line_walker()
860 if (verify_representive_line(pf, fname, lineno, addr)) in probe_point_line_walker()
863 pf->addr = addr; in probe_point_line_walker()
864 sc_die = find_best_scope(pf, &die_mem); in probe_point_line_walker()
870 ret = call_probe_finder(sc_die, pf); in probe_point_line_walker()
877 static int find_probe_point_by_line(struct probe_finder *pf) in find_probe_point_by_line() argument
879 return die_walk_lines(&pf->cu_die, probe_point_line_walker, pf); in find_probe_point_by_line()
925 struct probe_finder *pf = data; in probe_point_lazy_walker() local
929 if (!intlist__has_entry(pf->lcache, lineno) || in probe_point_lazy_walker()
930 strtailcmp(fname, pf->fname) != 0) in probe_point_lazy_walker()
935 pf->addr = addr; in probe_point_lazy_walker()
936 pf->lno = lineno; in probe_point_lazy_walker()
937 sc_die = find_best_scope(pf, &die_mem); in probe_point_lazy_walker()
943 ret = call_probe_finder(sc_die, pf); in probe_point_lazy_walker()
953 static int find_probe_point_lazy(Dwarf_Die *sp_die, struct probe_finder *pf) in find_probe_point_lazy() argument
960 if (intlist__empty(pf->lcache)) { in find_probe_point_lazy()
963 comp_dir = cu_get_comp_dir(&pf->cu_die); in find_probe_point_lazy()
964 if (pf->dbg->build_id) { in find_probe_point_lazy()
965 build_id__init(&bid, pf->dbg->build_id, BUILD_ID_SIZE); in find_probe_point_lazy()
968 ret = find_source_path(pf->fname, sbuild_id, comp_dir, &fpath); in find_probe_point_lazy()
975 ret = find_lazy_match_lines(pf->lcache, fpath, in find_probe_point_lazy()
976 pf->pev->point.lazy_line); in find_probe_point_lazy()
982 return die_walk_lines(sp_die, probe_point_lazy_walker, pf); in find_probe_point_lazy()
985 static void skip_prologue(Dwarf_Die *sp_die, struct probe_finder *pf) in skip_prologue() argument
987 struct perf_probe_point *pp = &pf->pev->point; in skip_prologue()
990 if (!pf->pev->uprobes) in skip_prologue()
994 if (die_is_optimized_target(&pf->cu_die)) in skip_prologue()
998 if (!pf->addr) in skip_prologue()
1007 if (!perf_probe_with_var(pf->pev)) in skip_prologue()
1012 pf->addr); in skip_prologue()
1014 die_skip_prologue(sp_die, &pf->cu_die, &pf->addr); in skip_prologue()
1019 struct probe_finder *pf = data; in probe_point_inline_cb() local
1020 struct perf_probe_point *pp = &pf->pev->point; in probe_point_inline_cb()
1025 ret = find_probe_point_lazy(in_die, pf); in probe_point_inline_cb()
1038 pf->addr = addr; in probe_point_inline_cb()
1039 pf->addr += pp->offset; in probe_point_inline_cb()
1041 (uintmax_t)pf->addr); in probe_point_inline_cb()
1043 ret = call_probe_finder(in_die, pf); in probe_point_inline_cb()
1059 struct probe_finder *pf = param->data; in probe_point_search_cb() local
1060 struct perf_probe_point *pp = &pf->pev->point; in probe_point_search_cb()
1073 pf->fname = dwarf_decl_file(sp_die); in probe_point_search_cb()
1075 dwarf_decl_line(sp_die, &pf->lno); in probe_point_search_cb()
1076 pf->lno += pp->line; in probe_point_search_cb()
1077 param->retval = find_probe_point_by_line(pf); in probe_point_search_cb()
1080 die_entrypc(sp_die, &pf->addr); in probe_point_search_cb()
1082 if (pf->addr == 0) { in probe_point_search_cb()
1088 param->retval = find_probe_point_lazy(sp_die, pf); in probe_point_search_cb()
1090 skip_prologue(sp_die, pf); in probe_point_search_cb()
1091 pf->addr += pp->offset; in probe_point_search_cb()
1093 param->retval = call_probe_finder(sp_die, pf); in probe_point_search_cb()
1098 probe_point_inline_cb, (void *)pf); in probe_point_search_cb()
1113 static int find_probe_point_by_func(struct probe_finder *pf) in find_probe_point_by_func() argument
1115 struct dwarf_callback_param _param = {.data = (void *)pf, in find_probe_point_by_func()
1117 dwarf_getfuncs(&pf->cu_die, probe_point_search_cb, &_param, 0); in find_probe_point_by_func()
1154 struct probe_finder *pf) in debuginfo__find_probe_location() argument
1156 struct perf_probe_point *pp = &pf->pev->point; in debuginfo__find_probe_location()
1163 pf->lcache = intlist__new(NULL); in debuginfo__find_probe_location()
1164 if (!pf->lcache) in debuginfo__find_probe_location()
1172 .cu_die = &pf->cu_die, in debuginfo__find_probe_location()
1173 .sp_die = &pf->sp_die, in debuginfo__find_probe_location()
1177 .data = pf, in debuginfo__find_probe_location()
1183 ret = probe_point_search_cb(&pf->sp_die, &probe_param); in debuginfo__find_probe_location()
1192 diep = dwarf_offdie(dbg->dbg, off + cuhl, &pf->cu_die); in debuginfo__find_probe_location()
1198 pf->fname = cu_find_realpath(&pf->cu_die, pp->file); in debuginfo__find_probe_location()
1200 pf->fname = NULL; in debuginfo__find_probe_location()
1202 if (!pp->file || pf->fname) { in debuginfo__find_probe_location()
1204 ret = find_probe_point_by_func(pf); in debuginfo__find_probe_location()
1206 ret = find_probe_point_lazy(&pf->cu_die, pf); in debuginfo__find_probe_location()
1208 pf->lno = pp->line; in debuginfo__find_probe_location()
1209 ret = find_probe_point_by_line(pf); in debuginfo__find_probe_location()
1218 intlist__delete(pf->lcache); in debuginfo__find_probe_location()
1219 pf->lcache = NULL; in debuginfo__find_probe_location()
1226 struct probe_finder *pf) in debuginfo__find_probes() argument
1232 if (pf->cfi_eh || pf->cfi_dbg) in debuginfo__find_probes()
1233 return debuginfo__find_probe_location(dbg, pf); in debuginfo__find_probes()
1243 pf->machine = ehdr.e_machine; in debuginfo__find_probes()
1251 pf->cfi_eh = dwarf_getcfi_elf(elf); in debuginfo__find_probes()
1253 pf->cfi_dbg = dwarf_getcfi(dbg->dbg); in debuginfo__find_probes()
1257 ret = debuginfo__find_probe_location(dbg, pf); in debuginfo__find_probes()
1262 struct probe_finder *pf; member
1274 struct probe_finder *pf = vf->pf; in copy_variables_cb() local
1280 if (convert_variable_location(die_mem, vf->pf->addr, in copy_variables_cb()
1281 vf->pf->fb_ops, &pf->sp_die, in copy_variables_cb()
1282 pf->machine, NULL) == 0) { in copy_variables_cb()
1293 if (dwarf_haspc(die_mem, vf->pf->addr)) in copy_variables_cb()
1299 static int expand_probe_args(Dwarf_Die *sc_die, struct probe_finder *pf, in expand_probe_args() argument
1305 struct local_vars_finder vf = {.pf = pf, .args = args, .vars = false, in expand_probe_args()
1308 for (i = 0; i < pf->pev->nargs; i++) { in expand_probe_args()
1310 if (strcmp(pf->pev->args[i].var, PROBE_ARG_VARS) == 0) in expand_probe_args()
1312 else if (strcmp(pf->pev->args[i].var, PROBE_ARG_PARAMS) != 0) { in expand_probe_args()
1314 args[n] = pf->pev->args[i]; in expand_probe_args()
1318 pr_debug("Expanding %s into:", pf->pev->args[i].var); in expand_probe_args()
1336 if (tf->pf.addr == tf->tevs[i].point.address) in trace_event_finder_overlap()
1343 static int add_probe_trace_event(Dwarf_Die *sc_die, struct probe_finder *pf) in add_probe_trace_event() argument
1346 container_of(pf, struct trace_event_finder, pf); in add_probe_trace_event()
1347 struct perf_probe_point *pp = &pf->pev->point; in add_probe_trace_event()
1369 ret = convert_to_trace_point(&pf->sp_die, tf->mod, pf->addr, in add_probe_trace_event()
1390 ret = expand_probe_args(sc_die, pf, args); in add_probe_trace_event()
1403 pf->pvar = &args[i]; in add_probe_trace_event()
1404 pf->tvar = &tev->args[i]; in add_probe_trace_event()
1406 ret = find_variable(sc_die, pf); in add_probe_trace_event()
1467 .pf = {.pev = pev, .dbg = dbg, .callback = add_probe_trace_event}, in debuginfo__find_trace_events()
1480 tf.pf.skip_empty_arg = true; in debuginfo__find_trace_events()
1482 ret = debuginfo__find_probes(dbg, &tf.pf); in debuginfo__find_trace_events()
1483 if (ret >= 0 && tf.pf.skip_empty_arg) in debuginfo__find_trace_events()
1509 ret = convert_variable_location(die_mem, af->pf.addr, in collect_variables_cb()
1510 af->pf.fb_ops, &af->pf.sp_die, in collect_variables_cb()
1511 af->pf.machine, NULL); in collect_variables_cb()
1535 ret2 = die_get_var_range(&af->pf.sp_die, in collect_variables_cb()
1548 if (af->child && dwarf_haspc(die_mem, af->pf.addr)) in collect_variables_cb()
1563 if (af->pf.addr == af->vls[i].point.address) in available_var_finder_overlap()
1571 static int add_available_vars(Dwarf_Die *sc_die, struct probe_finder *pf) in add_available_vars() argument
1574 container_of(pf, struct available_var_finder, pf); in add_available_vars()
1575 struct perf_probe_point *pp = &pf->pev->point; in add_available_vars()
1596 ret = convert_to_trace_point(&pf->sp_die, af->mod, pf->addr, in add_available_vars()
1616 die_find_child(&pf->cu_die, collect_variables_cb, (void *)af, &die_mem); in add_available_vars()
1637 .pf = {.pev = pev, .dbg = dbg, .callback = add_available_vars}, in debuginfo__find_available_vars_at()
1650 ret = debuginfo__find_probes(dbg, &af.pf); in debuginfo__find_available_vars_at()