aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2013-08-07 07:38:54 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-08-07 16:35:34 -0400
commitbbb7f846f88df05646795854a014d73fb00f3b8b (patch)
tree0c2639ffe7ba44990eec597fe18448ca9a747b97 /tools/perf
parent7a77bc2c0d2726a7fc9e6b91b36f984c3e377008 (diff)
perf annotate: Allow disassembly using /proc/kcore
Annotation with /proc/kcore is possible so the logic is adjusted to allow it. The main difference is that /proc/kcore had no symbols so the parsing logic needed a tweak to read jump offsets. The other difference is that objdump cannot always read from kcore. That seems to be a bug with objdump. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1375875537-4509-11-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/builtin-top.c3
-rw-r--r--tools/perf/util/annotate.c13
2 files changed, 11 insertions, 5 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 9101f7cf2587..440c3b371401 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -103,7 +103,8 @@ static int perf_top__parse_source(struct perf_top *top, struct hist_entry *he)
103 /* 103 /*
104 * We can't annotate with just /proc/kallsyms 104 * We can't annotate with just /proc/kallsyms
105 */ 105 */
106 if (map->dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS) { 106 if (map->dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS &&
107 !dso__is_kcore(map->dso)) {
107 pr_err("Can't annotate %s: No vmlinux file was found in the " 108 pr_err("Can't annotate %s: No vmlinux file was found in the "
108 "path\n", sym->name); 109 "path\n", sym->name);
109 sleep(1); 110 sleep(1);
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index d102716c43a1..4ab2f11ee6f4 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -110,10 +110,10 @@ static int jump__parse(struct ins_operands *ops)
110{ 110{
111 const char *s = strchr(ops->raw, '+'); 111 const char *s = strchr(ops->raw, '+');
112 112
113 ops->target.addr = strtoll(ops->raw, NULL, 16); 113 ops->target.addr = strtoull(ops->raw, NULL, 16);
114 114
115 if (s++ != NULL) 115 if (s++ != NULL)
116 ops->target.offset = strtoll(s, NULL, 16); 116 ops->target.offset = strtoull(s, NULL, 16);
117 else 117 else
118 ops->target.offset = UINT64_MAX; 118 ops->target.offset = UINT64_MAX;
119 119
@@ -821,6 +821,10 @@ static int symbol__parse_objdump_line(struct symbol *sym, struct map *map,
821 if (dl == NULL) 821 if (dl == NULL)
822 return -1; 822 return -1;
823 823
824 if (dl->ops.target.offset == UINT64_MAX)
825 dl->ops.target.offset = dl->ops.target.addr -
826 map__rip_2objdump(map, sym->start);
827
824 disasm__add(&notes->src->source, dl); 828 disasm__add(&notes->src->source, dl);
825 829
826 return 0; 830 return 0;
@@ -864,7 +868,8 @@ fallback:
864 free_filename = false; 868 free_filename = false;
865 } 869 }
866 870
867 if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS) { 871 if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS &&
872 !dso__is_kcore(dso)) {
868 char bf[BUILD_ID_SIZE * 2 + 16] = " with build id "; 873 char bf[BUILD_ID_SIZE * 2 + 16] = " with build id ";
869 char *build_id_msg = NULL; 874 char *build_id_msg = NULL;
870 875
@@ -898,7 +903,7 @@ fallback:
898 snprintf(command, sizeof(command), 903 snprintf(command, sizeof(command),
899 "%s %s%s --start-address=0x%016" PRIx64 904 "%s %s%s --start-address=0x%016" PRIx64
900 " --stop-address=0x%016" PRIx64 905 " --stop-address=0x%016" PRIx64
901 " -d %s %s -C %s|grep -v %s|expand", 906 " -d %s %s -C %s 2>/dev/null|grep -v %s|expand",
902 objdump_path ? objdump_path : "objdump", 907 objdump_path ? objdump_path : "objdump",
903 disassembler_style ? "-M " : "", 908 disassembler_style ? "-M " : "",
904 disassembler_style ? disassembler_style : "", 909 disassembler_style ? disassembler_style : "",