summaryrefslogtreecommitdiff
path: root/tools/perf/util/pmu.c
diff options
context:
space:
mode:
authorWang Nan <wangnan0@huawei.com>2015-05-29 09:45:47 +0000
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-05-30 11:08:52 -0300
commit6bb536cc4b06df70012cec6168cc1788e200bc9d (patch)
tree7638b58de0d402bf16e0c234c40662054919957c /tools/perf/util/pmu.c
parent5c9b9bc67c684e40b3a5e7e9facde0fb7200cd8c (diff)
perf probe: Fix segfault when glob matching function without debuginfo
Commit 4c859351226c920b227fec040a3b447f0d482af3 ("perf probe: Support glob wildcards for function name") introduces segfault problems when debuginfo is not available: # perf probe 'sys_w*' Added new events: Segmentation fault The first problem resides in find_probe_trace_events_from_map(). In that function, find_probe_functions() is called to match each symbol against glob to find the number of matching functions, but still use map__for_each_symbol_by_name() to find 'struct symbol' for matching functions. Unfortunately, map__for_each_symbol_by_name() does exact matching by searching in an rbtree. It doesn't know glob matching, and not easy for it to support it because it use rbtree based binary search, but we are unable to ensure all names matched by the glob (any glob passed by user) reside in one subtree. This patch drops map__for_each_symbol_by_name(). Since there is no rbtree again, re-matching all symbols costs a lot. This patch avoid it by saving all matching results into an array (syms). The second problem is the lost of tp->realname. In __add_probe_trace_events(), if pev->point.function is glob, the event name should be set to tev->point.realname. This patch ensures its existence by strdup sym->name instead of leaving a NULL pointer there. After this patch: # perf probe 'sys_w*' Added new events: probe:sys_waitid (on sys_w*) probe:sys_wait4 (on sys_w*) probe:sys_waitpid (on sys_w*) probe:sys_write (on sys_w*) probe:sys_writev (on sys_w*) You can now use it in all perf tools, such as: perf record -e probe:sys_writev -aR sleep 1 Signed-off-by: Wang Nan <wangnan0@huawei.com> Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Zefan Li <lizefan@huawei.com> Link: http://lkml.kernel.org/r/1432892747-232506-1-git-send-email-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/pmu.c')
0 files changed, 0 insertions, 0 deletions