perf: Support setting the disassembler style
authorAndi Kleen <ak@linux.intel.com>
Thu, 15 Sep 2011 21:31:41 +0000 (14:31 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 29 Sep 2011 20:10:00 +0000 (17:10 -0300)
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>
tools/perf/Documentation/perf-annotate.txt
tools/perf/Documentation/perf-report.txt
tools/perf/builtin-annotate.c
tools/perf/builtin-report.c
tools/perf/util/annotate.c
tools/perf/util/annotate.h

index 98a31e3181a5e86bdcdd291235ca639d2b149ecf..0102d83600db463bd670ab8ed7300f68170608ee 100644 (file)
@@ -83,6 +83,9 @@ OPTIONS
 --symfs=<directory>::
         Look for files with symbols relative to this directory.
 
+-M::
+--disassembler-style=:: Set disassembler style for objdump.
+
 SEE ALSO
 --------
 linkperf:perf-record[1], linkperf:perf-report[1]
index 04253c07d19a8620f185d13950816d514755440b..6349b6c0e3ec76463b829442aa314ddb0d5a52a1 100644 (file)
@@ -134,6 +134,9 @@ OPTIONS
        CPUs are specified with -: 0-2. Default is to report samples on all
        CPUs.
 
+-M::
+--disassembler-style=:: Set disassembler style for objdump.
+
 SEE ALSO
 --------
 linkperf:perf-stat[1]
index c5be28851f01c8d3c89a8953330cdc5fc57228a4..cf68819f7453fbb1213c4e3b6b0c90dcda45b042 100644 (file)
@@ -273,6 +273,8 @@ static const struct option options[] = {
                    "Interleave source code with assembly code (default)"),
        OPT_BOOLEAN('0', "asm-raw", &symbol_conf.annotate_asm_raw,
                    "Display raw encoding of assembly instructions (default)"),
+       OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style",
+                  "Specify disassembler style (e.g. -M intel for intel syntax)"),
        OPT_END()
 };
 
index d7ff277bdb78ba1d4a06f5042f8e50ea8053795b..a0673eeeae8d060060983a8c92fa58739a7e8b42 100644 (file)
@@ -487,6 +487,8 @@ static const struct option options[] = {
        OPT_STRING(0, "symfs", &symbol_conf.symfs, "directory",
                    "Look for files with symbols relative to this directory"),
        OPT_STRING('c', "cpu", &cpu_list, "cpu", "list of cpus to profile"),
+       OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style",
+                  "Specify disassembler style (e.g. -M intel for intel syntax)"),
        OPT_END()
 };
 
index 01d36ba54053f2aa0ea36013294ed4d18b7f3f24..bc8f4773d4d85386d46057ed74718543b3c4b87b 100644 (file)
@@ -16,6 +16,8 @@
 #include "annotate.h"
 #include <pthread.h>
 
+const char     *disassembler_style;
+
 int symbol__annotate_init(struct map *map __used, struct symbol *sym)
 {
        struct annotation *notes = symbol__annotation(sym);
@@ -323,9 +325,11 @@ fallback:
                 dso, dso->long_name, sym, sym->name);
 
        snprintf(command, sizeof(command),
-                "objdump --start-address=0x%016" PRIx64
+                "objdump %s%s --start-address=0x%016" PRIx64
                 " --stop-address=0x%016" PRIx64
                 " -d %s %s -C %s|grep -v %s|expand",
+                disassembler_style ? "-M " : "",
+                disassembler_style ? disassembler_style : "",
                 map__rip_2objdump(map, sym->start),
                 map__rip_2objdump(map, sym->end),
                 symbol_conf.annotate_asm_raw ? "" : "--no-show-raw",
index c2c286896801cde12155dce9be402cc68b76a155..6ede1286ee71ff2c0e669109c2434ddd6d0f164b 100644 (file)
@@ -100,4 +100,6 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,
                         int refresh);
 #endif
 
+extern const char      *disassembler_style;
+
 #endif /* __PERF_ANNOTATE_H */