• Masami Hiramatsu's avatar
    perf probe: Fix to probe on gcc generated symbols for offline kernel · 36497359
    Masami Hiramatsu authored
    commit 8a937a25 upstream.
    
    Fix perf-probe to show probe definition on gcc generated symbols for
    offline kernel (including cross-arch kernel image).
    
    gcc sometimes optimizes functions and generate new symbols with suffixes
    such as ".constprop.N" or ".isra.N" etc. Since those symbol names are
    not recorded in DWARF, we have to find correct generated symbols from
    offline ELF binary to probe on it (kallsyms doesn't correct it).  For
    online kernel or uprobes we don't need it because those are rebased on
    _text, or a section relative address.
    
    E.g. Without this:
    
      $ perf probe -k build-arm/vmlinux -F __slab_alloc*
      __slab_alloc.constprop.9
      $ perf probe -k build-arm/vmlinux -D __slab_alloc
      p:probe/__slab_alloc __slab_alloc+0
    
    If you put above definition on target machine, it should fail
    because there is no __slab_alloc in kallsyms.
    
    With this fix, perf probe shows correct probe definition on
    __slab_alloc.constprop.9:
    
      $ perf probe -k build-arm/vmlinux -D __slab_alloc
      p:probe/__slab_alloc __slab_alloc.constprop.9+0
    Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Link: http://lkml.kernel.org/r/148350060434.19001.11864836288580083501.stgit@devboxSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Krister Johansen <kjlx@templeofstupid.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    36497359
probe-event.c 79.1 KB