From 609028986065254b6ddecffa6408304201cebdde Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Fri, 20 Nov 2009 20:51:28 -0200 Subject: [PATCH] --- yaml --- r: 169710 b: refs/heads/master c: fbd733b815a5a57d7eb0d904edc49d18fd12df5c h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/tools/perf/util/symbol.c | 28 ++++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 0473df35df1d..74495620fd73 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c338aee853db197e1855b393e6d6cc667784537f +refs/heads/master: fbd733b815a5a57d7eb0d904edc49d18fd12df5c diff --git a/trunk/tools/perf/util/symbol.c b/trunk/tools/perf/util/symbol.c index cb086cbe6b10..9cf6dbcd158c 100644 --- a/trunk/tools/perf/util/symbol.c +++ b/trunk/tools/perf/util/symbol.c @@ -1334,13 +1334,37 @@ static int kernel_maps__create_module_maps(void) static int dso__load_vmlinux(struct dso *self, struct map *map, const char *vmlinux, symbol_filter_t filter) { - int err, fd = open(vmlinux, O_RDONLY); + int err = -1, fd; - self->loaded = 1; + if (self->has_build_id) { + u8 build_id[BUILD_ID_SIZE]; + + if (filename__read_build_id(vmlinux, build_id, + sizeof(build_id)) < 0) { + pr_debug("No build_id in %s, ignoring it\n", vmlinux); + return -1; + } + if (!dso__build_id_equal(self, build_id)) { + char expected_build_id[BUILD_ID_SIZE * 2 + 1], + vmlinux_build_id[BUILD_ID_SIZE * 2 + 1]; + + build_id__sprintf(self->build_id, + sizeof(self->build_id), + expected_build_id); + build_id__sprintf(build_id, sizeof(build_id), + vmlinux_build_id); + pr_debug("build_id in %s is %s while expected is %s, " + "ignoring it\n", vmlinux, vmlinux_build_id, + expected_build_id); + return -1; + } + } + fd = open(vmlinux, O_RDONLY); if (fd < 0) return -1; + self->loaded = 1; err = dso__load_sym(self, map, self->long_name, fd, filter, 1, 0); close(fd);