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

perf tools: Introduce dsos__fprintf_buildid

To print the buildids in the list of dsos. Will be used by 'perf
buildid-list'
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <1258396365-29217-4-git-send-email-acme@infradead.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 37562eac
...@@ -212,14 +212,21 @@ int build_id__sprintf(u8 *self, int len, char *bf) ...@@ -212,14 +212,21 @@ int build_id__sprintf(u8 *self, int len, char *bf)
return raw - self; return raw - self;
} }
size_t dso__fprintf(struct dso *self, FILE *fp) size_t dso__fprintf_buildid(struct dso *self, FILE *fp)
{ {
char sbuild_id[BUILD_ID_SIZE * 2 + 1]; char sbuild_id[BUILD_ID_SIZE * 2 + 1];
struct rb_node *nd;
size_t ret;
build_id__sprintf(self->build_id, sizeof(self->build_id), sbuild_id); build_id__sprintf(self->build_id, sizeof(self->build_id), sbuild_id);
ret = fprintf(fp, "dso: %s (%s)\n", self->short_name, sbuild_id); return fprintf(fp, "%s", sbuild_id);
}
size_t dso__fprintf(struct dso *self, FILE *fp)
{
struct rb_node *nd;
size_t ret = fprintf(fp, "dso: %s (", self->short_name);
ret += dso__fprintf_buildid(self, fp);
ret += fprintf(fp, ")\n");
for (nd = rb_first(&self->syms); nd; nd = rb_next(nd)) { for (nd = rb_first(&self->syms); nd; nd = rb_next(nd)) {
struct symbol *pos = rb_entry(nd, struct symbol, rb_node); struct symbol *pos = rb_entry(nd, struct symbol, rb_node);
...@@ -1428,6 +1435,21 @@ void dsos__fprintf(FILE *fp) ...@@ -1428,6 +1435,21 @@ void dsos__fprintf(FILE *fp)
dso__fprintf(pos, fp); dso__fprintf(pos, fp);
} }
size_t dsos__fprintf_buildid(FILE *fp)
{
struct dso *pos;
size_t ret = 0;
list_for_each_entry(pos, &dsos, node) {
ret += dso__fprintf_buildid(pos, fp);
if (verbose)
ret += fprintf(fp, " %s\n", pos->long_name);
else
ret += fprintf(fp, "\n");
}
return ret;
}
int load_kernel(symbol_filter_t filter) int load_kernel(symbol_filter_t filter)
{ {
if (dsos__load_kernel(vmlinux_name, filter, modules) <= 0) if (dsos__load_kernel(vmlinux_name, filter, modules) <= 0)
......
...@@ -80,7 +80,9 @@ int dsos__load_kernel(const char *vmlinux, symbol_filter_t filter, int modules); ...@@ -80,7 +80,9 @@ int dsos__load_kernel(const char *vmlinux, symbol_filter_t filter, int modules);
struct dso *dsos__findnew(const char *name); struct dso *dsos__findnew(const char *name);
int dso__load(struct dso *self, struct map *map, symbol_filter_t filter); int dso__load(struct dso *self, struct map *map, symbol_filter_t filter);
void dsos__fprintf(FILE *fp); void dsos__fprintf(FILE *fp);
size_t dsos__fprintf_buildid(FILE *fp);
size_t dso__fprintf_buildid(struct dso *self, FILE *fp);
size_t dso__fprintf(struct dso *self, FILE *fp); size_t dso__fprintf(struct dso *self, FILE *fp);
char dso__symtab_origin(const struct dso *self); char dso__symtab_origin(const struct dso *self);
void dso__set_build_id(struct dso *self, void *build_id); void dso__set_build_id(struct dso *self, void *build_id);
......
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