• M
    perf probe: Fix probing symbols with optimization suffix · 576b5237
    Masami Hiramatsu 提交于
    Fix perf probe to probe on some symbols which have some optimzation
    suffixes, e.g. ".part", ".isra", and ".constprop".
    
    To fix this issue, instead of using the DIE name, perf probe uses the
    symbol name found by dwfl_module_addrsym().
    
    This also involves a perf probe --vars operation update which now shows
    the symbol name instead of the DIE name.
    
    Without this patch, putting a probe on an inlined function which was
    compiled with a suffixed symbol will fail like this:
    
      $ perf probe -v getname_flags
      probe-definition(0): getname_flags
      symbol:getname_flags file:(null) line:0 offset:0 return:0 lazy:(null)
      0 arguments
      Looking at the vmlinux_path (6 entries long)
      Using /lib/modules/3.11.0+/build/vmlinux for symbols
      found inline addr: 0xffffffff8119bb70
      Probe point found: getname_flags+0
      found inline addr: 0xffffffff8119bcb6
      Probe point found: getname+6
      found inline addr: 0xffffffff811a06a6
      Probe point found: user_path_at_empty+6
      find 3 probe_trace_events.
      Opening /sys/kernel/debug//tracing/kprobe_events write=1
      Added new events:
      Writing event: p:probe/getname_flags getname_flags+0
      Failed to write event: No such file or directory
        Error: Failed to add events. (-1)
    
    Because the debuginfo knows only the original (non suffix) symbol name,
    it uses the original symbol for probe address but the kernel (kallsyms)
    knows only suffixed symbol.  Then, the kernel rejects that original
    symbol.
    
    This patch uses dwfl_module_addrsym() to get the correct (suffixed)
    symbol from symtab when a probe point is found.
    Reported-by: NArnaldo Carvalho de Melo <acme@ghostprotocols.net>
    Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Paul Mackerras <paulus@samba.org>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Link: http://lkml.kernel.org/r/20130925131616.31632.46658.stgit@udc4-manage.rcp.hitachi.co.jpSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
    576b5237
probe-finder.c 39.0 KB