Re: Question to perf annotate handling mov ...(%rip) instructions

From: Jiri Olsa
Date: Wed Nov 29 2017 - 03:29:59 EST


On Tue, Nov 28, 2017 at 11:50:30AM -0300, Arnaldo Carvalho de Melo wrote:

SNIP

> > Function mov__parse() calls comment__symbol() which contains:
> >
> > static int comment__symbol(char *raw, char *comment, u64 *addrp, char **namep)
> > {
> > char *endptr, *name, *t;
> >
> > if (strstr(raw, "(%rip)") == NULL)
> > return 0;
> >
> > This is architecture specific and does not work for non-Intel platforms.
> >
> > I would like to fix perf annotate for s390x and above move instruction on s390x
> > is
> >
> > 655a: c0 10 00 01 9c eb larl %r1,39f30 <__gmon_start__>
> >
> > There is a need to handle PLT resolution in an architecture independent way.
> >
> > Ideas and suggestions?
>
> Some historical background there, busy now, but you seem to be on the
> right track and IIRC you already sent a patch for this, right? I'll try
> to look at it.
>
> Jiri may as well, since he worked a lot recently in this codebase, to
> refactor it some more to make it useful for annotating python code, perl
> next, other scripted languages should follow too.

so we try to parse each line out of objdump using arch specific
ops callbacks, check:

disasm_line__new
disasm_line__init_ins
dl->ins.ops->parse(...

the ops stuff are defined in:

static struct arch architectures[] = {

{
.name = "s390",
.init = s390__annotate_init,
.objdump = {
.comment_char = '#',
},
},

I'd check s390__annotate_init, there's some mechanism
of associating ops for arch and try to fit in ;-)

jirka