Commit 680d926a authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo

perf symbols: Allow symbol alias when loading map for symbol name

When perf probe tries to add a probe in a binary using symbol name, it
sometimes failed since some symbols were discard during loading dso.

When it resolves an address to symbol, it'd be better to have just one
symbol at given address.  But for finding address from symbol, it'd be
better to keep all names (including aliases).

So allow tools to state that they want to allow aliases via
symbol_conf.allow_aliases.
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Acked-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Naohiro Aota <naota@elisp.net>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20150306073127.6904.3232.stgit@localhost.localdomain
[ Original patch passwd allow_alias to many functions, use symbol_conf.allow_aliases instead ]
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 0687eba7
...@@ -80,6 +80,7 @@ static int init_symbol_maps(bool user_only) ...@@ -80,6 +80,7 @@ static int init_symbol_maps(bool user_only)
int ret; int ret;
symbol_conf.sort_by_name = true; symbol_conf.sort_by_name = true;
symbol_conf.allow_aliases = true;
ret = symbol__init(NULL); ret = symbol__init(NULL);
if (ret < 0) { if (ret < 0) {
pr_debug("Failed to init symbol map.\n"); pr_debug("Failed to init symbol map.\n");
......
...@@ -1048,7 +1048,8 @@ int dso__load_sym(struct dso *dso, struct map *map, ...@@ -1048,7 +1048,8 @@ int dso__load_sym(struct dso *dso, struct map *map,
* For misannotated, zeroed, ASM function sizes. * For misannotated, zeroed, ASM function sizes.
*/ */
if (nr > 0) { if (nr > 0) {
symbols__fixup_duplicate(&dso->symbols[map->type]); if (!symbol_conf.allow_aliases)
symbols__fixup_duplicate(&dso->symbols[map->type]);
symbols__fixup_end(&dso->symbols[map->type]); symbols__fixup_end(&dso->symbols[map->type]);
if (kmap) { if (kmap) {
/* /*
......
...@@ -87,6 +87,7 @@ struct symbol_conf { ...@@ -87,6 +87,7 @@ struct symbol_conf {
ignore_vmlinux_buildid, ignore_vmlinux_buildid,
show_kernel_path, show_kernel_path,
use_modules, use_modules,
allow_aliases,
sort_by_name, sort_by_name,
show_nr_samples, show_nr_samples,
show_total_period, show_total_period,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment