diff options
Diffstat (limited to 'tools/perf/util/symbol.c')
-rw-r--r-- | tools/perf/util/symbol.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index ecccc8df128e..aaa51ba147df 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <sys/param.h> | 11 | #include <sys/param.h> |
12 | #include <fcntl.h> | 12 | #include <fcntl.h> |
13 | #include <unistd.h> | 13 | #include <unistd.h> |
14 | #include "build-id.h" | ||
14 | #include "symbol.h" | 15 | #include "symbol.h" |
15 | #include "strlist.h" | 16 | #include "strlist.h" |
16 | 17 | ||
@@ -525,7 +526,7 @@ static int dso__split_kallsyms(struct dso *self, struct map *map, | |||
525 | curr_map = map_groups__find_by_name(kmaps, | 526 | curr_map = map_groups__find_by_name(kmaps, |
526 | map->type, module); | 527 | map->type, module); |
527 | if (curr_map == NULL) { | 528 | if (curr_map == NULL) { |
528 | pr_err("%s/proc/{kallsyms,modules} " | 529 | pr_debug("%s/proc/{kallsyms,modules} " |
529 | "inconsistency while looking " | 530 | "inconsistency while looking " |
530 | "for \"%s\" module!\n", | 531 | "for \"%s\" module!\n", |
531 | machine->root_dir, module); | 532 | machine->root_dir, module); |
@@ -1131,6 +1132,10 @@ bool __dsos__read_build_ids(struct list_head *head, bool with_hits) | |||
1131 | list_for_each_entry(pos, head, node) { | 1132 | list_for_each_entry(pos, head, node) { |
1132 | if (with_hits && !pos->hit) | 1133 | if (with_hits && !pos->hit) |
1133 | continue; | 1134 | continue; |
1135 | if (pos->has_build_id) { | ||
1136 | have_build_id = true; | ||
1137 | continue; | ||
1138 | } | ||
1134 | if (filename__read_build_id(pos->long_name, pos->build_id, | 1139 | if (filename__read_build_id(pos->long_name, pos->build_id, |
1135 | sizeof(pos->build_id)) > 0) { | 1140 | sizeof(pos->build_id)) > 0) { |
1136 | have_build_id = true; | 1141 | have_build_id = true; |
@@ -1289,7 +1294,6 @@ int dso__load(struct dso *self, struct map *map, symbol_filter_t filter) | |||
1289 | int size = PATH_MAX; | 1294 | int size = PATH_MAX; |
1290 | char *name; | 1295 | char *name; |
1291 | u8 build_id[BUILD_ID_SIZE]; | 1296 | u8 build_id[BUILD_ID_SIZE]; |
1292 | char build_id_hex[BUILD_ID_SIZE * 2 + 1]; | ||
1293 | int ret = -1; | 1297 | int ret = -1; |
1294 | int fd; | 1298 | int fd; |
1295 | struct machine *machine; | 1299 | struct machine *machine; |
@@ -1321,15 +1325,8 @@ int dso__load(struct dso *self, struct map *map, symbol_filter_t filter) | |||
1321 | } | 1325 | } |
1322 | 1326 | ||
1323 | self->origin = DSO__ORIG_BUILD_ID_CACHE; | 1327 | self->origin = DSO__ORIG_BUILD_ID_CACHE; |
1324 | 1328 | if (dso__build_id_filename(self, name, size) != NULL) | |
1325 | if (self->has_build_id) { | ||
1326 | build_id__sprintf(self->build_id, sizeof(self->build_id), | ||
1327 | build_id_hex); | ||
1328 | snprintf(name, size, "%s/%s/.build-id/%.2s/%s", | ||
1329 | getenv("HOME"), DEBUG_CACHE_DIR, | ||
1330 | build_id_hex, build_id_hex + 2); | ||
1331 | goto open_file; | 1329 | goto open_file; |
1332 | } | ||
1333 | more: | 1330 | more: |
1334 | do { | 1331 | do { |
1335 | self->origin++; | 1332 | self->origin++; |
@@ -1345,6 +1342,7 @@ more: | |||
1345 | case DSO__ORIG_BUILDID: | 1342 | case DSO__ORIG_BUILDID: |
1346 | if (filename__read_build_id(self->long_name, build_id, | 1343 | if (filename__read_build_id(self->long_name, build_id, |
1347 | sizeof(build_id))) { | 1344 | sizeof(build_id))) { |
1345 | char build_id_hex[BUILD_ID_SIZE * 2 + 1]; | ||
1348 | build_id__sprintf(build_id, sizeof(build_id), | 1346 | build_id__sprintf(build_id, sizeof(build_id), |
1349 | build_id_hex); | 1347 | build_id_hex); |
1350 | snprintf(name, size, | 1348 | snprintf(name, size, |
@@ -1933,6 +1931,12 @@ static size_t __dsos__fprintf_buildid(struct list_head *head, FILE *fp, | |||
1933 | return ret; | 1931 | return ret; |
1934 | } | 1932 | } |
1935 | 1933 | ||
1934 | size_t machine__fprintf_dsos_buildid(struct machine *self, FILE *fp, bool with_hits) | ||
1935 | { | ||
1936 | return __dsos__fprintf_buildid(&self->kernel_dsos, fp, with_hits) + | ||
1937 | __dsos__fprintf_buildid(&self->user_dsos, fp, with_hits); | ||
1938 | } | ||
1939 | |||
1936 | size_t machines__fprintf_dsos_buildid(struct rb_root *self, FILE *fp, bool with_hits) | 1940 | size_t machines__fprintf_dsos_buildid(struct rb_root *self, FILE *fp, bool with_hits) |
1937 | { | 1941 | { |
1938 | struct rb_node *nd; | 1942 | struct rb_node *nd; |
@@ -1940,8 +1944,7 @@ size_t machines__fprintf_dsos_buildid(struct rb_root *self, FILE *fp, bool with_ | |||
1940 | 1944 | ||
1941 | for (nd = rb_first(self); nd; nd = rb_next(nd)) { | 1945 | for (nd = rb_first(self); nd; nd = rb_next(nd)) { |
1942 | struct machine *pos = rb_entry(nd, struct machine, rb_node); | 1946 | struct machine *pos = rb_entry(nd, struct machine, rb_node); |
1943 | ret += __dsos__fprintf_buildid(&pos->kernel_dsos, fp, with_hits); | 1947 | ret += machine__fprintf_dsos_buildid(pos, fp, with_hits); |
1944 | ret += __dsos__fprintf_buildid(&pos->user_dsos, fp, with_hits); | ||
1945 | } | 1948 | } |
1946 | return ret; | 1949 | return ret; |
1947 | } | 1950 | } |