diff options
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r-- | tools/perf/builtin-report.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index f053a7463dcf..61d871849b44 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -209,6 +209,11 @@ static uint64_t vdso__map_ip(struct map *map, uint64_t ip) | |||
209 | return ip; | 209 | return ip; |
210 | } | 210 | } |
211 | 211 | ||
212 | static inline int is_anon_memory(const char *filename) | ||
213 | { | ||
214 | return strcmp(filename, "//anon") == 0; | ||
215 | } | ||
216 | |||
212 | static struct map *map__new(struct mmap_event *event) | 217 | static struct map *map__new(struct mmap_event *event) |
213 | { | 218 | { |
214 | struct map *self = malloc(sizeof(*self)); | 219 | struct map *self = malloc(sizeof(*self)); |
@@ -216,6 +221,7 @@ static struct map *map__new(struct mmap_event *event) | |||
216 | if (self != NULL) { | 221 | if (self != NULL) { |
217 | const char *filename = event->filename; | 222 | const char *filename = event->filename; |
218 | char newfilename[PATH_MAX]; | 223 | char newfilename[PATH_MAX]; |
224 | int anon; | ||
219 | 225 | ||
220 | if (cwd) { | 226 | if (cwd) { |
221 | int n = strcommon(filename); | 227 | int n = strcommon(filename); |
@@ -227,6 +233,13 @@ static struct map *map__new(struct mmap_event *event) | |||
227 | } | 233 | } |
228 | } | 234 | } |
229 | 235 | ||
236 | anon = is_anon_memory(filename); | ||
237 | |||
238 | if (anon) { | ||
239 | snprintf(newfilename, sizeof(newfilename), "/tmp/perf-%d.map", event->pid); | ||
240 | filename = newfilename; | ||
241 | } | ||
242 | |||
230 | self->start = event->start; | 243 | self->start = event->start; |
231 | self->end = event->start + event->len; | 244 | self->end = event->start + event->len; |
232 | self->pgoff = event->pgoff; | 245 | self->pgoff = event->pgoff; |
@@ -235,7 +248,7 @@ static struct map *map__new(struct mmap_event *event) | |||
235 | if (self->dso == NULL) | 248 | if (self->dso == NULL) |
236 | goto out_delete; | 249 | goto out_delete; |
237 | 250 | ||
238 | if (self->dso == vdso) | 251 | if (self->dso == vdso || anon) |
239 | self->map_ip = vdso__map_ip; | 252 | self->map_ip = vdso__map_ip; |
240 | else | 253 | else |
241 | self->map_ip = map__map_ip; | 254 | self->map_ip = map__map_ip; |