[PATCH/RFC 7/9] perf tools: Add symbol_conf.use_kcore

From: Namhyung Kim
Date: Fri Jun 23 2017 - 01:50:38 EST


The use_kcore field is to control usage of /proc/kcore when loading
symbols. This patch only introduces the new field and don't change any
behavior by itself.

Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
Cc: Wang Nan <wangnan0@xxxxxxxxxx>
Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
---
tools/perf/util/symbol.c | 3 ++-
tools/perf/util/symbol.h | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index fe46eb782297..3f789f33c2ef 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -36,6 +36,7 @@ char **vmlinux_path;

struct symbol_conf symbol_conf = {
.use_modules = true,
+ .use_kcore = true,
.try_vmlinux_path = true,
.annotate_src = true,
.demangle = true,
@@ -1324,7 +1325,7 @@ int __dso__load_kallsyms(struct dso *dso, const char *filename,
int dso__load_kallsyms(struct dso *dso, const char *filename,
struct map *map)
{
- return __dso__load_kallsyms(dso, filename, map, false);
+ return __dso__load_kallsyms(dso, filename, map, !symbol_conf.use_kcore);
}

static int dso__load_perf_map(struct dso *dso, struct map *map)
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 41ebba9a2eb2..88361eeae813 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -119,7 +119,8 @@ struct symbol_conf {
hide_unresolved,
raw_trace,
report_hierarchy,
- inline_name;
+ inline_name,
+ use_kcore;
const char *vmlinux_name,
*kallsyms_name,
*source_prefix,
--
2.13.1