[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1344550721-21024-15-git-send-email-cody@linux.vnet.ibm.com>
Date: Thu, 9 Aug 2012 15:18:39 -0700
From: Cody P Schafer <cody@...ux.vnet.ibm.com>
To: Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Cc: LKML <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...hat.com>,
Paul Mackerras <paulus@...ba.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Sukadev Bhattiprolu <sukadev@...ux.vnet.ibm.com>,
Matt Hellsley <matthltc@...ibm.com>,
David Hansen <dave@...ux.vnet.ibm.com>
Subject: [PATCH 14/16] perf symbol: factor want_symtab out of dso__load_sym()
Only one callsite of dso__load_sym() uses the want_symtab functionality,
so place the logic at the callsite instead of within dso__load_sym().
This sets us up for removal of want_symtab completely once we keep
multiple elf handles (within symsrc's) around.
Setup for the later patch
"perf symbol: use both runtime and debug images"
Signed-off-by: Cody P Schafer <cody@...ux.vnet.ibm.com>
---
tools/perf/util/symbol.c | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index f8fbde2..83d2276 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1320,8 +1320,7 @@ static size_t elf_addr_to_index(Elf *elf, GElf_Addr addr)
}
static int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *ss,
- symbol_filter_t filter, int kmodule,
- int want_symtab)
+ symbol_filter_t filter, int kmodule)
{
struct kmap *kmap = dso->kernel ? map__kmap(map) : NULL;
struct map *curr_map = map;
@@ -1346,16 +1345,6 @@ static int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *ss,
sec = ss->symtab;
shdr = ss->symshdr;
- if (sec == NULL) {
- if (want_symtab)
- goto out_elf_end;
-
- sec = ss->dynsym;
- shdr = ss->dynshdr;
- if (sec == NULL)
- goto out_elf_end;
- }
-
opdsec = ss->opdsec;
opdshdr = ss->opdshdr;
opdidx = ss->opdidx;
@@ -1947,8 +1936,15 @@ restart:
if (symsrc__init(&ss, dso, name, symtab_type) < 0)
continue;
- ret = dso__load_sym(dso, map, &ss, filter, 0,
- want_symtab);
+ if (want_symtab && !ss.symtab) {
+ symsrc__destroy(&ss);
+ continue;
+ } else if (!want_symtab) {
+ ss.symtab = ss.dynsym;
+ ss.symshdr = ss.dynshdr;
+ }
+
+ ret = dso__load_sym(dso, map, &ss, filter, 0);
/*
* Some people seem to have debuginfo files _WITHOUT_ debug
@@ -2253,7 +2249,7 @@ int dso__load_vmlinux(struct dso *dso, struct map *map,
if (symsrc__init(&ss, dso, symfs_vmlinux, symtab_type))
return -1;
- err = dso__load_sym(dso, map, &ss, filter, 0, 0);
+ err = dso__load_sym(dso, map, &ss, filter, 0);
symsrc__destroy(&ss);
if (err > 0) {
--
1.7.11.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists