Skip to contentSkip to conversation

perf annotate: Start supporting cross arch annotation

tip:perf/core tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message Nov 24, 2016 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  786c1b51844d858041166057c0c79e93c2015013
Gitweb:     http://git.kernel.org/tip/786c1b51844d858041166057c0c79e93c2015013
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Wed, 16 Nov 2016 15:39:50 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 17 Nov 2016 17:12:50 -0300

perf annotate: Start supporting cross arch annotation

Introduce a 'struct arch', where arch specific stuff will live, starting with objdump's choice of comment delimitation character, that is '#' in x86 while a ';' in arm.

This has some bits and pieces from a patch submitted by Ravi.

Cc Adrian Hunter <[email protected]>
Cc Alexander Shishkin <[email protected]>
Cc Chris Riyder <[email protected]>
Cc David Ahern <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Kim Phillips <[email protected]>
Cc Markus Trippelsdorf <[email protected]>
Cc Masami Hiramatsu <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Naveen N. Rao <[email protected]>
Cc Pawel Moll <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Ravi Bangoria <[email protected]>
Cc Taeung Song <[email protected]>
Cc Wang Nan <[email protected]>
---
 tools/perf/builtin-top.c          |   2 +-
 tools/perf/ui/browsers/annotate.c |   2 +-
 tools/perf/ui/gtk/annotate.c      |   2 +-
 tools/perf/util/annotate.c        | 114 ++++++++++++++++++++++++++++++++------
 tools/perf/util/annotate.h        |   6 +-
 5 files changed, 103 insertions(+), 23 deletions(-)
tools/perf/builtin-top.c +1 -1
index fe3af95..3df4178 100644
@@ -130,7 +130,7 @@ static int perf_top__parse_source(struct perf_top *top, struct hist_entry *he)
 		return err;
 	}
 
-	err = symbol__disassemble(sym, map, 0);
+	err = symbol__disassemble(sym, map, NULL, 0);
 	if (err == 0) {
 out_assign:
 		top->sym_filter_entry = he;
tools/perf/ui/browsers/annotate.c +1 -1
index 4c18271..e6e9f7d 100644
@@ -1050,7 +1050,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map,
 		  (nr_pcnt - 1);
 	}
 
-	err = symbol__disassemble(sym, map, sizeof_bdl);
+	err = symbol__disassemble(sym, map, perf_evsel__env_arch(evsel), sizeof_bdl);
 	if (err) {
 		char msg[BUFSIZ];
 		symbol__strerror_disassemble(sym, map, err, msg, sizeof(msg));
tools/perf/ui/gtk/annotate.c +1 -1
index 42d3199..8c9308a 100644
@@ -167,7 +167,7 @@ static int symbol__gtk_annotate(struct symbol *sym, struct map *map,
 	if (map->dso->annotate_warned)
 		return -1;
 
-	err = symbol__disassemble(sym, map, 0);
+	err = symbol__disassemble(sym, map, perf_evsel__env_arch(evsel), 0);
 	if (err) {
 		char msg[BUFSIZ];
 		symbol__strerror_disassemble(sym, map, err, msg, sizeof(msg));
tools/perf/util/annotate.c +96 -18

240 lines not on this page · raw message

tools/perf/util/annotate.h +4 -2
index 5bbcec1..8e490b5 100644
@@ -34,9 +34,11 @@ struct ins_operands {
 	};
 };
 
+struct arch;
+
 struct ins_ops {
 	void (*free)(struct ins_operands *ops);
-	int (*parse)(struct ins_operands *ops, struct map *map);
+	int (*parse)(struct arch *arch, struct ins_operands *ops, struct map *map);
 	int (*scnprintf)(struct ins *ins, char *bf, size_t size,
 			 struct ins_operands *ops);
 };
@@ -156,7 +158,7 @@ int hist_entry__inc_addr_samples(struct hist_entry *he, int evidx, u64 addr);
 int symbol__alloc_hist(struct symbol *sym);
 void symbol__annotate_zero_histograms(struct symbol *sym);
 
-int symbol__disassemble(struct symbol *sym, struct map *map, size_t privsize);
+int symbol__disassemble(struct symbol *sym, struct map *map, const char *arch_name, size_t privsize);
 
 enum symbol_disassemble_errno {
 	SYMBOL_ANNOTATE_ERRNO__SUCCESS		= 0,