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>
This commit is contained in:
parent
7a77bc2c0d
commit
bbb7f846f8
|
@ -103,7 +103,8 @@ static int perf_top__parse_source(struct perf_top *top, struct hist_entry *he)
|
||||||
/*
|
/*
|
||||||
* We can't annotate with just /proc/kallsyms
|
* We can't annotate with just /proc/kallsyms
|
||||||
*/
|
*/
|
||||||
if (map->dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS) {
|
if (map->dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS &&
|
||||||
|
!dso__is_kcore(map->dso)) {
|
||||||
pr_err("Can't annotate %s: No vmlinux file was found in the "
|
pr_err("Can't annotate %s: No vmlinux file was found in the "
|
||||||
"path\n", sym->name);
|
"path\n", sym->name);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
|
|
@ -110,10 +110,10 @@ static int jump__parse(struct ins_operands *ops)
|
||||||
{
|
{
|
||||||
const char *s = strchr(ops->raw, '+');
|
const char *s = strchr(ops->raw, '+');
|
||||||
|
|
||||||
ops->target.addr = strtoll(ops->raw, NULL, 16);
|
ops->target.addr = strtoull(ops->raw, NULL, 16);
|
||||||
|
|
||||||
if (s++ != NULL)
|
if (s++ != NULL)
|
||||||
ops->target.offset = strtoll(s, NULL, 16);
|
ops->target.offset = strtoull(s, NULL, 16);
|
||||||
else
|
else
|
||||||
ops->target.offset = UINT64_MAX;
|
ops->target.offset = UINT64_MAX;
|
||||||
|
|
||||||
|
@ -821,6 +821,10 @@ static int symbol__parse_objdump_line(struct symbol *sym, struct map *map,
|
||||||
if (dl == NULL)
|
if (dl == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
if (dl->ops.target.offset == UINT64_MAX)
|
||||||
|
dl->ops.target.offset = dl->ops.target.addr -
|
||||||
|
map__rip_2objdump(map, sym->start);
|
||||||
|
|
||||||
disasm__add(¬es->src->source, dl);
|
disasm__add(¬es->src->source, dl);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -864,7 +868,8 @@ fallback:
|
||||||
free_filename = false;
|
free_filename = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS) {
|
if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS &&
|
||||||
|
!dso__is_kcore(dso)) {
|
||||||
char bf[BUILD_ID_SIZE * 2 + 16] = " with build id ";
|
char bf[BUILD_ID_SIZE * 2 + 16] = " with build id ";
|
||||||
char *build_id_msg = NULL;
|
char *build_id_msg = NULL;
|
||||||
|
|
||||||
|
@ -898,7 +903,7 @@ fallback:
|
||||||
snprintf(command, sizeof(command),
|
snprintf(command, sizeof(command),
|
||||||
"%s %s%s --start-address=0x%016" PRIx64
|
"%s %s%s --start-address=0x%016" PRIx64
|
||||||
" --stop-address=0x%016" PRIx64
|
" --stop-address=0x%016" PRIx64
|
||||||
" -d %s %s -C %s|grep -v %s|expand",
|
" -d %s %s -C %s 2>/dev/null|grep -v %s|expand",
|
||||||
objdump_path ? objdump_path : "objdump",
|
objdump_path ? objdump_path : "objdump",
|
||||||
disassembler_style ? "-M " : "",
|
disassembler_style ? "-M " : "",
|
||||||
disassembler_style ? disassembler_style : "",
|
disassembler_style ? disassembler_style : "",
|
||||||
|
|
Loading…
Reference in a new issue