diff options
| author | Ingo Molnar <mingo@kernel.org> | 2014-06-05 03:52:41 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2014-06-05 03:54:01 -0400 |
| commit | 22c91aa23547a4363fd2a9ffddde95c899ac8aa0 (patch) | |
| tree | 648fee735705223f91784767acfd27cb90214b14 | |
| parent | fad01e866afdbe01a1f3ec06a39c3a8b9e197014 (diff) | |
| parent | 082f96a93eb5ba9bf771518a0dda590624568e8e (diff) | |
Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf into perf/urgent
Pull perf/urgent fixes from Jiri Olsa:
* Fix perf probe to find correct variable DIE (Masami Hiramatsu)
* Fix a segfault in perf probe if asked for variable it doesn't find (Masami Hiramatsu)
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
| -rw-r--r-- | tools/perf/util/dwarf-aux.c | 7 | ||||
| -rw-r--r-- | tools/perf/util/probe-finder.c | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c index 7defd77105d0..cc66c4049e09 100644 --- a/tools/perf/util/dwarf-aux.c +++ b/tools/perf/util/dwarf-aux.c | |||
| @@ -747,14 +747,17 @@ struct __find_variable_param { | |||
| 747 | static int __die_find_variable_cb(Dwarf_Die *die_mem, void *data) | 747 | static int __die_find_variable_cb(Dwarf_Die *die_mem, void *data) |
| 748 | { | 748 | { |
| 749 | struct __find_variable_param *fvp = data; | 749 | struct __find_variable_param *fvp = data; |
| 750 | Dwarf_Attribute attr; | ||
| 750 | int tag; | 751 | int tag; |
| 751 | 752 | ||
| 752 | tag = dwarf_tag(die_mem); | 753 | tag = dwarf_tag(die_mem); |
| 753 | if ((tag == DW_TAG_formal_parameter || | 754 | if ((tag == DW_TAG_formal_parameter || |
| 754 | tag == DW_TAG_variable) && | 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 | return DIE_FIND_CB_END; | 760 | return DIE_FIND_CB_END; |
| 757 | |||
| 758 | if (dwarf_haspc(die_mem, fvp->addr)) | 761 | if (dwarf_haspc(die_mem, fvp->addr)) |
| 759 | return DIE_FIND_CB_CONTINUE; | 762 | return DIE_FIND_CB_CONTINUE; |
| 760 | else | 763 | else |
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 562762117639..9d8eb26f0533 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c | |||
| @@ -511,12 +511,12 @@ static int convert_variable(Dwarf_Die *vr_die, struct probe_finder *pf) | |||
| 511 | 511 | ||
| 512 | ret = convert_variable_location(vr_die, pf->addr, pf->fb_ops, | 512 | ret = convert_variable_location(vr_die, pf->addr, pf->fb_ops, |
| 513 | &pf->sp_die, pf->tvar); | 513 | &pf->sp_die, pf->tvar); |
| 514 | if (ret == -ENOENT) | 514 | if (ret == -ENOENT || ret == -EINVAL) |
| 515 | pr_err("Failed to find the location of %s at this address.\n" | 515 | pr_err("Failed to find the location of %s at this address.\n" |
| 516 | " Perhaps, it has been optimized out.\n", pf->pvar->var); | 516 | " Perhaps, it has been optimized out.\n", pf->pvar->var); |
| 517 | else if (ret == -ENOTSUP) | 517 | else if (ret == -ENOTSUP) |
| 518 | pr_err("Sorry, we don't support this variable location yet.\n"); | 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 | ret = convert_variable_fields(vr_die, pf->pvar->var, | 520 | ret = convert_variable_fields(vr_die, pf->pvar->var, |
| 521 | pf->pvar->field, &pf->tvar->ref, | 521 | pf->pvar->field, &pf->tvar->ref, |
| 522 | &die_mem); | 522 | &die_mem); |
