]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - tools/perf/util/annotate.c
perf annotate: Allow disassembly using /proc/kcore
[karo-tx-linux.git] / tools / perf / util / annotate.c
index d102716c43a1b30beb08ed89f1f18edc60d66dd0..4ab2f11ee6f4e7e02034a42f2460004aedad84ad 100644 (file)
@@ -110,10 +110,10 @@ static int jump__parse(struct ins_operands *ops)
 {
        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)
-               ops->target.offset = strtoll(s, NULL, 16);
+               ops->target.offset = strtoull(s, NULL, 16);
        else
                ops->target.offset = UINT64_MAX;
 
@@ -821,6 +821,10 @@ static int symbol__parse_objdump_line(struct symbol *sym, struct map *map,
        if (dl == NULL)
                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(&notes->src->source, dl);
 
        return 0;
@@ -864,7 +868,8 @@ fallback:
                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 *build_id_msg = NULL;
 
@@ -898,7 +903,7 @@ fallback:
        snprintf(command, sizeof(command),
                 "%s %s%s --start-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",
                 disassembler_style ? "-M " : "",
                 disassembler_style ? disassembler_style : "",