linux/tools/perf/ui/browsers
James Clark 74802634e4 perf annotate: Fix crashes on empty annotate windows
Annotate can open with an empty window if the disassembly tool fails.
After the linked change, the TUI started assuming there was a current
annotation line and could assert or segfault in the seek, refresh, and
source-toggle paths.

Handle empty annotate windows explicitly: set the asm entry count before
resetting the browser, return early when refreshing an empty list, and
ignore source line toggle when there is no current annotation line.

Fixes the following when opening an annotation:

  perf: ui/browser.c:125: ui_browser__list_head_seek: Assertion `pos != NULL' failed.
  Aborted

Fixes: e201757f7a ("perf annotate: Fix source code annotate with objdump")
Assisted-by: GitHub Copilot:GPT-5.4
Signed-off-by: James Clark <james.clark@linaro.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2026-06-04 11:13:25 -03:00
..
annotate-data.c perf ui browser annotate-data: Provide feedback on unhandled hotkeys 2025-04-10 10:45:48 -03:00
annotate.c perf annotate: Fix crashes on empty annotate windows 2026-06-04 11:13:25 -03:00
Build perf ui: Make ui its own library 2024-06-26 11:06:34 -07:00
header.c perf evlist: Change env variable to session 2025-07-25 10:37:56 -07:00
hists.c perf map_symbol: Switch from holding maps to holding thread 2026-01-23 16:58:39 -03:00
hists.h perf ui/browser/annotate: Use global annotation_options 2023-12-07 17:18:06 -03:00
map.c perf symbol: Add setters for bitfields sharing a byte to avoid concurrent update issues 2026-06-03 16:53:45 -03:00
map.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
res_sample.c perf: script: prefer capstone to XED 2024-02-20 18:07:34 -08:00
scripts.c perf ui scripts: Switch FILENAME_MAX to NAME_MAX 2025-07-22 18:17:53 -07:00