aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/header.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/header.c')
-rw-r--r--tools/perf/util/header.c51
1 files changed, 46 insertions, 5 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 893f8e2df928..158c787ce0c4 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -200,6 +200,47 @@ static int write_buildid(const char *name, size_t name_len, u8 *build_id,
200 return write_padded(fd, name, name_len + 1, len); 200 return write_padded(fd, name, name_len + 1, len);
201} 201}
202 202
203static int __dsos__hit_all(struct list_head *head)
204{
205 struct dso *pos;
206
207 list_for_each_entry(pos, head, node)
208 pos->hit = true;
209
210 return 0;
211}
212
213static int machine__hit_all_dsos(struct machine *machine)
214{
215 int err;
216
217 err = __dsos__hit_all(&machine->kernel_dsos);
218 if (err)
219 return err;
220
221 return __dsos__hit_all(&machine->user_dsos);
222}
223
224int dsos__hit_all(struct perf_session *session)
225{
226 struct rb_node *nd;
227 int err;
228
229 err = machine__hit_all_dsos(&session->machines.host);
230 if (err)
231 return err;
232
233 for (nd = rb_first(&session->machines.guests); nd; nd = rb_next(nd)) {
234 struct machine *pos = rb_entry(nd, struct machine, rb_node);
235
236 err = machine__hit_all_dsos(pos);
237 if (err)
238 return err;
239 }
240
241 return 0;
242}
243
203static int __dsos__write_buildid_table(struct list_head *head, 244static int __dsos__write_buildid_table(struct list_head *head,
204 struct machine *machine, 245 struct machine *machine,
205 pid_t pid, u16 misc, int fd) 246 pid_t pid, u16 misc, int fd)
@@ -215,9 +256,9 @@ static int __dsos__write_buildid_table(struct list_head *head,
215 if (!pos->hit) 256 if (!pos->hit)
216 continue; 257 continue;
217 258
218 if (is_vdso_map(pos->short_name)) { 259 if (dso__is_vdso(pos)) {
219 name = (char *) VDSO__MAP_NAME; 260 name = pos->short_name;
220 name_len = sizeof(VDSO__MAP_NAME) + 1; 261 name_len = pos->short_name_len + 1;
221 } else if (dso__is_kcore(pos)) { 262 } else if (dso__is_kcore(pos)) {
222 machine__mmap_name(machine, nm, sizeof(nm)); 263 machine__mmap_name(machine, nm, sizeof(nm));
223 name = nm; 264 name = nm;
@@ -298,7 +339,7 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir,
298 339
299 len = scnprintf(filename, size, "%s%s%s", 340 len = scnprintf(filename, size, "%s%s%s",
300 debugdir, slash ? "/" : "", 341 debugdir, slash ? "/" : "",
301 is_vdso ? VDSO__MAP_NAME : realname); 342 is_vdso ? DSO__NAME_VDSO : realname);
302 if (mkdir_p(filename, 0755)) 343 if (mkdir_p(filename, 0755))
303 goto out_free; 344 goto out_free;
304 345
@@ -386,7 +427,7 @@ static int dso__cache_build_id(struct dso *dso, struct machine *machine,
386 const char *debugdir) 427 const char *debugdir)
387{ 428{
388 bool is_kallsyms = dso->kernel && dso->long_name[0] != '/'; 429 bool is_kallsyms = dso->kernel && dso->long_name[0] != '/';
389 bool is_vdso = is_vdso_map(dso->short_name); 430 bool is_vdso = dso__is_vdso(dso);
390 const char *name = dso->long_name; 431 const char *name = dso->long_name;
391 char nm[PATH_MAX]; 432 char nm[PATH_MAX];
392 433