]> www.infradead.org Git - users/jedix/linux-maple.git/commit
perf annotate: Use an array for the disassembler preference
authorIan Rogers <irogers@google.com>
Fri, 24 Jan 2025 04:38:56 +0000 (20:38 -0800)
committerNamhyung Kim <namhyung@kernel.org>
Mon, 27 Jan 2025 23:58:01 +0000 (15:58 -0800)
commitbde4ccfd5ab5361490514fc4af7497989cfbee17
treeff9a3adec606b2d58a7550d63d27d5df000a78e0
parent013eb043f37bd87c4d60d51034401a5a6d105bcf
perf annotate: Use an array for the disassembler preference

Prior to this change a string was used which could cause issues with
an unrecognized disassembler in symbol__disassembler. Change to
initializing an array of perf_disassembler enum values. If a value
already exists then adding it a second time is ignored to avoid array
out of bounds problems present in the previous code, it also allows a
statically sized array and removes memory allocation needs. Errors in
the disassembler string are reported when the config is parsed during
perf annotate or perf top start up. If the array is uninitialized
after processing the config file the default llvm, capstone then
objdump values are added but without a need to parse a string.

Fixes: a6e8a58de629 ("perf disasm: Allow configuring what disassemblers to use")
Closes: https://lore.kernel.org/lkml/CAP-5=fUdfCyxmEiTpzS2uumUp3-SyQOseX2xZo81-dQtWXj6vA@mail.gmail.com/
Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20250124043856.1177264-1-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/util/annotate.c
tools/perf/util/annotate.h
tools/perf/util/disasm.c