perf symbols: 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 symbols: Use both runtime and debug images"
Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com>
Cc: David Hansen <dave@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Matt Hellsley <matthltc@us.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/1344637382-22789-15-git-send-email-cody@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 5915947..492ebec 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -525,6 +525,10 @@
return 0;
}
+bool symsrc__has_symtab(struct symsrc *ss)
+{
+ return ss->symtab != NULL;
+}
void symsrc__destroy(struct symsrc *ss)
{
@@ -616,7 +620,7 @@
}
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;
@@ -636,21 +640,16 @@
dso->symtab_type = ss->type;
+ if (!ss->symtab) {
+ ss->symtab = ss->dynsym;
+ ss->symshdr = ss->dynshdr;
+ }
+
elf = ss->elf;
ehdr = ss->ehdr;
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;