perf symbols: Check before overwriting build_id
authortor-jeremiassen <tor@ti.com>
Wed, 17 Feb 2016 14:29:21 +0000 (08:29 -0600)
committerMathieu Poirier <mathieu.poirier@linaro.org>
Mon, 20 Jun 2016 17:16:05 +0000 (11:16 -0600)
Added check to see if has_build_id is set before overwriting build_id.

Signed-off-by: Tor Jeremiassen <tor@ti.com>
tools/perf/util/symbol-minimal.c
tools/perf/util/symbol.c

index 48906333a858c06b41991f33cb0f5f2cdd4f68d9..9be16712ce745bfefff9659a454266c16d281df1 100644 (file)
@@ -344,7 +344,7 @@ int dso__load_sym(struct dso *dso, struct map *map __maybe_unused,
        if (ret >= 0)
                dso->is_64_bit = ret;
 
-       if (filename__read_build_id(ss->name, build_id, BUILD_ID_SIZE) > 0) {
+       if ((!dso->has_build_id) && (filename__read_build_id(ss->name, build_id, BUILD_ID_SIZE) > 0)) {
                dso__set_build_id(dso, build_id);
        }
        return 0;
index cd08027a6d2cdb9640734a5ba8eb20ade14f57f2..1d0d8bff4a5b94a1e92af5ab903df30dd73a2e25 100644 (file)
@@ -1465,7 +1465,8 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter)
         * Read the build id if possible. This is required for
         * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work
         */
-       if (filename__read_build_id(dso->name, build_id, BUILD_ID_SIZE) > 0)
+       if ((!dso->has_build_id) &&
+           (filename__read_build_id(dso->name, build_id, BUILD_ID_SIZE) > 0))
                dso__set_build_id(dso, build_id);
 
        /*