perf tools: Allow user to indicate path to objdump in command line
authorMaciek Borzecki <maciek.borzecki@gmail.com>
Tue, 4 Sep 2012 10:32:30 +0000 (12:32 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 5 Sep 2012 22:41:55 +0000 (19:41 -0300)
When analyzing perf data from hosts of other architecture than one of
the local host it's useful to call objdump that is part of a toolchain
for that architecture. Instead of calling regular objdump, call one that
user specified in command line.

Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
Acked-by: David Ahern <dsahern@gmail.com>
Link: http://lkml.kernel.org/r/1346754750.16299.3.camel@localhost.localdomain
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 c89f9e1453f7d937561e8202af3432b102291b73..c8ffd9fd5c6afdd53d1722cd2cbd41737cee0992 100644 (file)
@@ -85,6 +85,9 @@ OPTIONS
 -M::
 --disassembler-style=:: Set disassembler style for objdump.
 
+--objdump=<path>::
+        Path to objdump binary.
+
 SEE ALSO
 --------
 linkperf:perf-record[1], linkperf:perf-report[1]
index 495210a612c4d218170f696dcf5d93323f22a571..f4d91bebd59d4adc70272a3a11e25f9c42b827e1 100644 (file)
@@ -168,6 +168,9 @@ OPTIONS
        branch stacks and it will automatically switch to the branch view mode,
        unless --no-branch-stack is used.
 
+--objdump=<path>::
+        Path to objdump binary.
+
 SEE ALSO
 --------
 linkperf:perf-stat[1], linkperf:perf-annotate[1]
index 67522cf874053e24ff87d4fa3fca67e6845981be..2f3f0029c0f73cbd66b60e239c273d0e242d6be2 100644 (file)
@@ -282,6 +282,8 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __used)
                    "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_STRING(0, "objdump", &objdump_path, "path",
+                  "objdump binary to use for disassembly and annotations"),
        OPT_END()
        };
 
index d61825371adc396c5f71f67c3db50118dd5f2e21..1f8d11b4f7ff1f5b0df7c81a4f347959f51c4e09 100644 (file)
@@ -638,6 +638,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __used)
                    "Show a column with the sum of periods"),
        OPT_CALLBACK_NOOPT('b', "branch-stack", &sort__branch_mode, "",
                    "use branch records for histogram filling", parse_branch_mode),
+       OPT_STRING(0, "objdump", &objdump_path, "path",
+                  "objdump binary to use for disassembly and annotations"),
        OPT_END()
        };
 
index 3a282c0057d2266fa2adcdb00122bf3bfdb69c27..51ef69c9841dd076777326d9d01c5b5ae71f8335 100644 (file)
@@ -17,6 +17,7 @@
 #include <pthread.h>
 
 const char     *disassembler_style;
+const char     *objdump_path;
 
 static struct ins *ins__find(const char *name);
 static int disasm_line__parse(char *line, char **namep, char **rawp);
@@ -820,9 +821,10 @@ fallback:
                 dso, dso->long_name, sym, sym->name);
 
        snprintf(command, sizeof(command),
-                "objdump %s%s --start-address=0x%016" PRIx64
+                "%s %s%s --start-address=0x%016" PRIx64
                 " --stop-address=0x%016" PRIx64
                 " -d %s %s -C %s|grep -v %s|expand",
+                objdump_path ? objdump_path : "objdump",
                 disassembler_style ? "-M " : "",
                 disassembler_style ? disassembler_style : "",
                 map__rip_2objdump(map, sym->start),
index 78a5692dd718d46e7e1b4b8e453cb19659850d20..a6d6bc5d716451e9e1df1ce1eca8332cb06390b4 100644 (file)
@@ -152,5 +152,6 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,
 #endif
 
 extern const char      *disassembler_style;
+extern const char      *objdump_path;
 
 #endif /* __PERF_ANNOTATE_H */