Commit a19afe46 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by Ingo Molnar

perf symbols: Factor out dso__load_vmlinux_path()

So that we can call it directly from regression tests, and also
to reduce the size of dso__load_kernel_sym(), making it more
clear.
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1264633557-17597-2-git-send-email-acme@infradead.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 72b8fa17
...@@ -1578,6 +1578,27 @@ static int dso__load_vmlinux(struct dso *self, struct map *map, ...@@ -1578,6 +1578,27 @@ static int dso__load_vmlinux(struct dso *self, struct map *map,
return err; return err;
} }
int dso__load_vmlinux_path(struct dso *self, struct map *map,
struct perf_session *session, symbol_filter_t filter)
{
int i, err = 0;
pr_debug("Looking at the vmlinux_path (%d entries long)\n",
vmlinux_path__nr_entries);
for (i = 0; i < vmlinux_path__nr_entries; ++i) {
err = dso__load_vmlinux(self, map, session, vmlinux_path[i],
filter);
if (err > 0) {
pr_debug("Using %s for symbols\n", vmlinux_path[i]);
dso__set_long_name(self, strdup(vmlinux_path[i]));
break;
}
}
return err;
}
static int dso__load_kernel_sym(struct dso *self, struct map *map, static int dso__load_kernel_sym(struct dso *self, struct map *map,
struct perf_session *session, symbol_filter_t filter) struct perf_session *session, symbol_filter_t filter)
{ {
...@@ -1606,21 +1627,10 @@ static int dso__load_kernel_sym(struct dso *self, struct map *map, ...@@ -1606,21 +1627,10 @@ static int dso__load_kernel_sym(struct dso *self, struct map *map,
} }
if (vmlinux_path != NULL) { if (vmlinux_path != NULL) {
int i; err = dso__load_vmlinux_path(self, map, session, filter);
pr_debug("Looking at the vmlinux_path (%d entries long)\n", if (err > 0)
vmlinux_path__nr_entries);
for (i = 0; i < vmlinux_path__nr_entries; ++i) {
err = dso__load_vmlinux(self, map, session,
vmlinux_path[i], filter);
if (err > 0) {
pr_debug("Using %s for symbols\n",
vmlinux_path[i]);
dso__set_long_name(self,
strdup(vmlinux_path[i]));
goto out_fixup; goto out_fixup;
} }
}
}
/* /*
* Say the kernel DSO was created when processing the build-id header table, * Say the kernel DSO was created when processing the build-id header table,
......
...@@ -129,6 +129,8 @@ struct perf_session; ...@@ -129,6 +129,8 @@ struct perf_session;
int dso__load(struct dso *self, struct map *map, struct perf_session *session, int dso__load(struct dso *self, struct map *map, struct perf_session *session,
symbol_filter_t filter); symbol_filter_t filter);
int dso__load_vmlinux_path(struct dso *self, struct map *map,
struct perf_session *session, symbol_filter_t filter);
void dsos__fprintf(FILE *fp); void dsos__fprintf(FILE *fp);
size_t dsos__fprintf_buildid(FILE *fp, bool with_hits); size_t dsos__fprintf_buildid(FILE *fp, bool with_hits);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment