linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf: allow user to indicate path to objdump in command line
@ 2012-09-04 10:32 Maciek Borzecki
  2012-09-04 16:05 ` David Ahern
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Maciek Borzecki @ 2012-09-04 10:32 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: linux-kernel, linux-perf-users

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>
---
 tools/perf/Documentation/perf-annotate.txt | 3 +++
 tools/perf/Documentation/perf-report.txt   | 3 +++
 tools/perf/builtin-annotate.c              | 2 ++
 tools/perf/builtin-report.c                | 2 ++
 tools/perf/util/annotate.c                 | 4 +++-
 tools/perf/util/annotate.h                 | 1 +
 6 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/tools/perf/Documentation/perf-annotate.txt b/tools/perf/Documentation/perf-annotate.txt
index c89f9e1..c8ffd9f 100644
--- a/tools/perf/Documentation/perf-annotate.txt
+++ b/tools/perf/Documentation/perf-annotate.txt
@@ -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]
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index 2d89f02..2da267f 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -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]
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 67522cf..2f3f002 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -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()
 	};
 
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 25249f7..dad231b 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -635,6 +635,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()
 	};
 
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 8069dfb..be7290c 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -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);
@@ -809,9 +810,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),
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index 78a5692..a6d6bc5 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -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 */
-- 
1.7.11.4




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf: allow user to indicate path to objdump in command line
  2012-09-04 10:32 [PATCH] perf: allow user to indicate path to objdump in command line Maciek Borzecki
@ 2012-09-04 16:05 ` David Ahern
  2012-09-05  2:11   ` Michael Ellerman
  2012-09-05 21:11 ` David Ahern
  2012-09-07  6:10 ` [tip:perf/core] perf tools: Allow " tip-bot for Maciek Borzecki
  2 siblings, 1 reply; 6+ messages in thread
From: David Ahern @ 2012-09-04 16:05 UTC (permalink / raw)
  To: Maciek Borzecki; +Cc: Arnaldo Carvalho de Melo, linux-kernel, linux-perf-users

On 9/4/12 4:32 AM, Maciek Borzecki wrote:
> 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.

Why not set the PATH to make the toolchain's version the one used by perf?

David


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf: allow user to indicate path to objdump in command line
  2012-09-04 16:05 ` David Ahern
@ 2012-09-05  2:11   ` Michael Ellerman
  2012-09-05  5:22     ` Maciek Borzecki
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Ellerman @ 2012-09-05  2:11 UTC (permalink / raw)
  To: David Ahern
  Cc: Maciek Borzecki, Arnaldo Carvalho de Melo, linux-kernel,
	linux-perf-users

On Tue, 2012-09-04 at 10:05 -0600, David Ahern wrote:
> On 9/4/12 4:32 AM, Maciek Borzecki wrote:
> > 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.
> 
> Why not set the PATH to make the toolchain's version the one used by perf?

At least one reason is that cross toolchains are usually built such that
the resulting binaries are called <target>-objdump, <target>-gcc etc.

cheers


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf: allow user to indicate path to objdump in command line
  2012-09-05  2:11   ` Michael Ellerman
@ 2012-09-05  5:22     ` Maciek Borzecki
  0 siblings, 0 replies; 6+ messages in thread
From: Maciek Borzecki @ 2012-09-05  5:22 UTC (permalink / raw)
  To: Michael Ellerman, David Ahern
  Cc: Arnaldo Carvalho de Melo, linux-kernel, linux-perf-users

On Wed, 2012-09-05 at 12:11 +1000, Michael Ellerman wrote:
> On Tue, 2012-09-04 at 10:05 -0600, David Ahern wrote:
> > On 9/4/12 4:32 AM, Maciek Borzecki wrote:
> > > 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.
> > 
> > Why not set the PATH to make the toolchain's version the one used by perf?
> 
> At least one reason is that cross toolchains are usually built such that
> the resulting binaries are called <target>-objdump, <target>-gcc etc.
Correct, PATH won't work. First I thought, why not hardcode objdump
based on CROSS. But then, I'd need to rebuild perf for each toolchain,
bad idea.
Passing objdump in command line seems like a good compromise to me,
especially as I haven't noticed any other binutils tools to be used by
perf same way as objdump is.

-- 
Maciek Borzecki <maciek.borzecki@gmail.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf: allow user to indicate path to objdump in command line
  2012-09-04 10:32 [PATCH] perf: allow user to indicate path to objdump in command line Maciek Borzecki
  2012-09-04 16:05 ` David Ahern
@ 2012-09-05 21:11 ` David Ahern
  2012-09-07  6:10 ` [tip:perf/core] perf tools: Allow " tip-bot for Maciek Borzecki
  2 siblings, 0 replies; 6+ messages in thread
From: David Ahern @ 2012-09-05 21:11 UTC (permalink / raw)
  To: Maciek Borzecki, Arnaldo Carvalho de Melo; +Cc: linux-kernel, linux-perf-users

On 9/4/12 4:32 AM, Maciek Borzecki wrote:
> 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>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [tip:perf/core] perf tools: Allow user to indicate path to objdump in command line
  2012-09-04 10:32 [PATCH] perf: allow user to indicate path to objdump in command line Maciek Borzecki
  2012-09-04 16:05 ` David Ahern
  2012-09-05 21:11 ` David Ahern
@ 2012-09-07  6:10 ` tip-bot for Maciek Borzecki
  2 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Maciek Borzecki @ 2012-09-07  6:10 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, maciek.borzecki, hpa, mingo, dsahern, tglx

Commit-ID:  7a4ec938857cf534270b23545495300fbac7f5de
Gitweb:     http://git.kernel.org/tip/7a4ec938857cf534270b23545495300fbac7f5de
Author:     Maciek Borzecki <maciek.borzecki@gmail.com>
AuthorDate: Tue, 4 Sep 2012 12:32:30 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 5 Sep 2012 19:41:55 -0300

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>
---
 tools/perf/Documentation/perf-annotate.txt |    3 +++
 tools/perf/Documentation/perf-report.txt   |    3 +++
 tools/perf/builtin-annotate.c              |    2 ++
 tools/perf/builtin-report.c                |    2 ++
 tools/perf/util/annotate.c                 |    4 +++-
 tools/perf/util/annotate.h                 |    1 +
 6 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/tools/perf/Documentation/perf-annotate.txt b/tools/perf/Documentation/perf-annotate.txt
index c89f9e1..c8ffd9f 100644
--- a/tools/perf/Documentation/perf-annotate.txt
+++ b/tools/perf/Documentation/perf-annotate.txt
@@ -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]
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index 495210a..f4d91be 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -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]
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 67522cf..2f3f002 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -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()
 	};
 
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index d618253..1f8d11b 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -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()
 	};
 
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 3a282c0..51ef69c 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -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),
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index 78a5692..a6d6bc5 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -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 */

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-09-07  6:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-04 10:32 [PATCH] perf: allow user to indicate path to objdump in command line Maciek Borzecki
2012-09-04 16:05 ` David Ahern
2012-09-05  2:11   ` Michael Ellerman
2012-09-05  5:22     ` Maciek Borzecki
2012-09-05 21:11 ` David Ahern
2012-09-07  6:10 ` [tip:perf/core] perf tools: Allow " tip-bot for Maciek Borzecki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).