Commit f69b64f73e1d7f47a9205c1cd46e0e1c3c65e1cd

Authored by Andi Kleen
Committed by Arnaldo Carvalho de Melo
1 parent 33e49ea70d

perf: Support setting the disassembler style

Add -M option to report/annotate to pass directly to objdump.  This
allows to use -M intel for intel style disassembler syntax, which is
useful for people who are very used to the Intel syntax.

Link: http://lkml.kernel.org/r/1316122302-24306-2-git-send-email-andi@firstfloor.org
[committer note: Add missing Documentation bits, fixup conflicts with 3e6a2a7]
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Stephane Eranian <eranian@google.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Showing 6 changed files with 17 additions and 1 deletions Side-by-side Diff

tools/perf/Documentation/perf-annotate.txt
... ... @@ -83,6 +83,9 @@
83 83 --symfs=<directory>::
84 84 Look for files with symbols relative to this directory.
85 85  
  86 +-M::
  87 +--disassembler-style=:: Set disassembler style for objdump.
  88 +
86 89 SEE ALSO
87 90 --------
88 91 linkperf:perf-record[1], linkperf:perf-report[1]
tools/perf/Documentation/perf-report.txt
... ... @@ -134,6 +134,9 @@
134 134 CPUs are specified with -: 0-2. Default is to report samples on all
135 135 CPUs.
136 136  
  137 +-M::
  138 +--disassembler-style=:: Set disassembler style for objdump.
  139 +
137 140 SEE ALSO
138 141 --------
139 142 linkperf:perf-stat[1]
tools/perf/builtin-annotate.c
... ... @@ -273,6 +273,8 @@
273 273 "Interleave source code with assembly code (default)"),
274 274 OPT_BOOLEAN('0', "asm-raw", &symbol_conf.annotate_asm_raw,
275 275 "Display raw encoding of assembly instructions (default)"),
  276 + OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style",
  277 + "Specify disassembler style (e.g. -M intel for intel syntax)"),
276 278 OPT_END()
277 279 };
278 280  
tools/perf/builtin-report.c
... ... @@ -487,6 +487,8 @@
487 487 OPT_STRING(0, "symfs", &symbol_conf.symfs, "directory",
488 488 "Look for files with symbols relative to this directory"),
489 489 OPT_STRING('c', "cpu", &cpu_list, "cpu", "list of cpus to profile"),
  490 + OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style",
  491 + "Specify disassembler style (e.g. -M intel for intel syntax)"),
490 492 OPT_END()
491 493 };
492 494  
tools/perf/util/annotate.c
... ... @@ -16,6 +16,8 @@
16 16 #include "annotate.h"
17 17 #include <pthread.h>
18 18  
  19 +const char *disassembler_style;
  20 +
19 21 int symbol__annotate_init(struct map *map __used, struct symbol *sym)
20 22 {
21 23 struct annotation *notes = symbol__annotation(sym);
22 24  
... ... @@ -323,9 +325,11 @@
323 325 dso, dso->long_name, sym, sym->name);
324 326  
325 327 snprintf(command, sizeof(command),
326   - "objdump --start-address=0x%016" PRIx64
  328 + "objdump %s%s --start-address=0x%016" PRIx64
327 329 " --stop-address=0x%016" PRIx64
328 330 " -d %s %s -C %s|grep -v %s|expand",
  331 + disassembler_style ? "-M " : "",
  332 + disassembler_style ? disassembler_style : "",
329 333 map__rip_2objdump(map, sym->start),
330 334 map__rip_2objdump(map, sym->end),
331 335 symbol_conf.annotate_asm_raw ? "" : "--no-show-raw",
tools/perf/util/annotate.h
... ... @@ -100,5 +100,7 @@
100 100 int refresh);
101 101 #endif
102 102  
  103 +extern const char *disassembler_style;
  104 +
103 105 #endif /* __PERF_ANNOTATE_H */