summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-04-18 15:46:58 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-04-20 13:34:49 -0300
commit33ff581eddf744ea91a50d46c2f0961b375a9595 (patch)
treeb286b45ecba08ad147353d7f761ff9b0f12ea90c /tools
parente7c72d888dac2c81003401d663bd8abd68e7c5cd (diff)
perf symbols: Read plt symbols from proper symtab_type binary
When loading symbols from DSO we check multiple paths of DSO binary until we succeed to load symbols ('.symtab' section). Once symbols are read we try to load also plt symbols. During the reading of plt symbols, the dso file is reopened from location given by dso->long_name. This could be wrong in case we want process buildid binaries. The change is to make the plt symbols being read from the DSO path, that normal symbols were read from. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1334756818-6631-1-git-send-email-jolsa@redhat.com [ committer note: moved dso to be the first parameter of that function ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/symbol.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index c0a028c3eba..ab9867b2b43 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -977,8 +977,9 @@ static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
* And always look at the original dso, not at debuginfo packages, that
* have the PLT data stripped out (shdr_rel_plt.sh_type == SHT_NOBITS).
*/
-static int dso__synthesize_plt_symbols(struct dso *dso, struct map *map,
- symbol_filter_t filter)
+static int
+dso__synthesize_plt_symbols(struct dso *dso, char *name, struct map *map,
+ symbol_filter_t filter)
{
uint32_t nr_rel_entries, idx;
GElf_Sym sym;
@@ -993,10 +994,7 @@ static int dso__synthesize_plt_symbols(struct dso *dso, struct map *map,
char sympltname[1024];
Elf *elf;
int nr = 0, symidx, fd, err = 0;
- char name[PATH_MAX];
- snprintf(name, sizeof(name), "%s%s",
- symbol_conf.symfs, dso->long_name);
fd = open(name, O_RDONLY);
if (fd < 0)
goto out;
@@ -1703,8 +1701,9 @@ restart:
continue;
if (ret > 0) {
- int nr_plt = dso__synthesize_plt_symbols(dso, map,
- filter);
+ int nr_plt;
+
+ nr_plt = dso__synthesize_plt_symbols(dso, name, map, filter);
if (nr_plt > 0)
ret += nr_plt;
break;