mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
perf tools: Fix report -F abort for data without branch info
The branch field sorting code assumes hist_entry::branch_info is allocated, which is wrong and following perf session ends up with report segfault. $ perf record ls $ perf report -F abort perf: Segmentation fault Checking that hist_entry::branch_info is valid and display "N/A" string in snprint callback if it's not. Signed-off-by: Jiri Olsa <[email protected]> Acked-by: Namhyung Kim <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Corey Ashford <[email protected]> Cc: David Ahern <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
parent
493c303133
commit
49f4744307
1 changed files with 11 additions and 3 deletions
|
|
@ -989,6 +989,9 @@ struct sort_entry sort_mem_dcacheline = {
|
|||
static int64_t
|
||||
sort__abort_cmp(struct hist_entry *left, struct hist_entry *right)
|
||||
{
|
||||
if (!left->branch_info || !right->branch_info)
|
||||
return cmp_null(left->branch_info, right->branch_info);
|
||||
|
||||
return left->branch_info->flags.abort !=
|
||||
right->branch_info->flags.abort;
|
||||
}
|
||||
|
|
@ -996,10 +999,15 @@ sort__abort_cmp(struct hist_entry *left, struct hist_entry *right)
|
|||
static int hist_entry__abort_snprintf(struct hist_entry *he, char *bf,
|
||||
size_t size, unsigned int width)
|
||||
{
|
||||
static const char *out = ".";
|
||||
static const char *out = "N/A";
|
||||
|
||||
if (he->branch_info) {
|
||||
if (he->branch_info->flags.abort)
|
||||
out = "A";
|
||||
else
|
||||
out = ".";
|
||||
}
|
||||
|
||||
if (he->branch_info->flags.abort)
|
||||
out = "A";
|
||||
return repsep_snprintf(bf, size, "%-*s", width, out);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue