Re: [PATCH 3/3] perf disasm: Allow configuring what disassemblers to use
From: Arnaldo Carvalho de Melo
Date: Mon Nov 11 2024 - 12:24:49 EST
On Mon, Nov 11, 2024 at 08:27:38AM -0800, Ian Rogers wrote:
> On Mon, Nov 11, 2024 at 7:18 AM Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> wrote:
> > The perf tools annotation code used for a long time parsing the output
> > of binutils's objdump (or its reimplementations, like llvm's) to then
> > parse and augment it with samples, allow navigation, etc.
> > More recently disassemblers from the capstone and llvm (libraries, not
> > parsing the output of tools using those libraries to mimic binutils's
> > objdump output) were introduced.
> > So when all those methods are available, there is a static preference
> > for a series of attempts of disassembling a binary, with the 'llvm,
> > capstone, objdump' sequence being hard coded.
> So it LLVM is the preference can we just switch to using the LLVM ELF
> libraries, etc? :-) I was a bit surprised to see LLVM as preferable to
I'd have to look up the discussion to see how this ended up being the
default when LLVM is available, but when I wanted to have source code
intermixed with it and noticed that the LLVM output doesn't have it,
that lead me to try to make this selectable so that we can go from one
to the other when needing something not available in one of them.
On my todo list, and here Steinar could help, is to check if we an have
source code intermixed with the llvm based disassembler, like we have
with the objdump based one.
> capstone, which feels more agnostic in the LLVM vs GCC/binutils wars.
> Fwiw, I'm happy with LLVM being the preference.
<SNIP>
> > After adding a way to select the disassembler from the command line a
> > 'perf test' comparing the output of the various diassemblers should be
> > introduced, to test these codebases.
> >
> > Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
> > Cc: Athira Rajeev <atrajeev@xxxxxxxxxxxxxxxxxx>
> > Cc: Ian Rogers <irogers@xxxxxxxxxx>
> > Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
> > Cc: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
> > Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
> > Cc: Steinar H. Gunderson <sesse@xxxxxxxxxx>
> > Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
>
> Acked-by: Ian Rogers <irogers@xxxxxxxxxx>
Thanks!
- Arnaldo