mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-06 17:39:01 +01:00
perf tools: Compare dso's also when comparing symbols
Linus reported that sometimes 'perf report -s symbol' exits without any message on TUI. David and Jiri found that it's because it failed to add a hist entry due to an invalid symbol length. It turns out that sorting by symbol (address) was broken since it only compares symbol addresses. The symbol address is a relative address within a dso thus just checking its address can result in merging unrelated symbols together. Fix it by checking dso before comparing symbol address. Reported-by: Linus Torvalds <[email protected]> Signed-off-by: Namhyung Kim <[email protected]> Cc: David Ahern <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[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:
1 parent
e369517ce5
commit
09600e0f9e
1 file changed
+10
@@ -182,9 +182,19 @@ static int64_t _sort__sym_cmp(struct symbol *sym_l, struct symbol *sym_r)
|
||||
static int64_t
|
||||
sort__sym_cmp(struct hist_entry *left, struct hist_entry *right)
|
||||
{
|
||||
int64_t ret;
|
||||
|
||||
if (!left->ms.sym && !right->ms.sym)
|
||||
return right->level - left->level;
|
||||
|
||||
/*
|
||||
* comparing symbol address alone is not enough since it's a
|
||||
* relative address within a dso.
|
||||
*/
|
||||
ret = sort__dso_cmp(left, right);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
return _sort__sym_cmp(left->ms.sym, right->ms.sym);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user