[PATCH 08/19] perf symbol: Save vmlinux or kallsyms path loaded

From: David Ahern
Date: Wed Aug 07 2013 - 22:51:38 EST


Save vmlinux or kallsyms path loaded using embedded default lookup (ie.,
not a user specified path). Upcoming perf sched timehist command requires
kernel symbols for properly computing idle times and prints a warning
if the kernel symbols are not loaded.

Signed-off-by: David Ahern <dsahern@xxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Stephane Eranian <eranian@xxxxxxxxxx>
---
tools/perf/util/symbol.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index c655b9e..1f777f9 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1192,6 +1192,8 @@ int dso__load_vmlinux(struct dso *dso, struct map *map,
dso->data_type = DSO_BINARY_TYPE__VMLINUX;
dso__set_long_name(dso, (char *)vmlinux);
dso__set_loaded(dso, map->type);
+ if (symbol_conf.vmlinux_name == NULL)
+ symbol_conf.vmlinux_name = strdup(symfs_vmlinux);
pr_debug("Using %s for symbols\n", symfs_vmlinux);
}

@@ -1325,8 +1327,11 @@ static int dso__load_kernel_sym(struct dso *dso, struct map *map,

do_kallsyms:
err = dso__load_kallsyms(dso, kallsyms_filename, map, filter);
- if (err > 0)
+ if (err > 0) {
+ if (symbol_conf.kallsyms_name == NULL)
+ symbol_conf.kallsyms_name = strdup(kallsyms_filename);
pr_debug("Using %s for symbols\n", kallsyms_filename);
+ }
free(kallsyms_allocated_filename);

if (err > 0 && !dso__is_kcore(dso)) {
--
1.7.10.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/