Re: [RFC 3/6] perf annotate: Enable cross arch annotate

From: Ravi Bangoria
Date: Tue Jun 28 2016 - 07:48:44 EST




On Monday 27 June 2016 10:46 PM, Arnaldo Carvalho de Melo wrote:
Em Fri, Jun 24, 2016 at 05:23:57PM +0530, Ravi Bangoria escreveu:
Change current data structures and function to enable cross arch annotate
and add support for x86 and arm instructions.

Current implementation does not contain logic of recording on one arch
and annotating on other. This remote annotate is partially possible with
current implementation for x86 (or may be arm as well) only. But, to make
remote annotation work properly, all architecture instruction tables need
to be included in the perf binary. And while annotating, look for
instruction table where perf.data was recorded.

...

+static struct arch_instructions {
+ const char *arch;
+ int nmemb;
+ struct ins *instructions;
+ struct ins *(*ins__find)(const char *);
Why do we need arch specific find functions? Why not pass the
instructions pointer to it, just like you did with ins__sort().

Probably it is not needed to be global, you just pick the right
instructions table + its ARRAY_SIZE and pass it around, again, like you
did in ins__sort().

- Arnaldo

Thanks Arnaldo for suggestion.

To determine arch in ins__find, I need to pass 'arch' till ins__find and which
requires changes in definition of many functions. So, I thought about global
var.

Anyway, I've prepared a patch as you suggested and sent it as a [PATCH].
Please review it.

-Ravi