diff options
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/header.c | 9 | ||||
-rw-r--r-- | tools/perf/util/session.c | 6 | ||||
-rw-r--r-- | tools/perf/util/symbol.c | 6 | ||||
-rw-r--r-- | tools/perf/util/symbol.h | 11 |
4 files changed, 23 insertions, 9 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 942f7da8bf84..ec96321eb9e4 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -193,7 +193,7 @@ static int write_padded(int fd, const void *bf, size_t count, | |||
193 | continue; \ | 193 | continue; \ |
194 | else | 194 | else |
195 | 195 | ||
196 | static int __dsos__write_buildid_table(struct list_head *head, int fd) | 196 | static int __dsos__write_buildid_table(struct list_head *head, u16 misc, int fd) |
197 | { | 197 | { |
198 | struct dso *pos; | 198 | struct dso *pos; |
199 | 199 | ||
@@ -205,6 +205,7 @@ static int __dsos__write_buildid_table(struct list_head *head, int fd) | |||
205 | len = ALIGN(len, NAME_ALIGN); | 205 | len = ALIGN(len, NAME_ALIGN); |
206 | memset(&b, 0, sizeof(b)); | 206 | memset(&b, 0, sizeof(b)); |
207 | memcpy(&b.build_id, pos->build_id, sizeof(pos->build_id)); | 207 | memcpy(&b.build_id, pos->build_id, sizeof(pos->build_id)); |
208 | b.header.misc = misc; | ||
208 | b.header.size = sizeof(b) + len; | 209 | b.header.size = sizeof(b) + len; |
209 | err = do_write(fd, &b, sizeof(b)); | 210 | err = do_write(fd, &b, sizeof(b)); |
210 | if (err < 0) | 211 | if (err < 0) |
@@ -220,9 +221,11 @@ static int __dsos__write_buildid_table(struct list_head *head, int fd) | |||
220 | 221 | ||
221 | static int dsos__write_buildid_table(int fd) | 222 | static int dsos__write_buildid_table(int fd) |
222 | { | 223 | { |
223 | int err = __dsos__write_buildid_table(&dsos__kernel, fd); | 224 | int err = __dsos__write_buildid_table(&dsos__kernel, |
225 | PERF_RECORD_MISC_KERNEL, fd); | ||
224 | if (err == 0) | 226 | if (err == 0) |
225 | err = __dsos__write_buildid_table(&dsos__user, fd); | 227 | err = __dsos__write_buildid_table(&dsos__user, |
228 | PERF_RECORD_MISC_USER, fd); | ||
226 | return err; | 229 | return err; |
227 | } | 230 | } |
228 | 231 | ||
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index e0e6a075489e..378ac5422bcf 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -255,6 +255,7 @@ int perf_header__read_build_ids(int input, u64 offset, u64 size) | |||
255 | while (offset < limit) { | 255 | while (offset < limit) { |
256 | struct dso *dso; | 256 | struct dso *dso; |
257 | ssize_t len; | 257 | ssize_t len; |
258 | struct list_head *head = &dsos__user; | ||
258 | 259 | ||
259 | if (read(input, &bev, sizeof(bev)) != sizeof(bev)) | 260 | if (read(input, &bev, sizeof(bev)) != sizeof(bev)) |
260 | goto out; | 261 | goto out; |
@@ -263,7 +264,10 @@ int perf_header__read_build_ids(int input, u64 offset, u64 size) | |||
263 | if (read(input, filename, len) != len) | 264 | if (read(input, filename, len) != len) |
264 | goto out; | 265 | goto out; |
265 | 266 | ||
266 | dso = dsos__findnew(filename); | 267 | if (bev.header.misc & PERF_RECORD_MISC_KERNEL) |
268 | head = &dsos__kernel; | ||
269 | |||
270 | dso = __dsos__findnew(head, filename); | ||
267 | if (dso != NULL) | 271 | if (dso != NULL) |
268 | dso__set_build_id(dso, &bev.build_id); | 272 | dso__set_build_id(dso, &bev.build_id); |
269 | 273 | ||
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index da2f07f1af8f..8e6627e6b778 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -1615,14 +1615,14 @@ static struct dso *dsos__find(struct list_head *head, const char *name) | |||
1615 | return NULL; | 1615 | return NULL; |
1616 | } | 1616 | } |
1617 | 1617 | ||
1618 | struct dso *dsos__findnew(const char *name) | 1618 | struct dso *__dsos__findnew(struct list_head *head, const char *name) |
1619 | { | 1619 | { |
1620 | struct dso *dso = dsos__find(&dsos__user, name); | 1620 | struct dso *dso = dsos__find(head, name); |
1621 | 1621 | ||
1622 | if (!dso) { | 1622 | if (!dso) { |
1623 | dso = dso__new(name); | 1623 | dso = dso__new(name); |
1624 | if (dso != NULL) { | 1624 | if (dso != NULL) { |
1625 | dsos__add(&dsos__user, dso); | 1625 | dsos__add(head, dso); |
1626 | dso__set_basename(dso); | 1626 | dso__set_basename(dso); |
1627 | } | 1627 | } |
1628 | } | 1628 | } |
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index b2b5330a82a0..ee0b4593db7b 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h | |||
@@ -115,9 +115,17 @@ bool dso__sorted_by_name(const struct dso *self, enum map_type type); | |||
115 | 115 | ||
116 | void dso__sort_by_name(struct dso *self, enum map_type type); | 116 | void dso__sort_by_name(struct dso *self, enum map_type type); |
117 | 117 | ||
118 | extern struct list_head dsos__user, dsos__kernel; | ||
119 | |||
120 | struct dso *__dsos__findnew(struct list_head *head, const char *name); | ||
121 | |||
122 | static inline struct dso *dsos__findnew(const char *name) | ||
123 | { | ||
124 | return __dsos__findnew(&dsos__user, name); | ||
125 | } | ||
126 | |||
118 | struct perf_session; | 127 | struct perf_session; |
119 | 128 | ||
120 | struct dso *dsos__findnew(const char *name); | ||
121 | int dso__load(struct dso *self, struct map *map, struct perf_session *session, | 129 | int dso__load(struct dso *self, struct map *map, struct perf_session *session, |
122 | symbol_filter_t filter); | 130 | symbol_filter_t filter); |
123 | void dsos__fprintf(FILE *fp); | 131 | void dsos__fprintf(FILE *fp); |
@@ -143,6 +151,5 @@ bool symbol_type__is_a(char symbol_type, enum map_type map_type); | |||
143 | 151 | ||
144 | int perf_session__create_kernel_maps(struct perf_session *self); | 152 | int perf_session__create_kernel_maps(struct perf_session *self); |
145 | 153 | ||
146 | extern struct list_head dsos__user, dsos__kernel; | ||
147 | extern struct dso *vdso; | 154 | extern struct dso *vdso; |
148 | #endif /* __PERF_SYMBOL */ | 155 | #endif /* __PERF_SYMBOL */ |