• Arnaldo Carvalho de Melo's avatar
    perf symbols: Try the .debug/ DSO cache as a last resort · dc38218e
    Arnaldo Carvalho de Melo authored
    Not as the first attempt at finding a vmlinux for the running kernel,
    this way we get a more informative filename to present in tools, it will
    check that the build-id is the same as the one previously loaded in the
    DSO in dso->build_id, reading from /sys/kernel/notes, for instance.
    
    E.g. in the annotation TUI, going from 'perf top', for the scsi_sg_alloc
    kernel function, in the first line:
    
    Before:
    
    scsi_sg_alloc  /root/.debug/.build-id/28/2777c262e6b3c0451375163c9a81c893218ab1
    
    After:
    
    scsi_sg_alloc  /lib/modules/4.3.0-rc1+/build/vmlinux
    
    And:
    
      # ls -la /root/.debug/.build-id/28/2777c262e6b3c0451375163c9a81c893218ab1
    lrwxrwxrwx. 1 root root 81 Sep 22 16:11 /root/.debug/.build-id/28/2777c262e6b3c0451375163c9a81c893218ab1 -> ../../home/git/build/v4.3.0-rc1+/vmlinux/282777c262e6b3c0451375163c9a81c893218ab1
      # file ~/.debug/home/git/build/v4.3.0-rc1+/vmlinux/282777c262e6b3c0451375163c9a81c893218ab1
    /root/.debug/home/git/build/v4.3.0-rc1+/vmlinux/282777c262e6b3c0451375163c9a81c893218ab1: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=282777c262e6b3c0451375163c9a81c893218ab1, not stripped
      #
    
    The same as:
    
      # file /lib/modules/4.3.0-rc1+/build/vmlinux
    /lib/modules/4.3.0-rc1+/build/vmlinux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=282777c262e6b3c0451375163c9a81c893218ab1, not stripped
    
    Furthermore:
    
      # sha256sum /lib/modules/4.3.0-rc1+/build/vmlinux
      e7a789bbdc61029ec09140c228e1dd651271f38ef0b8416c0b7d5ff727b98be2  /lib/modules/4.3.0-rc1+/build/vmlinux
      # sha256sum ~/.debug/home/git/build/v4.3.0-rc1+/vmlinux/282777c262e6b3c0451375163c9a81c893218ab1
      e7a789bbdc61029ec09140c228e1dd651271f38ef0b8416c0b7d5ff727b98be2  /root/.debug/home/git/build/v4.3.0-rc1+/vmlinux/282777c262e6b3c0451375163c9a81c893218ab1
      [root@zoo new]#
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Borislav Petkov <bp@suse.de>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Stephane Eranian <eranian@google.com>
    Cc: Wang Nan <wangnan0@huawei.com>
    Link: http://lkml.kernel.org/n/tip-9y42ikzq3jisiddoi6f07n8z@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    dc38218e
symbol.c 45.6 KB