Commit 951e273060d15b233a7f7ccaf76ba682b5b05a03
Exists in
ti-lsk-linux-4.1.y
and in
12 other branches
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fixes from Ingo Molnar: "Two last minute tooling fixes" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf probe: Fix perf probe to find correct variable DIE perf probe: Fix a segfault if asked for variable it doesn't find
Showing 2 changed files Side-by-side Diff
tools/perf/util/dwarf-aux.c
... | ... | @@ -747,14 +747,17 @@ |
747 | 747 | static int __die_find_variable_cb(Dwarf_Die *die_mem, void *data) |
748 | 748 | { |
749 | 749 | struct __find_variable_param *fvp = data; |
750 | + Dwarf_Attribute attr; | |
750 | 751 | int tag; |
751 | 752 | |
752 | 753 | tag = dwarf_tag(die_mem); |
753 | 754 | if ((tag == DW_TAG_formal_parameter || |
754 | 755 | tag == DW_TAG_variable) && |
755 | - die_compare_name(die_mem, fvp->name)) | |
756 | + die_compare_name(die_mem, fvp->name) && | |
757 | + /* Does the DIE have location information or external instance? */ | |
758 | + (dwarf_attr(die_mem, DW_AT_external, &attr) || | |
759 | + dwarf_attr(die_mem, DW_AT_location, &attr))) | |
756 | 760 | return DIE_FIND_CB_END; |
757 | - | |
758 | 761 | if (dwarf_haspc(die_mem, fvp->addr)) |
759 | 762 | return DIE_FIND_CB_CONTINUE; |
760 | 763 | else |
tools/perf/util/probe-finder.c
... | ... | @@ -511,12 +511,12 @@ |
511 | 511 | |
512 | 512 | ret = convert_variable_location(vr_die, pf->addr, pf->fb_ops, |
513 | 513 | &pf->sp_die, pf->tvar); |
514 | - if (ret == -ENOENT) | |
514 | + if (ret == -ENOENT || ret == -EINVAL) | |
515 | 515 | pr_err("Failed to find the location of %s at this address.\n" |
516 | 516 | " Perhaps, it has been optimized out.\n", pf->pvar->var); |
517 | 517 | else if (ret == -ENOTSUP) |
518 | 518 | pr_err("Sorry, we don't support this variable location yet.\n"); |
519 | - else if (pf->pvar->field) { | |
519 | + else if (ret == 0 && pf->pvar->field) { | |
520 | 520 | ret = convert_variable_fields(vr_die, pf->pvar->var, |
521 | 521 | pf->pvar->field, &pf->tvar->ref, |
522 | 522 | &die_mem); |