linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: "Steinar H. Gunderson" <sesse@google.com>
Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	irogers@google.com
Subject: Re: [PATCH v9 3/3] perf annotate: LLVM-based disassembler
Date: Mon, 2 Sep 2024 11:53:51 -0300	[thread overview]
Message-ID: <ZtXRf7OjEOMwg3qg@x1> (raw)
In-Reply-To: <20240719150051.520317-3-sesse@google.com>

On Fri, Jul 19, 2024 at 05:00:51PM +0200, Steinar H. Gunderson wrote:
> Support using LLVM as a disassembler method, allowing helperless
> annotation in non-distro builds. (It is also much faster than
> using libbfd or bfd objdump on binaries with a lot of debug
> information.)
> 
> This is nearly identical to the output of llvm-objdump; there are
> some very rare whitespace differences, some minor changes to demangling
> (since we use perf's regular demangling and not LLVM's own) and
> the occasional case where llvm-objdump makes a different choice
> when multiple symbols share the same address. It should work across
> all of LLVM's supported architectures, although I've only tested 64-bit
> x86, and finding the right triple from perf's idea of machine
> architecture can sometimes be a bit tricky. Ideally, we should have
> some way of finding the triplet just from the file itself.

<SNIP>
 
> @@ -1730,6 +1918,11 @@ int symbol__disassemble(struct symbol *sym, struct annotate_args *args)
>  		strcpy(symfs_filename, tmp);
>  	}
>  
> +#ifdef HAVE_LIBLLVM_SUPPORT
> +	err = symbol__disassemble_llvm(symfs_filename, sym, args);
> +	if (err == 0)
> +		goto out_remove_tmp;
> +#endif
>  #ifdef HAVE_LIBCAPSTONE_SUPPORT
>  	err = symbol__disassemble_capstone(symfs_filename, sym, args);
>  	if (err == 0)

So the above makes it unconditionally be used, and if the user installed
llvm-devel, that now gets checked and suggested at build time, then that
is an indication that it should be used, but I wonder if, for debugging
purposes we shouldn't have this done in some configurable way, i.e. some
~/.perfconfig variable that allows us to try a specific disassembler,
something like:

	perf annotate --disassemble=capstone

I can even envision having some perf test that compares the output for
some well known function to see if they really produce the same output
from different disassemblers, etc.

I'm applying the patches, thanks!

- Arnaldo

  reply	other threads:[~2024-09-02 14:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-19 15:00 [PATCH v9 1/3] perf report: Support LLVM for addr2line() Steinar H. Gunderson
2024-07-19 15:00 ` [PATCH v9 2/3] perf annotate: split out read_symbol() Steinar H. Gunderson
2024-07-19 15:00 ` [PATCH v9 3/3] perf annotate: LLVM-based disassembler Steinar H. Gunderson
2024-09-02 14:53   ` Arnaldo Carvalho de Melo [this message]
2024-09-02 14:55     ` Arnaldo Carvalho de Melo
2024-07-30 19:42 ` [PATCH v9 1/3] perf report: Support LLVM for addr2line() Arnaldo Carvalho de Melo
2024-07-30 19:49   ` Arnaldo Carvalho de Melo
2024-08-03 15:11     ` Steinar H. Gunderson
2024-09-01 10:57     ` Steinar H. Gunderson
2024-09-03 10:09       ` Arnaldo Carvalho de Melo
2024-09-03 13:14         ` Arnaldo Carvalho de Melo
2024-09-03 14:01         ` Arnaldo Carvalho de Melo
2024-09-03 14:15           ` Arnaldo Carvalho de Melo
2024-09-08 18:52             ` Steinar H. Gunderson
2024-09-09 16:42               ` Arnaldo Carvalho de Melo
2024-09-10 14:06             ` James Clark

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZtXRf7OjEOMwg3qg@x1 \
    --to=acme@kernel.org \
    --cc=irogers@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sesse@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).