perf symbols: Split helpers used when creating kernel dso object
To make it clear and allow for direct usage by, for instance, regression test suites. Signed-off-by: Arnaldo 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-3-git-send-email-acme@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
a19afe4641
commit
fd1d908c54
|
@ -1762,24 +1762,38 @@ size_t dsos__fprintf_buildid(FILE *fp, bool with_hits)
|
||||||
__dsos__fprintf_buildid(&dsos__user, fp, with_hits));
|
__dsos__fprintf_buildid(&dsos__user, fp, with_hits));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct dso *dso__new_kernel(const char *name)
|
||||||
|
{
|
||||||
|
struct dso *self = dso__new(name ?: "[kernel.kallsyms]");
|
||||||
|
|
||||||
|
if (self != NULL) {
|
||||||
|
self->short_name = "[kernel]";
|
||||||
|
self->kernel = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dso__read_running_kernel_build_id(struct dso *self)
|
||||||
|
{
|
||||||
|
if (sysfs__read_build_id("/sys/kernel/notes", self->build_id,
|
||||||
|
sizeof(self->build_id)) == 0)
|
||||||
|
self->has_build_id = true;
|
||||||
|
}
|
||||||
|
|
||||||
static struct dso *dsos__create_kernel(const char *vmlinux)
|
static struct dso *dsos__create_kernel(const char *vmlinux)
|
||||||
{
|
{
|
||||||
struct dso *kernel = dso__new(vmlinux ?: "[kernel.kallsyms]");
|
struct dso *kernel = dso__new_kernel(vmlinux);
|
||||||
|
|
||||||
if (kernel == NULL)
|
if (kernel == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
kernel->short_name = "[kernel]";
|
|
||||||
kernel->kernel = 1;
|
|
||||||
|
|
||||||
vdso = dso__new("[vdso]");
|
vdso = dso__new("[vdso]");
|
||||||
if (vdso == NULL)
|
if (vdso == NULL)
|
||||||
goto out_delete_kernel_dso;
|
goto out_delete_kernel_dso;
|
||||||
dso__set_loaded(vdso, MAP__FUNCTION);
|
dso__set_loaded(vdso, MAP__FUNCTION);
|
||||||
|
|
||||||
if (sysfs__read_build_id("/sys/kernel/notes", kernel->build_id,
|
dso__read_running_kernel_build_id(kernel);
|
||||||
sizeof(kernel->build_id)) == 0)
|
|
||||||
kernel->has_build_id = true;
|
|
||||||
|
|
||||||
dsos__add(&dsos__kernel, kernel);
|
dsos__add(&dsos__kernel, kernel);
|
||||||
dsos__add(&dsos__user, vdso);
|
dsos__add(&dsos__user, vdso);
|
||||||
|
|
|
@ -109,6 +109,7 @@ struct dso {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dso *dso__new(const char *name);
|
struct dso *dso__new(const char *name);
|
||||||
|
struct dso *dso__new_kernel(const char *name);
|
||||||
void dso__delete(struct dso *self);
|
void dso__delete(struct dso *self);
|
||||||
|
|
||||||
bool dso__loaded(const struct dso *self, enum map_type type);
|
bool dso__loaded(const struct dso *self, enum map_type type);
|
||||||
|
@ -139,6 +140,7 @@ size_t dso__fprintf(struct dso *self, enum map_type type, FILE *fp);
|
||||||
char dso__symtab_origin(const struct dso *self);
|
char dso__symtab_origin(const struct dso *self);
|
||||||
void dso__set_long_name(struct dso *self, char *name);
|
void dso__set_long_name(struct dso *self, char *name);
|
||||||
void dso__set_build_id(struct dso *self, void *build_id);
|
void dso__set_build_id(struct dso *self, void *build_id);
|
||||||
|
void dso__read_running_kernel_build_id(struct dso *self);
|
||||||
struct symbol *dso__find_symbol(struct dso *self, enum map_type type, u64 addr);
|
struct symbol *dso__find_symbol(struct dso *self, enum map_type type, u64 addr);
|
||||||
struct symbol *dso__find_symbol_by_name(struct dso *self, enum map_type type,
|
struct symbol *dso__find_symbol_by_name(struct dso *self, enum map_type type,
|
||||||
const char *name);
|
const char *name);
|
||||||
|
|
Loading…
Reference in New Issue