]> www.infradead.org Git - users/jedix/linux-maple.git/commit
perf annotate: Add annotation_options.disassembler_used
authorAthira Rajeev <atrajeev@linux.ibm.com>
Tue, 4 Mar 2025 15:41:13 +0000 (21:11 +0530)
committerNamhyung Kim <namhyung@kernel.org>
Fri, 7 Mar 2025 00:51:22 +0000 (16:51 -0800)
commitdab8c32ece27c7d8cf01e9b68041edaf5ddd8adf
tree2c86f6ddb06738b80e8ebbab9cb055d579c99379
parentb0920abe0d529101bcf2eb1cd309032d2a42b4db
perf annotate: Add annotation_options.disassembler_used

When doing "perf annotate", perf tool provides option to
use specific disassembler like llvm/objdump/capstone. The
order picked is to use llvm first and if that fails fallback
to objdump ie to use PERF_DISASM_LLVM, PERF_DISASM_CAPSTONE
and PERF_DISASM_OBJDUMP

In powerpc, when using "data type" sort keys, first preferred
approach is to read the raw instruction from the DSO. In objdump
is specified in "--objdump" option, it picks the symbol disassemble
using objdump. Currently disasm_line__parse_powerpc() function
uses length of the "line" to determine if objdump is used.
But there are few cases, where if objdump doesn't recognise the
instruction, the disassembled string will be empty.

Example:

     134cdc: c4 05 82 41  beq     1352a0 <getcwd+0x6e0>
     134ce0: ac 00 8e 40  bne     cr3,134d8c <getcwd+0x1cc>
     134ce4: 0f 00 10 04  pld     r9,1028308
====>134ce8: d4 b0 20 e5
     134cec: 16 00 40 39  li      r10,22
     134cf0: 48 01 21 ea  ld      r17,328(r1)

So depending on length of line will give bad results.

Add a new filed to annotation options structure,
"struct annotation_options" to save the disassembler used.
Use this info to determine if disassembly is done while
parsing the disasm line.

Reported-by: Tejas Manhas <Tejas.Manhas1@ibm.com>
Signed-off-by: Athira Rajeev <atrajeev@linux.ibm.com>
Tested-By: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Link: https://lore.kernel.org/r/20250304154114.62093-1-atrajeev@linux.ibm.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/util/annotate.h
tools/perf/util/disasm.c