Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf annotate: Get rid of symbol__ensure_annotate()

Now symbol__annotate() is reentrant and it doesn't need to remove
non-instruction lines. Let's get rid of symbol__ensure_annotate() and
call symbol__annotate() directly. Also we can use it to get the arch
pointer instead of calling evsel__get_arch() directly.

Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240405211800.1412920-5-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Namhyung Kim and committed by
Arnaldo Carvalho de Melo
0235abd8 879ebf3c

+2 -12
+2 -12
tools/perf/util/annotate.c
··· 2157 2157 return 0; 2158 2158 } 2159 2159 2160 - static void symbol__ensure_annotate(struct map_symbol *ms, struct evsel *evsel) 2161 - { 2162 - struct annotation *notes = symbol__annotation(ms->sym); 2163 - 2164 - if (list_empty(&notes->src->source)) 2165 - symbol__annotate(ms, evsel, NULL); 2166 - } 2167 - 2168 2160 static struct disasm_line *find_disasm_line(struct symbol *sym, u64 ip, 2169 2161 bool allow_update) 2170 2162 { ··· 2331 2339 return NULL; 2332 2340 } 2333 2341 2334 - if (evsel__get_arch(evsel, &arch) < 0) { 2342 + /* Make sure it has the disasm of the function */ 2343 + if (symbol__annotate(ms, evsel, &arch) < 0) { 2335 2344 ann_data_stat.no_insn++; 2336 2345 return NULL; 2337 2346 } 2338 - 2339 - /* Make sure it runs objdump to get disasm of the function */ 2340 - symbol__ensure_annotate(ms, evsel); 2341 2347 2342 2348 /* 2343 2349 * Get a disasm to extract the location from the insn.