[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM9d7ciZ0axC1A=q2mT-5fCmNUZF=QtmfcQmfs8aR-tgYftYmA@mail.gmail.com>
Date: Wed, 25 Oct 2023 22:26:32 -0700
From: Namhyung Kim <namhyung@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Jiri Olsa <jolsa@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Ingo Molnar <mingo@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
linux-perf-users@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
Stephane Eranian <eranian@...gle.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
linux-toolchains@...r.kernel.org, linux-trace-devel@...r.kernel.org
Subject: Re: [PATCH 13/48] perf annotate: Add annotate_get_insn_location()
On Tue, Oct 24, 2023 at 12:10 PM Namhyung Kim <namhyung@...nel.org> wrote:
>
> Hi Arnaldo,
>
> On Mon, Oct 23, 2023 at 9:38 AM Arnaldo Carvalho de Melo
> <acme@...nel.org> wrote:
> >
> > Em Wed, Oct 11, 2023 at 08:50:36PM -0700, Namhyung Kim escreveu:
> > > The annotate_get_insn_location() is to get the detailed information of
> > > instruction locations like registers and offset. It has source and
> > > target operands locations in an array. Each operand can have a
> > > register and an offset. The offset is meaningful when mem_ref flag is
> > > set.
> >
> > This needs to be enclosed in HAVE_DWARF_SUPPORT, as the build is failing
> > in systems where this isn't available, see patch below.
>
> Thanks for the test and the patch, will add it to v2.
Hmm.. I think this function can work without DWARF.
If the only problem is get_dwarf_regnum() probably
I can add a dummy function when libdw is not found.
Maybe I need to use arch reg number here and
convert to DWARF later.
Thanks,
Namhyung
> >
> > CC /tmp/build/perf/arch/x86/util/pmu.o
> > util/annotate.c: In function 'extract_reg_offset':
> > util/annotate.c:3537:24: error: implicit declaration of function 'get_dwarf_regnum' [-Werror=implicit-function-declaration]
> > 3537 | op_loc->reg1 = get_dwarf_regnum(regname, 0);
> > | ^~~~~~~~~~~~~~~~
> > CC /tmp/build/perf/tests/vmlinux-kallsyms.o
> >
> > I tested it with 'make NO_DWARF=1'
> >
> > - Arnaldo
> >
> > diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
> > index 9d653a1e84ce4889..b998c81c89be04fc 100644
> > --- a/tools/perf/util/annotate.c
> > +++ b/tools/perf/util/annotate.c
> > @@ -3486,6 +3486,7 @@ int annotate_check_args(struct annotation_options *args)
> > return 0;
> > }
> >
> > +#ifdef HAVE_DWARF_SUPPORT
> > /*
> > * Get register number and access offset from the given instruction.
> > * It assumes AT&T x86 asm format like OFFSET(REG). Maybe it needs
> > @@ -3591,3 +3592,4 @@ int annotate_get_insn_location(struct arch *arch, struct disasm_line *dl,
> >
> > return 0;
> > }
> > +#endif // HAVE_DWARF_SUPPORT
> > diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
> > index 4adda492233d2742..484be346a279c481 100644
> > --- a/tools/perf/util/annotate.h
> > +++ b/tools/perf/util/annotate.h
> > @@ -437,6 +437,7 @@ int annotate_parse_percent_type(const struct option *opt, const char *_str,
> >
> > int annotate_check_args(struct annotation_options *args);
> >
> > +#ifdef HAVE_DWARF_SUPPORT
> > /**
> > * struct annotated_op_loc - Location info of instruction operand
> > * @reg: Register in the operand
> > @@ -473,4 +474,5 @@ struct annotated_insn_loc {
> > int annotate_get_insn_location(struct arch *arch, struct disasm_line *dl,
> > struct annotated_insn_loc *loc);
> >
> > +#endif /* HAVE_DWARF_SUPPORT */
> > #endif /* __PERF_ANNOTATE_H */
Powered by blists - more mailing lists