perf symbols: Allow loading kallsyms without considering kcore files
authorArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 19 Apr 2016 15:12:49 +0000 (12:12 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 19 Apr 2016 15:38:56 +0000 (12:38 -0300)
Before the support for using /proc/kcore was introduced, the kallsyms
routines used /proc/modules and the first 'perf test' entry expected
finding maps for each module in the system, which is not the case with
the kcore code. Provide a way to ignore kcore files so that the test can
have its expectations met.

Improving the test to cover kcore files as well needs to be done.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-ek5urnu103dlhfk4l6pcw041@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/machine.c
tools/perf/util/machine.h
tools/perf/util/symbol.c
tools/perf/util/symbol.h

index 52b51e004fe8fccf01d53ac270b9af04ae5cfe3c..656c1d7ee7d46f771d473873823ae4c716bfaf06 100644 (file)
@@ -908,11 +908,11 @@ int machines__create_kernel_maps(struct machines *machines, pid_t pid)
        return machine__create_kernel_maps(machine);
 }
 
-int machine__load_kallsyms(struct machine *machine, const char *filename,
-                          enum map_type type, symbol_filter_t filter)
+int __machine__load_kallsyms(struct machine *machine, const char *filename,
+                            enum map_type type, bool no_kcore, symbol_filter_t filter)
 {
        struct map *map = machine__kernel_map(machine);
-       int ret = dso__load_kallsyms(map->dso, filename, map, filter);
+       int ret = __dso__load_kallsyms(map->dso, filename, map, no_kcore, filter);
 
        if (ret > 0) {
                dso__set_loaded(map->dso, type);
@@ -927,6 +927,12 @@ int machine__load_kallsyms(struct machine *machine, const char *filename,
        return ret;
 }
 
+int machine__load_kallsyms(struct machine *machine, const char *filename,
+                          enum map_type type, symbol_filter_t filter)
+{
+       return __machine__load_kallsyms(machine, filename, type, false, filter);
+}
+
 int machine__load_vmlinux_path(struct machine *machine, enum map_type type,
                               symbol_filter_t filter)
 {
index 382873bdc5635fac25770b5a270433ef21132f69..4822de5e4544dd8fa56b19d3f044467f490d465b 100644 (file)
@@ -215,6 +215,8 @@ struct symbol *machine__find_kernel_function_by_name(struct machine *machine,
 struct map *machine__findnew_module_map(struct machine *machine, u64 start,
                                        const char *filename);
 
+int __machine__load_kallsyms(struct machine *machine, const char *filename,
+                            enum map_type type, bool no_kcore, symbol_filter_t filter);
 int machine__load_kallsyms(struct machine *machine, const char *filename,
                           enum map_type type, symbol_filter_t filter);
 int machine__load_vmlinux_path(struct machine *machine, enum map_type type,
index a36823c3b7c0d4eb2957dc943cedcc6c97c2b9a7..415c4f6d98fd4c54fade340513c8e06d3968ba03 100644 (file)
@@ -1208,8 +1208,8 @@ static int kallsyms__delta(struct map *map, const char *filename, u64 *delta)
        return 0;
 }
 
-int dso__load_kallsyms(struct dso *dso, const char *filename,
-                      struct map *map, symbol_filter_t filter)
+int __dso__load_kallsyms(struct dso *dso, const char *filename,
+                        struct map *map, bool no_kcore, symbol_filter_t filter)
 {
        u64 delta = 0;
 
@@ -1230,12 +1230,18 @@ int dso__load_kallsyms(struct dso *dso, const char *filename,
        else
                dso->symtab_type = DSO_BINARY_TYPE__KALLSYMS;
 
-       if (!dso__load_kcore(dso, map, filename))
+       if (!no_kcore && !dso__load_kcore(dso, map, filename))
                return dso__split_kallsyms_for_kcore(dso, map, filter);
        else
                return dso__split_kallsyms(dso, map, delta, filter);
 }
 
+int dso__load_kallsyms(struct dso *dso, const char *filename,
+                      struct map *map, symbol_filter_t filter)
+{
+       return __dso__load_kallsyms(dso, filename, map, false, filter);
+}
+
 static int dso__load_perf_map(struct dso *dso, struct map *map,
                              symbol_filter_t filter)
 {
index 1da7b101bc7f8592914eda9032a5cbd4801d1f08..c8e43979ed5c481204182fba128d7ccbc9415d28 100644 (file)
@@ -240,6 +240,8 @@ int dso__load_vmlinux(struct dso *dso, struct map *map,
                      symbol_filter_t filter);
 int dso__load_vmlinux_path(struct dso *dso, struct map *map,
                           symbol_filter_t filter);
+int __dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map,
+                        bool no_kcore, symbol_filter_t filter);
 int dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map,
                       symbol_filter_t filter);
 
This page took 0.032994 seconds and 5 git commands to generate.