[tip:perf/core] perf annotate: Pass the symbol's map/dso to the instruction parsers

2016-09-20 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  bff5c3061374c37ed1262131eb333f714e5bcdf8
Gitweb: http://git.kernel.org/tip/bff5c3061374c37ed1262131eb333f714e5bcdf8
Author: Arnaldo Carvalho de Melo 
AuthorDate: Mon, 19 Sep 2016 17:18:16 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 20 Sep 2016 12:28:29 -0300

perf annotate: Pass the symbol's map/dso to the instruction parsers

So that things like:

   → callq  0x993e3230

found while disassembling /proc/kcore can be beautified by later
patches, that will resolve that address to a function, looking it up in
/proc/kallsyms.

Cc: Adrian Hunter 
Cc: Alexander Shishkin 
Cc: Chris Riyder 
Cc: David Ahern 
Cc: Hemant Kumar 
Cc: Jiri Olsa 
Cc: Markus Trippelsdorf 
Cc: Masami Hiramatsu 
Cc: Michael Ellerman 
Cc: Namhyung Kim 
Cc: Naveen N. Rao 
Cc: Pawel Moll 
Cc: Peter Zijlstra 
Cc: Ravi Bangoria 
Cc: Russell King 
Cc: Taeung Song 
Cc: Wang Nan 
Link: http://lkml.kernel.org/n/tip-p76myuke4j7gplg54amak...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/annotate.c | 23 ---
 tools/perf/util/annotate.h |  2 +-
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 60e915f..aef8417 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -54,7 +54,7 @@ int ins__scnprintf(struct ins *ins, char *bf, size_t size,
return ins__raw_scnprintf(ins, bf, size, ops);
 }
 
-static int call__parse(struct ins_operands *ops)
+static int call__parse(struct ins_operands *ops, struct map *map 
__maybe_unused)
 {
char *endptr, *tok, *name;
 
@@ -114,7 +114,7 @@ bool ins__is_call(const struct ins *ins)
return ins->ops == _ops;
 }
 
-static int jump__parse(struct ins_operands *ops)
+static int jump__parse(struct ins_operands *ops, struct map *map 
__maybe_unused)
 {
const char *s = strchr(ops->raw, '+');
 
@@ -169,7 +169,7 @@ static int comment__symbol(char *raw, char *comment, u64 
*addrp, char **namep)
return 0;
 }
 
-static int lock__parse(struct ins_operands *ops)
+static int lock__parse(struct ins_operands *ops, struct map *map)
 {
char *name;
 
@@ -190,7 +190,7 @@ static int lock__parse(struct ins_operands *ops)
return 0;
 
if (ops->locked.ins->ops->parse &&
-   ops->locked.ins->ops->parse(ops->locked.ops) < 0)
+   ops->locked.ins->ops->parse(ops->locked.ops, map) < 0)
goto out_free_ops;
 
return 0;
@@ -233,7 +233,7 @@ static struct ins_ops lock_ops = {
.scnprintf = lock__scnprintf,
 };
 
-static int mov__parse(struct ins_operands *ops)
+static int mov__parse(struct ins_operands *ops, struct map *map __maybe_unused)
 {
char *s = strchr(ops->raw, ','), *target, *comment, prev;
 
@@ -300,7 +300,7 @@ static struct ins_ops mov_ops = {
.scnprintf = mov__scnprintf,
 };
 
-static int dec__parse(struct ins_operands *ops)
+static int dec__parse(struct ins_operands *ops, struct map *map __maybe_unused)
 {
char *target, *comment, *s, prev;
 
@@ -705,7 +705,7 @@ int hist_entry__inc_addr_samples(struct hist_entry *he, int 
evidx, u64 ip)
return symbol__inc_addr_samples(he->ms.sym, he->ms.map, evidx, ip);
 }
 
-static void disasm_line__init_ins(struct disasm_line *dl)
+static void disasm_line__init_ins(struct disasm_line *dl, struct map *map)
 {
dl->ins = ins__find(dl->name);
 
@@ -715,7 +715,7 @@ static void disasm_line__init_ins(struct disasm_line *dl)
if (!dl->ins->ops)
return;
 
-   if (dl->ins->ops->parse && dl->ins->ops->parse(>ops) < 0)
+   if (dl->ins->ops->parse && dl->ins->ops->parse(>ops, map) < 0)
dl->ins = NULL;
 }
 
@@ -757,7 +757,8 @@ out_free_name:
 }
 
 static struct disasm_line *disasm_line__new(s64 offset, char *line,
-   size_t privsize, int line_nr)
+   size_t privsize, int line_nr,
+   struct map *map)
 {
struct disasm_line *dl = zalloc(sizeof(*dl) + privsize);
 
@@ -772,7 +773,7 @@ static struct disasm_line *disasm_line__new(s64 offset, 
char *line,
if (disasm_line__parse(dl->line, >name, 
>ops.raw) < 0)
goto out_free_line;
 
-   disasm_line__init_ins(dl);
+   disasm_line__init_ins(dl, map);
}
}
 
@@ -1144,7 +1145,7 @@ static int 

[tip:perf/core] perf annotate: Pass the symbol's map/dso to the instruction parsers

2016-09-20 Thread tip-bot for Arnaldo Carvalho de Melo
Commit-ID:  bff5c3061374c37ed1262131eb333f714e5bcdf8
Gitweb: http://git.kernel.org/tip/bff5c3061374c37ed1262131eb333f714e5bcdf8
Author: Arnaldo Carvalho de Melo 
AuthorDate: Mon, 19 Sep 2016 17:18:16 -0300
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 20 Sep 2016 12:28:29 -0300

perf annotate: Pass the symbol's map/dso to the instruction parsers

So that things like:

   → callq  0x993e3230

found while disassembling /proc/kcore can be beautified by later
patches, that will resolve that address to a function, looking it up in
/proc/kallsyms.

Cc: Adrian Hunter 
Cc: Alexander Shishkin 
Cc: Chris Riyder 
Cc: David Ahern 
Cc: Hemant Kumar 
Cc: Jiri Olsa 
Cc: Markus Trippelsdorf 
Cc: Masami Hiramatsu 
Cc: Michael Ellerman 
Cc: Namhyung Kim 
Cc: Naveen N. Rao 
Cc: Pawel Moll 
Cc: Peter Zijlstra 
Cc: Ravi Bangoria 
Cc: Russell King 
Cc: Taeung Song 
Cc: Wang Nan 
Link: http://lkml.kernel.org/n/tip-p76myuke4j7gplg54amak...@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/annotate.c | 23 ---
 tools/perf/util/annotate.h |  2 +-
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 60e915f..aef8417 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -54,7 +54,7 @@ int ins__scnprintf(struct ins *ins, char *bf, size_t size,
return ins__raw_scnprintf(ins, bf, size, ops);
 }
 
-static int call__parse(struct ins_operands *ops)
+static int call__parse(struct ins_operands *ops, struct map *map 
__maybe_unused)
 {
char *endptr, *tok, *name;
 
@@ -114,7 +114,7 @@ bool ins__is_call(const struct ins *ins)
return ins->ops == _ops;
 }
 
-static int jump__parse(struct ins_operands *ops)
+static int jump__parse(struct ins_operands *ops, struct map *map 
__maybe_unused)
 {
const char *s = strchr(ops->raw, '+');
 
@@ -169,7 +169,7 @@ static int comment__symbol(char *raw, char *comment, u64 
*addrp, char **namep)
return 0;
 }
 
-static int lock__parse(struct ins_operands *ops)
+static int lock__parse(struct ins_operands *ops, struct map *map)
 {
char *name;
 
@@ -190,7 +190,7 @@ static int lock__parse(struct ins_operands *ops)
return 0;
 
if (ops->locked.ins->ops->parse &&
-   ops->locked.ins->ops->parse(ops->locked.ops) < 0)
+   ops->locked.ins->ops->parse(ops->locked.ops, map) < 0)
goto out_free_ops;
 
return 0;
@@ -233,7 +233,7 @@ static struct ins_ops lock_ops = {
.scnprintf = lock__scnprintf,
 };
 
-static int mov__parse(struct ins_operands *ops)
+static int mov__parse(struct ins_operands *ops, struct map *map __maybe_unused)
 {
char *s = strchr(ops->raw, ','), *target, *comment, prev;
 
@@ -300,7 +300,7 @@ static struct ins_ops mov_ops = {
.scnprintf = mov__scnprintf,
 };
 
-static int dec__parse(struct ins_operands *ops)
+static int dec__parse(struct ins_operands *ops, struct map *map __maybe_unused)
 {
char *target, *comment, *s, prev;
 
@@ -705,7 +705,7 @@ int hist_entry__inc_addr_samples(struct hist_entry *he, int 
evidx, u64 ip)
return symbol__inc_addr_samples(he->ms.sym, he->ms.map, evidx, ip);
 }
 
-static void disasm_line__init_ins(struct disasm_line *dl)
+static void disasm_line__init_ins(struct disasm_line *dl, struct map *map)
 {
dl->ins = ins__find(dl->name);
 
@@ -715,7 +715,7 @@ static void disasm_line__init_ins(struct disasm_line *dl)
if (!dl->ins->ops)
return;
 
-   if (dl->ins->ops->parse && dl->ins->ops->parse(>ops) < 0)
+   if (dl->ins->ops->parse && dl->ins->ops->parse(>ops, map) < 0)
dl->ins = NULL;
 }
 
@@ -757,7 +757,8 @@ out_free_name:
 }
 
 static struct disasm_line *disasm_line__new(s64 offset, char *line,
-   size_t privsize, int line_nr)
+   size_t privsize, int line_nr,
+   struct map *map)
 {
struct disasm_line *dl = zalloc(sizeof(*dl) + privsize);
 
@@ -772,7 +773,7 @@ static struct disasm_line *disasm_line__new(s64 offset, 
char *line,
if (disasm_line__parse(dl->line, >name, 
>ops.raw) < 0)
goto out_free_line;
 
-   disasm_line__init_ins(dl);
+   disasm_line__init_ins(dl, map);
}
}
 
@@ -1144,7 +1145,7 @@ static int symbol__parse_objdump_line(struct symbol *sym, 
struct map *map,
parsed_line = tmp2 + 1;
}
 
-   dl = disasm_line__new(offset, parsed_line, privsize, *line_nr);
+   dl = disasm_line__new(offset, parsed_line, privsize, *line_nr, map);
free(line);
(*line_nr)++;
 
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index ea44e4f..5bbcec1 100644
--- a/tools/perf/util/annotate.h
+++