diff options
author | Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> | 2014-09-17 04:41:01 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-09-17 17:01:43 -0400 |
commit | 664fee3dc37939bb8010906913fa9dbc52abb587 (patch) | |
tree | 72972d1684a1a4930039cfae22d0799aad8738f7 /tools/perf | |
parent | 2b394bc4468c2f5e6814a8dbb2a923c0448f8497 (diff) |
perf probe: Do not use dwfl_module_addrsym if dwarf_diename finds symbol name
Do not use dwfl_module_addrsym if dwarf_diename can find the symbol
name, since dwfl_module_addrsym can be failed on shared libraries.
Without this patch
----
$ perf probe -x ../lib/traceevent/libtraceevent.so -V create_arg_op
Failed to find symbol at 0x11df1
Failed to find the address of create_arg_op
Error: Failed to show vars.
----
With this patch
----
$ perf probe -x ../lib/traceevent/libtraceevent.so -V create_arg_op
Available variables at create_arg_op
@<create_arg_op+0>
enum filter_op_type btype
struct filter_arg* arg
----
This bug was reported on linux-perf-users@vger.kernel.org.
Reported-by: david lerner <dlernerdroid@gmail.com>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: david lerner <dlernerdroid@gmail.com>
Cc: linux-perf-user@vger.kernel.org
Cc: yrl.pp-manager.tt@hitachi.com
Link: http://permalink.gmane.org/gmane.linux.kernel.perf.user/1691
Link: http://lkml.kernel.org/r/20140917084101.3722.25299.stgit@kbuild-f20.novalocal
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/probe-finder.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 9c593561aa71..c7918f83b300 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c | |||
@@ -609,14 +609,18 @@ static int convert_to_trace_point(Dwarf_Die *sp_die, Dwfl_Module *mod, | |||
609 | return -EINVAL; | 609 | return -EINVAL; |
610 | } | 610 | } |
611 | 611 | ||
612 | /* Get an appropriate symbol from symtab */ | 612 | symbol = dwarf_diename(sp_die); |
613 | symbol = dwfl_module_addrsym(mod, paddr, &sym, NULL); | ||
614 | if (!symbol) { | 613 | if (!symbol) { |
615 | pr_warning("Failed to find symbol at 0x%lx\n", | 614 | /* Try to get the symbol name from symtab */ |
616 | (unsigned long)paddr); | 615 | symbol = dwfl_module_addrsym(mod, paddr, &sym, NULL); |
617 | return -ENOENT; | 616 | if (!symbol) { |
617 | pr_warning("Failed to find symbol at 0x%lx\n", | ||
618 | (unsigned long)paddr); | ||
619 | return -ENOENT; | ||
620 | } | ||
621 | eaddr = sym.st_value; | ||
618 | } | 622 | } |
619 | tp->offset = (unsigned long)(paddr - sym.st_value); | 623 | tp->offset = (unsigned long)(paddr - eaddr); |
620 | tp->address = (unsigned long)paddr; | 624 | tp->address = (unsigned long)paddr; |
621 | tp->symbol = strdup(symbol); | 625 | tp->symbol = strdup(symbol); |
622 | if (!tp->symbol) | 626 | if (!tp->symbol) |