summaryrefslogtreecommitdiff
path: root/tools/perf/ui
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2026-07-22 21:59:48 -0700
committerNamhyung Kim <namhyung@kernel.org>2026-07-27 17:30:46 -0700
commitb84e081e071da548a531875258fa4b513d786331 (patch)
treedf785e64ae7c0d9b1b27c1603bfc8b8a29fb6061 /tools/perf/ui
parentbd86119c3ee6ed7b8fc9be8298fe49f1a5355a46 (diff)
downloadlinux-next-b84e081e071da548a531875258fa4b513d786331.tar.gz
linux-next-b84e081e071da548a531875258fa4b513d786331.zip
perf annotate: Be robust to annotating without a thread
If a thread isn't given to map_symbol__get_arch(), try harder to determine the arch for disassembly. Do this by utilizing fallback paths such as reading the e_machine from a map's DSO ELF header for user-space libraries. Additionally, rely on map__kmaps() and maps__machine() to reliably extract the recorded machine environment and e_machine for kernel and kallsyms maps, perfectly preventing silent, incorrect host fallbacks to uname() during cross-platform Capstone annotation sessions. At the same time, ensure all remaining uses of a map_symbol's thread pointer do not assume it is non-NULL to eliminate UI segmentation faults, and remove the fragile, redundant thread__get_arch() function to streamline the annotate and disassembly subsystem architecture. Fixes: 0e26ba5a8774 ("perf disasm: Refactor arch__find and initialization of arch structs") Assisted-by: Antigravity:gemini-3.5-flash Signed-off-by: Ian Rogers <irogers@google.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/perf/ui')
-rw-r--r--tools/perf/ui/browsers/annotate.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index d25761a8d25e..e47a46775089 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -1201,7 +1201,7 @@ int __hist_entry__tui_annotate(struct hist_entry *he, struct map_symbol *ms,
ui__warning("Annotation has no source code.");
}
} else {
- err = thread__get_arch(ms->thread, &browser.arch);
+ err = map_symbol__get_arch(ms, &browser.arch);
if (err) {
annotate_browser__symbol_annotate_error(&browser, err);
return -1;