Commit 7a4ec938857cf534270b23545495300fbac7f5de

Authored by Maciek Borzecki
Committed by Arnaldo Carvalho de Melo
1 parent 60ff92f515

perf tools: Allow user to indicate path to objdump in command line

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>

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

tools/perf/Documentation/perf-annotate.txt
... ... @@ -85,6 +85,9 @@
85 85 -M::
86 86 --disassembler-style=:: Set disassembler style for objdump.
87 87  
  88 +--objdump=<path>::
  89 + Path to objdump binary.
  90 +
88 91 SEE ALSO
89 92 --------
90 93 linkperf:perf-record[1], linkperf:perf-report[1]
tools/perf/Documentation/perf-report.txt
... ... @@ -168,6 +168,9 @@
168 168 branch stacks and it will automatically switch to the branch view mode,
169 169 unless --no-branch-stack is used.
170 170  
  171 +--objdump=<path>::
  172 + Path to objdump binary.
  173 +
171 174 SEE ALSO
172 175 --------
173 176 linkperf:perf-stat[1], linkperf:perf-annotate[1]
tools/perf/builtin-annotate.c
... ... @@ -282,6 +282,8 @@
282 282 "Display raw encoding of assembly instructions (default)"),
283 283 OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style",
284 284 "Specify disassembler style (e.g. -M intel for intel syntax)"),
  285 + OPT_STRING(0, "objdump", &objdump_path, "path",
  286 + "objdump binary to use for disassembly and annotations"),
285 287 OPT_END()
286 288 };
287 289  
tools/perf/builtin-report.c
... ... @@ -638,6 +638,8 @@
638 638 "Show a column with the sum of periods"),
639 639 OPT_CALLBACK_NOOPT('b', "branch-stack", &sort__branch_mode, "",
640 640 "use branch records for histogram filling", parse_branch_mode),
  641 + OPT_STRING(0, "objdump", &objdump_path, "path",
  642 + "objdump binary to use for disassembly and annotations"),
641 643 OPT_END()
642 644 };
643 645  
tools/perf/util/annotate.c
... ... @@ -17,6 +17,7 @@
17 17 #include <pthread.h>
18 18  
19 19 const char *disassembler_style;
  20 +const char *objdump_path;
20 21  
21 22 static struct ins *ins__find(const char *name);
22 23 static int disasm_line__parse(char *line, char **namep, char **rawp);
23 24  
... ... @@ -820,9 +821,10 @@
820 821 dso, dso->long_name, sym, sym->name);
821 822  
822 823 snprintf(command, sizeof(command),
823   - "objdump %s%s --start-address=0x%016" PRIx64
  824 + "%s %s%s --start-address=0x%016" PRIx64
824 825 " --stop-address=0x%016" PRIx64
825 826 " -d %s %s -C %s|grep -v %s|expand",
  827 + objdump_path ? objdump_path : "objdump",
826 828 disassembler_style ? "-M " : "",
827 829 disassembler_style ? disassembler_style : "",
828 830 map__rip_2objdump(map, sym->start),
tools/perf/util/annotate.h
... ... @@ -152,6 +152,7 @@
152 152 #endif
153 153  
154 154 extern const char *disassembler_style;
  155 +extern const char *objdump_path;
155 156  
156 157 #endif /* __PERF_ANNOTATE_H */