aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/util/symbol.c30
-rw-r--r--tools/perf/util/symbol.h2
2 files changed, 28 insertions, 4 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 93e4b52ccfe4..53de9c4488d8 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -212,14 +212,21 @@ int build_id__sprintf(u8 *self, int len, char *bf)
212 return raw - self; 212 return raw - self;
213} 213}
214 214
215size_t dso__fprintf(struct dso *self, FILE *fp) 215size_t dso__fprintf_buildid(struct dso *self, FILE *fp)
216{ 216{
217 char sbuild_id[BUILD_ID_SIZE * 2 + 1]; 217 char sbuild_id[BUILD_ID_SIZE * 2 + 1];
218 struct rb_node *nd;
219 size_t ret;
220 218
221 build_id__sprintf(self->build_id, sizeof(self->build_id), sbuild_id); 219 build_id__sprintf(self->build_id, sizeof(self->build_id), sbuild_id);
222 ret = fprintf(fp, "dso: %s (%s)\n", self->short_name, sbuild_id); 220 return fprintf(fp, "%s", sbuild_id);
221}
222
223size_t dso__fprintf(struct dso *self, FILE *fp)
224{
225 struct rb_node *nd;
226 size_t ret = fprintf(fp, "dso: %s (", self->short_name);
227
228 ret += dso__fprintf_buildid(self, fp);
229 ret += fprintf(fp, ")\n");
223 230
224 for (nd = rb_first(&self->syms); nd; nd = rb_next(nd)) { 231 for (nd = rb_first(&self->syms); nd; nd = rb_next(nd)) {
225 struct symbol *pos = rb_entry(nd, struct symbol, rb_node); 232 struct symbol *pos = rb_entry(nd, struct symbol, rb_node);
@@ -1428,6 +1435,21 @@ void dsos__fprintf(FILE *fp)
1428 dso__fprintf(pos, fp); 1435 dso__fprintf(pos, fp);
1429} 1436}
1430 1437
1438size_t dsos__fprintf_buildid(FILE *fp)
1439{
1440 struct dso *pos;
1441 size_t ret = 0;
1442
1443 list_for_each_entry(pos, &dsos, node) {
1444 ret += dso__fprintf_buildid(pos, fp);
1445 if (verbose)
1446 ret += fprintf(fp, " %s\n", pos->long_name);
1447 else
1448 ret += fprintf(fp, "\n");
1449 }
1450 return ret;
1451}
1452
1431int load_kernel(symbol_filter_t filter) 1453int load_kernel(symbol_filter_t filter)
1432{ 1454{
1433 if (dsos__load_kernel(vmlinux_name, filter, modules) <= 0) 1455 if (dsos__load_kernel(vmlinux_name, filter, modules) <= 0)
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 0a34a5493f1b..51c5a4a08133 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -80,7 +80,9 @@ int dsos__load_kernel(const char *vmlinux, symbol_filter_t filter, int modules);
80struct dso *dsos__findnew(const char *name); 80struct dso *dsos__findnew(const char *name);
81int dso__load(struct dso *self, struct map *map, symbol_filter_t filter); 81int dso__load(struct dso *self, struct map *map, symbol_filter_t filter);
82void dsos__fprintf(FILE *fp); 82void dsos__fprintf(FILE *fp);
83size_t dsos__fprintf_buildid(FILE *fp);
83 84
85size_t dso__fprintf_buildid(struct dso *self, FILE *fp);
84size_t dso__fprintf(struct dso *self, FILE *fp); 86size_t dso__fprintf(struct dso *self, FILE *fp);
85char dso__symtab_origin(const struct dso *self); 87char dso__symtab_origin(const struct dso *self);
86void dso__set_build_id(struct dso *self, void *build_id); 88void dso__set_build_id(struct dso *self, void *build_id);