Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 182428
b: refs/heads/master
c: fd1d908
h: refs/heads/master
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo authored and Ingo Molnar committed Jan 29, 2010
1 parent da00e1a commit 09c102c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a19afe46412452fef89cc623873a8931b3685944
refs/heads/master: fd1d908c543fbdfae82839d24b0872c542fceedc
28 changes: 21 additions & 7 deletions trunk/tools/perf/util/symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1762,24 +1762,38 @@ size_t dsos__fprintf_buildid(FILE *fp, bool 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)
{
struct dso *kernel = dso__new(vmlinux ?: "[kernel.kallsyms]");
struct dso *kernel = dso__new_kernel(vmlinux);

if (kernel == NULL)
return NULL;

kernel->short_name = "[kernel]";
kernel->kernel = 1;

vdso = dso__new("[vdso]");
if (vdso == NULL)
goto out_delete_kernel_dso;
dso__set_loaded(vdso, MAP__FUNCTION);

if (sysfs__read_build_id("/sys/kernel/notes", kernel->build_id,
sizeof(kernel->build_id)) == 0)
kernel->has_build_id = true;
dso__read_running_kernel_build_id(kernel);

dsos__add(&dsos__kernel, kernel);
dsos__add(&dsos__user, vdso);
Expand Down
2 changes: 2 additions & 0 deletions trunk/tools/perf/util/symbol.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ struct dso {
};

struct dso *dso__new(const char *name);
struct dso *dso__new_kernel(const char *name);
void dso__delete(struct dso *self);

bool dso__loaded(const struct dso *self, enum map_type type);
Expand Down Expand Up @@ -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);
void dso__set_long_name(struct dso *self, char *name);
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_by_name(struct dso *self, enum map_type type,
const char *name);
Expand Down

0 comments on commit 09c102c

Please sign in to comment.