• W
    perf probe: Load map before glob matching · 75e4a2a6
    Wang Nan 提交于
    Commit 4c859351 ("perf probe: Support
    glob wildcards for function name") introduces a problem:
    
      # /root/perf probe kmem_cache_free
     Failed to find symbol kmem_cache_free in kernel
       Error: Failed to add events.
    
    The reason is the replacement of map__for_each_symbol_by_name() (by
    map__for_each_symbol()). Although their names are similar,
    map__for_each_symbol doesn't call map__load() and dso__sort_by_name()
    before searching. The missing of map__load() causes this problem because
    it search symbol before load dso map.
    
    This patch ensures map__load() is called before using
    map__for_each_symbol().
    
    After this patch:
    
     # /root/perf probe kmem_cache_free
      Added new event:
        probe:kmem_cache_free (on kmem_cache_free%return)
    
    You can now use it in all perf tools, such as:
    
            perf record -e probe:kmem_cache_free -aR sleep 1
    Signed-off-by: NWang Nan <wangnan0@huawei.com>
    Acked-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Paul Mackerras <paulus@samba.org>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Cc: Zefan Li <lizefan@huawei.com>
    Cc: pi3orama@163.com
    Link: http://lkml.kernel.org/r/1431692084-46287-1-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
    75e4a2a6
probe-event.c 64.8 KB