aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/symbol.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/symbol.c')
-rw-r--r--tools/perf/util/symbol.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index ab92763edb03..79ca6a099f96 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -22,6 +22,7 @@
22enum dso_origin { 22enum dso_origin {
23 DSO__ORIG_KERNEL = 0, 23 DSO__ORIG_KERNEL = 0,
24 DSO__ORIG_JAVA_JIT, 24 DSO__ORIG_JAVA_JIT,
25 DSO__ORIG_BUILD_ID_CACHE,
25 DSO__ORIG_FEDORA, 26 DSO__ORIG_FEDORA,
26 DSO__ORIG_UBUNTU, 27 DSO__ORIG_UBUNTU,
27 DSO__ORIG_BUILDID, 28 DSO__ORIG_BUILDID,
@@ -1191,6 +1192,7 @@ char dso__symtab_origin(const struct dso *self)
1191 static const char origin[] = { 1192 static const char origin[] = {
1192 [DSO__ORIG_KERNEL] = 'k', 1193 [DSO__ORIG_KERNEL] = 'k',
1193 [DSO__ORIG_JAVA_JIT] = 'j', 1194 [DSO__ORIG_JAVA_JIT] = 'j',
1195 [DSO__ORIG_BUILD_ID_CACHE] = 'B',
1194 [DSO__ORIG_FEDORA] = 'f', 1196 [DSO__ORIG_FEDORA] = 'f',
1195 [DSO__ORIG_UBUNTU] = 'u', 1197 [DSO__ORIG_UBUNTU] = 'u',
1196 [DSO__ORIG_BUILDID] = 'b', 1198 [DSO__ORIG_BUILDID] = 'b',
@@ -1209,6 +1211,7 @@ int dso__load(struct dso *self, struct map *map, struct perf_session *session,
1209 int size = PATH_MAX; 1211 int size = PATH_MAX;
1210 char *name; 1212 char *name;
1211 u8 build_id[BUILD_ID_SIZE]; 1213 u8 build_id[BUILD_ID_SIZE];
1214 char build_id_hex[BUILD_ID_SIZE * 2 + 1];
1212 int ret = -1; 1215 int ret = -1;
1213 int fd; 1216 int fd;
1214 1217
@@ -1230,8 +1233,16 @@ int dso__load(struct dso *self, struct map *map, struct perf_session *session,
1230 return ret; 1233 return ret;
1231 } 1234 }
1232 1235
1233 self->origin = DSO__ORIG_FEDORA - 1; 1236 self->origin = DSO__ORIG_BUILD_ID_CACHE;
1234 1237
1238 if (self->has_build_id) {
1239 build_id__sprintf(self->build_id, sizeof(self->build_id),
1240 build_id_hex);
1241 snprintf(name, size, "%s/%s/.build-id/%.2s/%s",
1242 getenv("HOME"), DEBUG_CACHE_DIR,
1243 build_id_hex, build_id_hex + 2);
1244 goto open_file;
1245 }
1235more: 1246more:
1236 do { 1247 do {
1237 self->origin++; 1248 self->origin++;
@@ -1247,8 +1258,6 @@ more:
1247 case DSO__ORIG_BUILDID: 1258 case DSO__ORIG_BUILDID:
1248 if (filename__read_build_id(self->long_name, build_id, 1259 if (filename__read_build_id(self->long_name, build_id,
1249 sizeof(build_id))) { 1260 sizeof(build_id))) {
1250 char build_id_hex[BUILD_ID_SIZE * 2 + 1];
1251
1252 build_id__sprintf(build_id, sizeof(build_id), 1261 build_id__sprintf(build_id, sizeof(build_id),
1253 build_id_hex); 1262 build_id_hex);
1254 snprintf(name, size, 1263 snprintf(name, size,
@@ -1276,7 +1285,7 @@ compare_build_id:
1276 if (!dso__build_id_equal(self, build_id)) 1285 if (!dso__build_id_equal(self, build_id))
1277 goto more; 1286 goto more;
1278 } 1287 }
1279 1288open_file:
1280 fd = open(name, O_RDONLY); 1289 fd = open(name, O_RDONLY);
1281 } while (fd < 0); 1290 } while (fd < 0);
1282 1291