Skip to contentSkip to conversation

perf annotate-data: Check annotation on perf report TUI

PATCH In review Namhyung Kim 3 participants 3 messages Apr 24, 2024 – Apr 25, 2024 perf events

lore
Share & tools
lore

Namhyung Kim

author maintainer
#0 lore raw

PATCH 1/1 perf annotate-data: Check annotation on perf report TUI

As it removed the sample accounting for code when no symbol sort key is given for perf report TUI, it might not allocate the annotated_source yet. Let's check if it's NULL first.

Fixes 6cdd977ec24e1 ("perf report: Do not collect sample histogram unnecessarily")
---
 tools/perf/util/annotate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/annotate.c +1 -1
index dca2c08ab8c5..f5b6b5e5e757 100644
@@ -906,7 +906,7 @@ int symbol__annotate(struct map_symbol *ms, struct evsel *evsel,
 	if (parch)
 		*parch = arch;
 
-	if (!list_empty(&notes->src->source))
+	if (notes->src && !list_empty(&notes->src->source))
 		return 0;
 
 	args.arch = arch;
Signature · 1 line
2.44.0.769.g3c40516874-goog
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Namhyung Kim

As it removed the sample accounting for code when no symbol sort key is given for perf report TUI, it might not allocate the annotated_source yet. Let's check if it's NULL first.

Fixes 6cdd977ec24e1 ("perf report: Do not collect sample histogram unnecessarily")

Thanks,
Ian

Quoted 21 lines
---
 tools/perf/util/annotate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/annotate.c +1 -2
index dca2c08ab8c5..f5b6b5e5e757 100644
@@ -906,7 +906,7 @@ int symbol__annotate(struct map_symbol *ms, struct evsel *evsel,
        if (parch)
                *parch = arch;
 
-       if (!list_empty(&notes->src->source))
+       if (notes->src && !list_empty(&notes->src->source))
                return 0;
 
        args.arch = arch;
--

2.44.0.769.g3c40516874-goog

maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Namhyung Kim
Quoted 6 lines · Namhyung Kim

As it removed the sample accounting for code when no symbol sort key is given for perf report TUI, it might not allocate the annotated_source yet. Let's check if it's NULL first.

Fixes 6cdd977ec24e1 ("perf report: Do not collect sample histogram unnecessarily")

Picking it up into perf-tools-next:

⬢[acme@toolbox perf-tools-next]$ git log torvalds/master.. perf-tools-next | grep 6cdd977ec24e1 commit 6cdd977ec24e1538b35a08bde823a74b69e829f2
⬢[acme@toolbox perf-tools-next]$

- Arnaldo

Quoted 19 lines
---
 tools/perf/util/annotate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/annotate.c +1 -1
index dca2c08ab8c5..f5b6b5e5e757 100644
@@ -906,7 +906,7 @@ int symbol__annotate(struct map_symbol *ms, struct evsel *evsel,
 	if (parch)
 		*parch = arch;
 
-	if (!list_empty(&notes->src->source))
+	if (notes->src && !list_empty(&notes->src->source))
 		return 0;
 
 	args.arch = arch;
Signature · 1 line
2.44.0.769.g3c40516874-goog