perf: introduce new two options for objdump.
PATCH 1/1 perf: introduce new two options for objdump.
Newly introduced options usedfull for off-box usage:
--objdump-prefix: specify prefix to add to the absolute paths where objdump looks for source files. --objdump-prefix-strip: indicate how many initial directory names to strip off the hardwired absolute paths, passed to objdump. It has no effect without --objdump-prefix.
--- tools/perf/Documentation/perf-annotate.txt | 6 ++++++ tools/perf/Documentation/perf-report.txt | 6 ++++++ tools/perf/Documentation/perf-top.txt | 10 ++++++++++ tools/perf/builtin-annotate.c | 5 +++++ tools/perf/builtin-report.c | 5 +++++ tools/perf/builtin-top.c | 5 +++++ tools/perf/util/annotate.c | 8 +++++++- tools/perf/util/annotate.h | 2 ++ 8 files changed, 46 insertions(+), 1 deletion(-)
tools/perf/Documentation/perf-annotate.txt +6 -0
@@ -90,6 +90,12 @@ OPTIONS --objdump=<path>:: Path to objdump binary. +--objdump-prefix=<path>:: + Specify prefix to add to the absolute paths where objdump looks for source files. + +--objdump-prefix-strip=<level>:: + Indicate how many initial directory names to strip off the hardwired absolute paths, passed to objdump. It has no effect without --objdump-prefix. + --skip-missing:: Skip symbols that cannot be annotated.
tools/perf/Documentation/perf-report.txt +6 -0
@@ -279,6 +279,12 @@ OPTIONS --objdump=<path>:: Path to objdump binary. +--objdump-prefix=<path>:: + Specify prefix to add to the absolute paths where objdump looks for source files. + +--objdump-prefix-strip=<level>:: + Indicate how many initial directory names to strip off the hardwired absolute paths, passed to objdump. It has no effect without --objdump-prefix. + --group:: Show event group information together.
tools/perf/Documentation/perf-top.txt +10 -0
@@ -157,6 +157,16 @@ Default is to monitor all CPUS. --asm-raw:: Show raw instruction encoding of assembly instructions. +--objdump=<path>:: + Path to objdump binary. + +--objdump-prefix=<path>:: + Specify prefix to add to the absolute paths where objdump looks for source files. + +--objdump-prefix-strip=<level>:: + Indicate how many initial directory names to strip off the hardwired absolute paths, passed to objdump. It has no effect without --objdump-prefix. + + -g:: Enables call-graph (stack chain/backtrace) recording.
tools/perf/builtin-annotate.c +5 -0
@@ -322,6 +322,11 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused) "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_STRING (0 ,"objdump-prefix" , &objdump_prefix_path,"path" , +"prefix to the absolute paths where objdump looks for source files" ), +OPT_STRING (0 ,"objdump-prefix-strip" , &objdump_prefix_strip,"level" , +"Indicate how many initial directory names to strip off the hardwired " +"absolute paths, passed to objdump." ),OPT_BOOLEAN (0 ,"group" , &symbol_conf.event_group,"Show event group information together" ),OPT_END ()
tools/perf/builtin-report.c +5 -0
@@ -712,6 +712,11 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) "add last branch records to call history"),OPT_STRING (0 ,"objdump" , &objdump_path,"path" ,"objdump binary to use for disassembly and annotations" ), +OPT_STRING (0 ,"objdump-prefix" , &objdump_prefix_path,"path" , +"prefix to the absolute paths where objdump looks for source files" ), +OPT_STRING (0 ,"objdump-prefix-strip" , &objdump_prefix_strip,"level" , +"Indicate how many initial directory names to strip off the hardwired " +"absolute paths, passed to objdump." ),OPT_BOOLEAN (0 ,"demangle" , &symbol_conf.demangle,"Disable symbol demangling" ), OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel,
tools/perf/builtin-top.c +5 -0
@@ -1147,6 +1147,11 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) "Enable kernel symbol demangling"),OPT_STRING (0 ,"objdump" , &objdump_path,"path" ,"objdump binary to use for disassembly and annotations" ), +OPT_STRING (0 ,"objdump-prefix" , &objdump_prefix_path,"path" , +"prefix to the absolute paths where objdump looks for source files" ), +OPT_STRING (0 ,"objdump-prefix-strip" , &objdump_prefix_strip,"level" , +"Indicate how many initial directory names to strip off the hardwired " +"absolute paths, passed to objdump." ),OPT_STRING ('M' ,"disassembler-style" , &disassembler_style,"disassembler style" ,"Specify disassembler style (e.g. -M intel for intel syntax)" ), OPT_STRING('u', "uid", &target->uid_str, "user", "user to profile"),
tools/perf/util/annotate.c +7 -1
@@ -23,6 +23,8 @@const char *disassembler_style;const char *objdump_path; +const char *objdump_prefix_path; +const char *objdump_prefix_strip;static regex_t file_lineno;static struct ins *ins__find (const char *name);
@@ -1001,12 +1003,16 @@ fallback: } snprintf(command, sizeof(command), - "%s %s%s --start-address=0x%016" PRIx64 + "%s %s%s %s%s %s%s --start-address=0x%016" PRIx64 " --stop-address=0x%016" PRIx64 " -l -d %s %s -C %s 2>/dev/null|grep -v %s|expand", objdump_path ? objdump_path : "objdump", disassembler_style ? "-M " : "", disassembler_style ? disassembler_style : "", + objdump_prefix_path ? "--prefix=" : "", + objdump_prefix_path ? objdump_prefix_path : "", + objdump_prefix_strip ? "--prefix-strip=" : "", + objdump_prefix_strip ? objdump_prefix_strip : "", map__rip_2objdump(map, sym->start), map__rip_2objdump(map, sym->end), symbol_conf.annotate_asm_raw ? "" : "--no-show-raw",
tools/perf/util/annotate.h +2 -0
@@ -168,5 +168,7 @@ static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused,#endif extern const char *disassembler_style; +extern const char *objdump_prefix_path; +extern const char *objdump_prefix_strip;#endif /* __PERF_ANNOTATE_H */
Signature · 1 line
2.1.2
Arnaldo Carvalho de Melo
maintainerEm Thu, Jan 29, 2015 at 02:03:46PM +0100, Martin Liška escreveu:
Quoted 1 line
Newly introduced options usedfull for off-box usage:
New useful options for off-box usage:
Quoted 5 lines
--objdump-prefix: specify prefix to add to the absolute paths where objdump looks for source files. --objdump-prefix-strip: indicate how many initial directory names to strip off the hardwired absolute paths, passed to objdump. It has no effect without --objdump-prefix.
Does this, for instance, allows one looking at source code + assembly with debuginfo packages? Is that a usecase you tested this against?
Anyway, sorry for the delay in processing this, fell thru the cracks ;-\
Can you please respin this on top of my current perf/core, at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git
Thanks a lot!
- Arnaldo
Quoted 150 lines
Signed-off-by Martin Liska <[email protected]>--- tools/perf/Documentation/perf-annotate.txt | 6 ++++++ tools/perf/Documentation/perf-report.txt | 6 ++++++ tools/perf/Documentation/perf-top.txt | 10 ++++++++++ tools/perf/builtin-annotate.c | 5 +++++ tools/perf/builtin-report.c | 5 +++++ tools/perf/builtin-top.c | 5 +++++ tools/perf/util/annotate.c | 8 +++++++- tools/perf/util/annotate.h | 2 ++ 8 files changed, 46 insertions(+), 1 deletion(-)tools/perf/Documentation/perf-annotate.txt +6
-0@@ -90,6 +90,12 @@ OPTIONS --objdump=<path>:: Path to objdump binary. +--objdump-prefix=<path>:: + Specify prefix to add to the absolute paths where objdump looks for source files. + +--objdump-prefix-strip=<level>:: + Indicate how many initial directory names to strip off the hardwired absolute paths, passed to objdump. It has no effect without --objdump-prefix. + --skip-missing:: Skip symbols that cannot be annotated.tools/perf/Documentation/perf-report.txt +6
-0@@ -279,6 +279,12 @@ OPTIONS --objdump=<path>:: Path to objdump binary. +--objdump-prefix=<path>:: + Specify prefix to add to the absolute paths where objdump looks for source files. + +--objdump-prefix-strip=<level>:: + Indicate how many initial directory names to strip off the hardwired absolute paths, passed to objdump. It has no effect without --objdump-prefix. + --group:: Show event group information together.tools/perf/Documentation/perf-top.txt +10
-0@@ -157,6 +157,16 @@ Default is to monitor all CPUS. --asm-raw:: Show raw instruction encoding of assembly instructions. +--objdump=<path>:: + Path to objdump binary. + +--objdump-prefix=<path>:: + Specify prefix to add to the absolute paths where objdump looks for source files. + +--objdump-prefix-strip=<level>:: + Indicate how many initial directory names to strip off the hardwired absolute paths, passed to objdump. It has no effect without --objdump-prefix. + + -g:: Enables call-graph (stack chain/backtrace) recording.tools/perf/builtin-annotate.c +5
-0@@ -322,6 +322,11 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused) "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_STRING (0 ,"objdump-prefix" , &objdump_prefix_path,"path" , +"prefix to the absolute paths where objdump looks for source files" ), +OPT_STRING (0 ,"objdump-prefix-strip" , &objdump_prefix_strip,"level" , +"Indicate how many initial directory names to strip off the hardwired " +"absolute paths, passed to objdump." ),OPT_BOOLEAN (0 ,"group" , &symbol_conf.event_group,"Show event group information together" ),OPT_END ()tools/perf/builtin-report.c +5
-0@@ -712,6 +712,11 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) "add last branch records to call history"),OPT_STRING (0 ,"objdump" , &objdump_path,"path" ,"objdump binary to use for disassembly and annotations" ), +OPT_STRING (0 ,"objdump-prefix" , &objdump_prefix_path,"path" , +"prefix to the absolute paths where objdump looks for source files" ), +OPT_STRING (0 ,"objdump-prefix-strip" , &objdump_prefix_strip,"level" , +"Indicate how many initial directory names to strip off the hardwired " +"absolute paths, passed to objdump." ),OPT_BOOLEAN (0 ,"demangle" , &symbol_conf.demangle,"Disable symbol demangling" ), OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel,tools/perf/builtin-top.c +5
-0@@ -1147,6 +1147,11 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) "Enable kernel symbol demangling"),OPT_STRING (0 ,"objdump" , &objdump_path,"path" ,"objdump binary to use for disassembly and annotations" ), +OPT_STRING (0 ,"objdump-prefix" , &objdump_prefix_path,"path" , +"prefix to the absolute paths where objdump looks for source files" ), +OPT_STRING (0 ,"objdump-prefix-strip" , &objdump_prefix_strip,"level" , +"Indicate how many initial directory names to strip off the hardwired " +"absolute paths, passed to objdump." ),OPT_STRING ('M' ,"disassembler-style" , &disassembler_style,"disassembler style" ,"Specify disassembler style (e.g. -M intel for intel syntax)" ), OPT_STRING('u', "uid", &target->uid_str, "user", "user to profile"),tools/perf/util/annotate.c +7
-1@@ -23,6 +23,8 @@const char *disassembler_style;const char *objdump_path; +const char *objdump_prefix_path; +const char *objdump_prefix_strip;static regex_t file_lineno;static struct ins *ins__find (const char *name);@@ -1001,12 +1003,16 @@ fallback: } snprintf(command, sizeof(command), - "%s %s%s --start-address=0x%016" PRIx64 + "%s %s%s %s%s %s%s --start-address=0x%016" PRIx64 " --stop-address=0x%016" PRIx64 " -l -d %s %s -C %s 2>/dev/null|grep -v %s|expand", objdump_path ? objdump_path : "objdump", disassembler_style ? "-M " : "", disassembler_style ? disassembler_style : "", + objdump_prefix_path ? "--prefix=" : "", + objdump_prefix_path ? objdump_prefix_path : "", + objdump_prefix_strip ? "--prefix-strip=" : "", + objdump_prefix_strip ? objdump_prefix_strip : "", map__rip_2objdump(map, sym->start), map__rip_2objdump(map, sym->end), symbol_conf.annotate_asm_raw ? "" : "--no-show-raw",tools/perf/util/annotate.h +2
-0@@ -168,5 +168,7 @@ static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused,#endif extern const char *disassembler_style; +extern const char *objdump_prefix_path; +extern const char *objdump_prefix_strip;#endif /* __PERF_ANNOTATE_H */ Signature · 1 line
2.1.2
Quoted 14 lines · Arnaldo Carvalho de Melo
Em Thu, Jan 29, 2015 at 02:03:46PM +0100, Martin Liška escreveu:
Quoted 1 line
Newly introduced options usedfull for off-box usage:
New useful options for off-box usage:
Quoted 5 lines
--objdump-prefix: specify prefix to add to the absolute paths where objdump looks for source files. --objdump-prefix-strip: indicate how many initial directory names to strip off the hardwired absolute paths, passed to objdump. It has no effect without --objdump-prefix.
Does this, for instance, allows one looking at source code + assembly with debuginfo packages? Is that a usecase you tested this against?
Quoted 7 lines
Anyway, sorry for the delay in processing this, fell thru the cracks ;-\
Can you please respin this on top of my current perf/core, at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.gitThanks a lot!
Perhaps it should be generalized a bit? Right now we have symfs for the location of the tree for binaries. What about a srcfs for a source tree?
Arnaldo Carvalho de Melo
maintainerEm Tue, May 19, 2015 at 08:29:58AM -0600, David Ahern escreveu:
Quoted 15 lines · Arnaldo Carvalho de Melo
Quoted 13 lines
Em Thu, Jan 29, 2015 at 02:03:46PM +0100, Martin Liška escreveu:
Quoted 1 line
Newly introduced options usedfull for off-box usage:
New useful options for off-box usage:
Quoted 5 lines
--objdump-prefix: specify prefix to add to the absolute paths where objdump looks for source files. --objdump-prefix-strip: indicate how many initial directory names to strip off the hardwired absolute paths, passed to objdump. It has no effect without --objdump-prefix.
Does this, for instance, allows one looking at source code + assembly with debuginfo packages? Is that a usecase you tested this against?
Quoted 8 lines
Quoted 5 lines
Anyway, sorry for the delay in processing this, fell thru the cracks ;-\
Can you please respin this on top of my current perf/core, at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.gitPerhaps it should be generalized a bit? Right now we have symfs for the location of the tree for binaries. What about a srcfs for a source tree?
That is a good idea indeed.
- Arnaldo
Quoted 20 lines · Arnaldo Carvalho de Melo
Em Tue, May 19, 2015 at 08:29:58AM -0600, David Ahern escreveu:
Quoted 18 lines · Arnaldo Carvalho de Melo
Quoted 17 lines
Em Thu, Jan 29, 2015 at 02:03:46PM +0100, Martin Liška escreveu:
Quoted 1 line
Newly introduced options usedfull for off-box usage:
New useful options for off-box usage:
Quoted 5 lines
--objdump-prefix: specify prefix to add to the absolute paths where objdump looks for source files. --objdump-prefix-strip: indicate how many initial directory names to strip off the hardwired absolute paths, passed to objdump. It has no effect without --objdump-prefix.
Does this, for instance, allows one looking at source code + assembly with debuginfo packages? Is that a usecase you tested this against?
Anyway, sorry for the delay in processing this, fell thru the cracks ;-\
Can you please respin this on top of my current perf/core, at:
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.gitPerhaps it should be generalized a bit? Right now we have symfs for the location of the tree for binaries. What about a srcfs for a source tree?
That is a good idea indeed.
- Arnaldo
Hello.
I was motivated to be able to annotate source code, realized out-of-box. More precisely, on a machine A I run perf record, I moved the report file to machine B and I use these options to annotate source code.
Let's consider source code location
Machine A:
P1=/a/b/c/d/source-files
Machine B:
P2=/x/y/z/source-files
Using just a single option (--objdump-prefix) works, but one how to place source code on machine B to:
/a/b/c/d/x/y/z/source-files
That's quite cumbersome, thus adding second option, one can strip '/a/b/c/d', with --objdump-prefix-strip=4. Still, no ideal, but it's quite flexible. A new 'srcfs' can used as --objdump-prefix, am I right?
Respun version of patch is attached.
Thanks,
Martin
tools/perf/Documentation/perf-annotate.txt +6 -0
@@ -90,6 +90,12 @@ OPTIONS --objdump=<path>:: Path to objdump binary. +--objdump-prefix=<path>:: + Specify prefix to add to the absolute paths where objdump looks for source files. + +--objdump-prefix-strip=<level>:: + Indicate how many initial directory names to strip off the hardwired absolute paths, passed to objdump. It has no effect without --objdump-prefix. + --skip-missing:: Skip symbols that cannot be annotated.
tools/perf/Documentation/perf-report.txt +6 -0
@@ -286,6 +286,12 @@ OPTIONS --objdump=<path>:: Path to objdump binary. +--objdump-prefix=<path>:: + Specify prefix to add to the absolute paths where objdump looks for source files. + +--objdump-prefix-strip=<level>:: + Indicate how many initial directory names to strip off the hardwired absolute paths, passed to objdump. It has no effect without --objdump-prefix. + --group:: Show event group information together.
tools/perf/Documentation/perf-top.txt +10 -0
@@ -157,6 +157,16 @@ Default is to monitor all CPUS. --asm-raw:: Show raw instruction encoding of assembly instructions. +--objdump=<path>:: + Path to objdump binary. + +--objdump-prefix=<path>:: + Specify prefix to add to the absolute paths where objdump looks for source files. + +--objdump-prefix-strip=<level>:: + Indicate how many initial directory names to strip off the hardwired absolute paths, passed to objdump. It has no effect without --objdump-prefix. + + -g:: Enables call-graph (stack chain/backtrace) recording.
tools/perf/builtin-annotate.c +5 -0
@@ -324,6 +324,11 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused) "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_STRING (0 ,"objdump-prefix" , &objdump_prefix_path,"path" , +"prefix to the absolute paths where objdump looks for source files" ), +OPT_STRING (0 ,"objdump-prefix-strip" , &objdump_prefix_strip,"level" , +"Indicate how many initial directory names to strip off the hardwired " +"absolute paths, passed to objdump." ),OPT_BOOLEAN (0 ,"group" , &symbol_conf.event_group,"Show event group information together" ),OPT_END ()
tools/perf/builtin-report.c +5 -0
@@ -715,6 +715,11 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) "add last branch records to call history"),OPT_STRING (0 ,"objdump" , &objdump_path,"path" ,"objdump binary to use for disassembly and annotations" ), +OPT_STRING (0 ,"objdump-prefix" , &objdump_prefix_path,"path" , +"prefix to the absolute paths where objdump looks for source files" ), +OPT_STRING (0 ,"objdump-prefix-strip" , &objdump_prefix_strip,"level" , +"Indicate how many initial directory names to strip off the hardwired " +"absolute paths, passed to objdump." ),OPT_BOOLEAN (0 ,"demangle" , &symbol_conf.demangle,"Disable symbol demangling" ), OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel,
tools/perf/builtin-top.c +5 -0
@@ -1150,6 +1150,11 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) "Enable kernel symbol demangling"),OPT_STRING (0 ,"objdump" , &objdump_path,"path" ,"objdump binary to use for disassembly and annotations" ), +OPT_STRING (0 ,"objdump-prefix" , &objdump_prefix_path,"path" , +"prefix to the absolute paths where objdump looks for source files" ), +OPT_STRING (0 ,"objdump-prefix-strip" , &objdump_prefix_strip,"level" , +"Indicate how many initial directory names to strip off the hardwired " +"absolute paths, passed to objdump." ),OPT_STRING ('M' ,"disassembler-style" , &disassembler_style,"disassembler style" ,"Specify disassembler style (e.g. -M intel for intel syntax)" ), OPT_STRING('u', "uid", &target->uid_str, "user", "user to profile"),
tools/perf/util/annotate.c +7 -1
@@ -23,6 +23,8 @@const char *disassembler_style;const char *objdump_path; +const char *objdump_prefix_path; +const char *objdump_prefix_strip;static regex_t file_lineno;static struct ins *ins__find (const char *name);
@@ -1039,12 +1041,16 @@ fallback: } snprintf(command, sizeof(command), - "%s %s%s --start-address=0x%016" PRIx64 + "%s %s%s %s%s %s%s --start-address=0x%016" PRIx64 " --stop-address=0x%016" PRIx64 " -l -d %s %s -C %s 2>/dev/null|grep -v %s|expand", objdump_path ? objdump_path : "objdump", disassembler_style ? "-M " : "", disassembler_style ? disassembler_style : "", + objdump_prefix_path ? "--prefix=" : "", + objdump_prefix_path ? objdump_prefix_path : "", + objdump_prefix_strip ? "--prefix-strip=" : "", + objdump_prefix_strip ? objdump_prefix_strip : "", map__rip_2objdump(map, sym->start), map__rip_2objdump(map, sym->end), symbol_conf.annotate_asm_raw ? "" : "--no-show-raw",
tools/perf/util/annotate.h +2 -0
@@ -168,5 +168,7 @@ static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused,#endif extern const char *disassembler_style; +extern const char *objdump_prefix_path; +extern const char *objdump_prefix_strip;#endif /* __PERF_ANNOTATE_H */
Arnaldo Carvalho de Melo
maintainerEm Wed, May 20, 2015 at 03:02:01PM +0200, Martin Liška escreveu:
Quoted 41 lines · Arnaldo Carvalho de Melo
Quoted 20 lines
Em Tue, May 19, 2015 at 08:29:58AM -0600, David Ahern escreveu:
Quoted 18 lines · Arnaldo Carvalho de Melo
Quoted 17 lines
Em Thu, Jan 29, 2015 at 02:03:46PM +0100, Martin Liška escreveu:
Quoted 1 line
Newly introduced options usedfull for off-box usage:
New useful options for off-box usage:
Quoted 5 lines
--objdump-prefix: specify prefix to add to the absolute paths where objdump looks for source files. --objdump-prefix-strip: indicate how many initial directory names to strip off the hardwired absolute paths, passed to objdump. It has no effect without --objdump-prefix.
Does this, for instance, allows one looking at source code + assembly with debuginfo packages? Is that a usecase you tested this against?
Anyway, sorry for the delay in processing this, fell thru the cracks ;-\
Can you please respin this on top of my current perf/core, at:
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.gitPerhaps it should be generalized a bit? Right now we have symfs for the location of the tree for binaries. What about a srcfs for a source tree?
That is a good idea indeed.
- Arnaldo
Hello.
I was motivated to be able to annotate source code, realized out-of-box. More precisely, on a machine A I run perf record, I moved the report file to machine B and I use these options to annotate source code.
Let's consider source code location
Machine A:
P1=/a/b/c/d/source-files
Quoted 8 lines
Machine B:
P2=/x/y/z/source-filesUsing just a single option (--objdump-prefix) works, but one how to place source code on machine B to:
/a/b/c/d/x/y/z/source-filesThat's quite cumbersome, thus adding second option, one can strip '/a/b/c/d', with --objdump-prefix-strip=4. Still, no ideal, but it's quite flexible. A new 'srcfs' can used as --objdump-prefix, am I right?
I guess so, and yeah, the feature implemented in your patch has value, thanks for collaborating! It is just that it may fit better as a complement to the --symfs stuff, that is also for off-box analysis:
--symfs=<directory>::
Look for files with symbols relative to this directory.
Quoted 1 line
Respun version of patch is attached.
Thanks, will wait for further discussion before applying,
- Arnaldo
Quoted 150 lines
Thanks,
Martintools/perf/Documentation/perf-annotate.txt +6
-0@@ -90,6 +90,12 @@ OPTIONS --objdump=<path>:: Path to objdump binary. +--objdump-prefix=<path>:: + Specify prefix to add to the absolute paths where objdump looks for source files. + +--objdump-prefix-strip=<level>:: + Indicate how many initial directory names to strip off the hardwired absolute paths, passed to objdump. It has no effect without --objdump-prefix. + --skip-missing:: Skip symbols that cannot be annotated.tools/perf/Documentation/perf-report.txt +6
-0@@ -286,6 +286,12 @@ OPTIONS --objdump=<path>:: Path to objdump binary. +--objdump-prefix=<path>:: + Specify prefix to add to the absolute paths where objdump looks for source files. + +--objdump-prefix-strip=<level>:: + Indicate how many initial directory names to strip off the hardwired absolute paths, passed to objdump. It has no effect without --objdump-prefix. + --group:: Show event group information together.tools/perf/Documentation/perf-top.txt +10
-0@@ -157,6 +157,16 @@ Default is to monitor all CPUS. --asm-raw:: Show raw instruction encoding of assembly instructions. +--objdump=<path>:: + Path to objdump binary. + +--objdump-prefix=<path>:: + Specify prefix to add to the absolute paths where objdump looks for source files. + +--objdump-prefix-strip=<level>:: + Indicate how many initial directory names to strip off the hardwired absolute paths, passed to objdump. It has no effect without --objdump-prefix. + + -g:: Enables call-graph (stack chain/backtrace) recording.tools/perf/builtin-annotate.c +5
-0@@ -324,6 +324,11 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused) "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_STRING (0 ,"objdump-prefix" , &objdump_prefix_path,"path" , +"prefix to the absolute paths where objdump looks for source files" ), +OPT_STRING (0 ,"objdump-prefix-strip" , &objdump_prefix_strip,"level" , +"Indicate how many initial directory names to strip off the hardwired " +"absolute paths, passed to objdump." ),OPT_BOOLEAN (0 ,"group" , &symbol_conf.event_group,"Show event group information together" ),OPT_END ()tools/perf/builtin-report.c +5
-0@@ -715,6 +715,11 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) "add last branch records to call history"),OPT_STRING (0 ,"objdump" , &objdump_path,"path" ,"objdump binary to use for disassembly and annotations" ), +OPT_STRING (0 ,"objdump-prefix" , &objdump_prefix_path,"path" , +"prefix to the absolute paths where objdump looks for source files" ), +OPT_STRING (0 ,"objdump-prefix-strip" , &objdump_prefix_strip,"level" , +"Indicate how many initial directory names to strip off the hardwired " +"absolute paths, passed to objdump." ),OPT_BOOLEAN (0 ,"demangle" , &symbol_conf.demangle,"Disable symbol demangling" ), OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel,tools/perf/builtin-top.c +5
-0@@ -1150,6 +1150,11 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) "Enable kernel symbol demangling"),OPT_STRING (0 ,"objdump" , &objdump_path,"path" ,"objdump binary to use for disassembly and annotations" ), +OPT_STRING (0 ,"objdump-prefix" , &objdump_prefix_path,"path" , +"prefix to the absolute paths where objdump looks for source files" ), +OPT_STRING (0 ,"objdump-prefix-strip" , &objdump_prefix_strip,"level" , +"Indicate how many initial directory names to strip off the hardwired " +"absolute paths, passed to objdump." ),OPT_STRING ('M' ,"disassembler-style" , &disassembler_style,"disassembler style" ,"Specify disassembler style (e.g. -M intel for intel syntax)" ), OPT_STRING('u', "uid", &target->uid_str, "user", "user to profile"),tools/perf/util/annotate.c +7
-1@@ -23,6 +23,8 @@const char *disassembler_style;const char *objdump_path; +const char *objdump_prefix_path; +const char *objdump_prefix_strip;static regex_t file_lineno;static struct ins *ins__find (const char *name);@@ -1039,12 +1041,16 @@ fallback: } snprintf(command, sizeof(command), - "%s %s%s --start-address=0x%016" PRIx64 + "%s %s%s %s%s %s%s --start-address=0x%016" PRIx64 " --stop-address=0x%016" PRIx64 " -l -d %s %s -C %s 2>/dev/null|grep -v %s|expand", objdump_path ? objdump_path : "objdump", disassembler_style ? "-M " : "", disassembler_style ? disassembler_style : "", + objdump_prefix_path ? "--prefix=" : "", + objdump_prefix_path ? objdump_prefix_path : "", + objdump_prefix_strip ? "--prefix-strip=" : "", + objdump_prefix_strip ? objdump_prefix_strip : "", map__rip_2objdump(map, sym->start), map__rip_2objdump(map, sym->end), symbol_conf.annotate_asm_raw ? "" : "--no-show-raw",tools/perf/util/annotate.h +2
-0@@ -168,5 +168,7 @@ static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused,#endif extern const char *disassembler_style; +extern const char *objdump_prefix_path; +extern const char *objdump_prefix_strip;#endif /* __PERF_ANNOTATE_H */
Quoted 55 lines · Arnaldo Carvalho de Melo
Em Wed, May 20, 2015 at 03:02:01PM +0200, Martin Liška escreveu:
Quoted 41 lines · Arnaldo Carvalho de Melo
Quoted 20 lines
Em Tue, May 19, 2015 at 08:29:58AM -0600, David Ahern escreveu:
Quoted 18 lines · Arnaldo Carvalho de Melo
Quoted 17 lines
Em Thu, Jan 29, 2015 at 02:03:46PM +0100, Martin Liška escreveu:
Quoted 1 line
Newly introduced options usedfull for off-box usage:
New useful options for off-box usage:
Quoted 5 lines
--objdump-prefix: specify prefix to add to the absolute paths where objdump looks for source files. --objdump-prefix-strip: indicate how many initial directory names to strip off the hardwired absolute paths, passed to objdump. It has no effect without --objdump-prefix.
Does this, for instance, allows one looking at source code + assembly with debuginfo packages? Is that a usecase you tested this against?
Anyway, sorry for the delay in processing this, fell thru the cracks ;-\
Can you please respin this on top of my current perf/core, at:
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.gitPerhaps it should be generalized a bit? Right now we have symfs for the location of the tree for binaries. What about a srcfs for a source tree?
That is a good idea indeed.
- Arnaldo
Hello.
I was motivated to be able to annotate source code, realized out-of-box. More precisely, on a machine A I run perf record, I moved the report file to machine B and I use these options to annotate source code.
Let's consider source code location
Machine A:
P1=/a/b/c/d/source-filesQuoted 8 lines
Machine B:
P2=/x/y/z/source-filesUsing just a single option (--objdump-prefix) works, but one how to place source code on machine B to:
/a/b/c/d/x/y/z/source-filesThat's quite cumbersome, thus adding second option, one can strip '/a/b/c/d', with --objdump-prefix-strip=4. Still, no ideal, but it's quite flexible. A new 'srcfs' can used as --objdump-prefix, am I right?
I guess so, and yeah, the feature implemented in your patch has value, thanks for collaborating! It is just that it may fit better as a complement to the --symfs stuff, that is also for off-box analysis:
Quoted 8 lines
--symfs=<directory>::
Look for files with symbols relative to this directory.Quoted 1 line
Respun version of patch is attached.
Thanks, will wait for further discussion before applying,
- Arnaldo
Hello Arnaldo.
Are we going to wait any longer? It looks there's no discussion effort in this thread ;)
Thanks,
Martin
Quoted 152 lines
Quoted 151 lines
Thanks,
Martintools/perf/Documentation/perf-annotate.txt +6
-0@@ -90,6 +90,12 @@ OPTIONS --objdump=<path>:: Path to objdump binary. +--objdump-prefix=<path>:: + Specify prefix to add to the absolute paths where objdump looks for source files. + +--objdump-prefix-strip=<level>:: + Indicate how many initial directory names to strip off the hardwired absolute paths, passed to objdump. It has no effect without --objdump-prefix. + --skip-missing:: Skip symbols that cannot be annotated.tools/perf/Documentation/perf-report.txt +6
-0@@ -286,6 +286,12 @@ OPTIONS --objdump=<path>:: Path to objdump binary. +--objdump-prefix=<path>:: + Specify prefix to add to the absolute paths where objdump looks for source files. + +--objdump-prefix-strip=<level>:: + Indicate how many initial directory names to strip off the hardwired absolute paths, passed to objdump. It has no effect without --objdump-prefix. + --group:: Show event group information together.tools/perf/Documentation/perf-top.txt +10
-0@@ -157,6 +157,16 @@ Default is to monitor all CPUS. --asm-raw:: Show raw instruction encoding of assembly instructions. +--objdump=<path>:: + Path to objdump binary. + +--objdump-prefix=<path>:: + Specify prefix to add to the absolute paths where objdump looks for source files. + +--objdump-prefix-strip=<level>:: + Indicate how many initial directory names to strip off the hardwired absolute paths, passed to objdump. It has no effect without --objdump-prefix. + + -g:: Enables call-graph (stack chain/backtrace) recording.tools/perf/builtin-annotate.c +5
-0@@ -324,6 +324,11 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused) "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_STRING (0 ,"objdump-prefix" , &objdump_prefix_path,"path" , +"prefix to the absolute paths where objdump looks for source files" ), +OPT_STRING (0 ,"objdump-prefix-strip" , &objdump_prefix_strip,"level" , +"Indicate how many initial directory names to strip off the hardwired " +"absolute paths, passed to objdump." ),OPT_BOOLEAN (0 ,"group" , &symbol_conf.event_group,"Show event group information together" ),OPT_END ()tools/perf/builtin-report.c +5
-0@@ -715,6 +715,11 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused) "add last branch records to call history"),OPT_STRING (0 ,"objdump" , &objdump_path,"path" ,"objdump binary to use for disassembly and annotations" ), +OPT_STRING (0 ,"objdump-prefix" , &objdump_prefix_path,"path" , +"prefix to the absolute paths where objdump looks for source files" ), +OPT_STRING (0 ,"objdump-prefix-strip" , &objdump_prefix_strip,"level" , +"Indicate how many initial directory names to strip off the hardwired " +"absolute paths, passed to objdump." ),OPT_BOOLEAN (0 ,"demangle" , &symbol_conf.demangle,"Disable symbol demangling" ), OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel,tools/perf/builtin-top.c +5
-0@@ -1150,6 +1150,11 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) "Enable kernel symbol demangling"),OPT_STRING (0 ,"objdump" , &objdump_path,"path" ,"objdump binary to use for disassembly and annotations" ), +OPT_STRING (0 ,"objdump-prefix" , &objdump_prefix_path,"path" , +"prefix to the absolute paths where objdump looks for source files" ), +OPT_STRING (0 ,"objdump-prefix-strip" , &objdump_prefix_strip,"level" , +"Indicate how many initial directory names to strip off the hardwired " +"absolute paths, passed to objdump." ),OPT_STRING ('M' ,"disassembler-style" , &disassembler_style,"disassembler style" ,"Specify disassembler style (e.g. -M intel for intel syntax)" ), OPT_STRING('u', "uid", &target->uid_str, "user", "user to profile"),tools/perf/util/annotate.c +7
-1@@ -23,6 +23,8 @@const char *disassembler_style;const char *objdump_path; +const char *objdump_prefix_path; +const char *objdump_prefix_strip;static regex_t file_lineno;static struct ins *ins__find (const char *name);@@ -1039,12 +1041,16 @@ fallback: } snprintf(command, sizeof(command), - "%s %s%s --start-address=0x%016" PRIx64 + "%s %s%s %s%s %s%s --start-address=0x%016" PRIx64 " --stop-address=0x%016" PRIx64 " -l -d %s %s -C %s 2>/dev/null|grep -v %s|expand", objdump_path ? objdump_path : "objdump", disassembler_style ? "-M " : "", disassembler_style ? disassembler_style : "", + objdump_prefix_path ? "--prefix=" : "", + objdump_prefix_path ? objdump_prefix_path : "", + objdump_prefix_strip ? "--prefix-strip=" : "", + objdump_prefix_strip ? objdump_prefix_strip : "", map__rip_2objdump(map, sym->start), map__rip_2objdump(map, sym->end), symbol_conf.annotate_asm_raw ? "" : "--no-show-raw",tools/perf/util/annotate.h +2
-0@@ -168,5 +168,7 @@ static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused,#endif extern const char *disassembler_style; +extern const char *objdump_prefix_path; +extern const char *objdump_prefix_strip;#endif /* __PERF_ANNOTATE_H */
Arnaldo Carvalho de Melo
maintainerEm Mon, Jun 01, 2015 at 01:10:06PM +0200, Martin Liška escreveu:
Quoted 4 lines · Arnaldo Carvalho de Melo
Quoted 3 lines
Em Wed, May 20, 2015 at 03:02:01PM +0200, Martin Liška escreveu:
Quoted 2 lines · Arnaldo Carvalho de Melo
Quoted 1 line
Em Tue, May 19, 2015 at 08:29:58AM -0600, David Ahern escreveu:
<SNIP>
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Perhaps it should be generalized a bit? Right now we have symfs for the location of the tree for binaries. What about a srcfs for a source tree?
That is a good idea indeed.
I was motivated to be able to annotate source code, realized out-of-box. More precisely, on a machine A I run perf record, I moved the report file to machine B and I use these options to annotate source code.
<SNIP>
Quoted 10 lines
Quoted 8 lines
I guess so, and yeah, the feature implemented in your patch has value, thanks for collaborating! It is just that it may fit better as a complement to the --symfs stuff, that is also for off-box analysis:
--symfs=<directory>::
Look for files with symbols relative to this directory.Thanks, will wait for further discussion before applying,
Are we going to wait any longer? It looks there's no discussion effort in this thread ;)
I was waiting for you to follow thru on David's suggestion.
- Arnaldo
Quoted 25 lines · Arnaldo Carvalho de Melo
Em Mon, Jun 01, 2015 at 01:10:06PM +0200, Martin Liška escreveu:
Quoted 4 lines · Arnaldo Carvalho de Melo
Quoted 3 lines
Em Wed, May 20, 2015 at 03:02:01PM +0200, Martin Liška escreveu:
Quoted 2 lines · Arnaldo Carvalho de Melo
Quoted 1 line
Em Tue, May 19, 2015 at 08:29:58AM -0600, David Ahern escreveu:
<SNIP>
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Perhaps it should be generalized a bit? Right now we have symfs for the location of the tree for binaries. What about a srcfs for a source tree?
That is a good idea indeed.
I was motivated to be able to annotate source code, realized out-of-box. More precisely, on a machine A I run perf record, I moved the report file to machine B and I use these options to annotate source code.
<SNIP>
Quoted 6 lines
Quoted 6 lines
I guess so, and yeah, the feature implemented in your patch has value, thanks for collaborating! It is just that it may fit better as a complement to the --symfs stuff, that is also for off-box analysis:
--symfs=<directory>::
Look for files with symbols relative to this directory.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Thanks, will wait for further discussion before applying,
Are we going to wait any longer? It looks there's no discussion effort in this thread ;)
I was waiting for you to follow thru on David's suggestion.
- Arnaldo
Ah, I see.
My answer what kind of that a single new option is no going to enough. As explained in my previous post, one needs to cut N components of a path and append a different path.
I would follow option names starting with --objdump prefix.
Thanks,
Martin
Arnaldo Carvalho de Melo
maintainerEm Mon, Jun 01, 2015 at 03:58:16PM +0200, Martin Liška escreveu:
Quoted 30 lines · Arnaldo Carvalho de Melo
Quoted 29 lines
Em Mon, Jun 01, 2015 at 01:10:06PM +0200, Martin Liška escreveu:
Quoted 4 lines · Arnaldo Carvalho de Melo
Quoted 3 lines
Em Wed, May 20, 2015 at 03:02:01PM +0200, Martin Liška escreveu:
Quoted 2 lines · Arnaldo Carvalho de Melo
Quoted 1 line
Em Tue, May 19, 2015 at 08:29:58AM -0600, David Ahern escreveu:
<SNIP>
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Perhaps it should be generalized a bit? Right now we have symfs for the location of the tree for binaries. What about a srcfs for a source tree?
That is a good idea indeed.
I was motivated to be able to annotate source code, realized out-of-box. More precisely, on a machine A I run perf record, I moved the report file to machine B and I use these options to annotate source code.
<SNIP>
Quoted 10 lines
Quoted 8 lines
I guess so, and yeah, the feature implemented in your patch has value, thanks for collaborating! It is just that it may fit better as a complement to the --symfs stuff, that is also for off-box analysis:
--symfs=<directory>::
Look for files with symbols relative to this directory.Thanks, will wait for further discussion before applying,
Are we going to wait any longer? It looks there's no discussion effort in this thread ;)
Quoted 7 lines
Quoted 1 line
I was waiting for you to follow thru on David's suggestion.
Ah, I see.
My answer what kind of that a single new option is no going to enough. As explained in my previous post, one needs to cut N components of a path and append a different path.I would follow option names starting with --objdump prefix.
David, do you agree?
- Arnaldo