Re: [PATCH v2 1/3] perf report: Support LLVM for addr2line()

From: Ian Rogers
Date: Sun May 19 2024 - 19:01:10 EST


On Sun, May 19, 2024 at 2:01 PM Steinar H. Gunderson <sesse@xxxxxxxxxx> wrote:
>
> On Sun, May 19, 2024 at 11:23:26AM -0700, Ian Rogers wrote:
> > I think we might want to display this in the feature list during the build:
> > https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/build/Makefile.feature?h=perf-tools-next#n123
>
> Ack.
>
> > s/HAVE_LIBLLVM_SUPPORT/HAVE_LLVM_SUPPORT/
>
> Ack.
>
> >> +#pragma GCC diagnostic push
> >> +#pragma GCC diagnostic ignored "-Wunused-parameter" /* Needed for LLVM 14. */
> > nit: pehaps disabling this should be conditional:
> > #if LLVM_VERSION_MAJOR == 14
>
> It doesn't seem LLVM_VERSION_MAJOR is defined yet at this point, so I
> don't think that would work. (I just checked; 15 has the same issue.)
> In any case, I think it would be just more clutter for dubious gain.
>
> >> + if (file) {
> >> + if (line_info.FileName == "<invalid>") {
> >> + /* Match the convention of libbfd. */
> >> + *file = nullptr;
> > Should "*file" be cleared if "!file" so the caller can reliably free it?
>
> I don't understand. If “!file”, then file == NULL and surely accessing
> *file would mean a crash?

You're right, sorry. Thanks,
Ian

> /* Steinar */