aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/event.c3
-rw-r--r--tools/perf/util/map.c11
-rw-r--r--tools/perf/util/map.h5
3 files changed, 8 insertions, 11 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index c2808ad3b76a..052eaeccc202 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -393,7 +393,8 @@ int event__process_mmap(event_t *self, struct perf_session *session)
393 } 393 }
394 394
395 thread = perf_session__findnew(session, self->mmap.pid); 395 thread = perf_session__findnew(session, self->mmap.pid);
396 map = map__new(&self->mmap, MAP__FUNCTION, 396 map = map__new(self->mmap.start, self->mmap.len, self->mmap.pgoff,
397 self->mmap.pid, self->mmap.filename, MAP__FUNCTION,
397 session->cwd, session->cwdlen); 398 session->cwd, session->cwdlen);
398 399
399 if (thread == NULL || map == NULL) 400 if (thread == NULL || map == NULL)
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index e509cd59c67d..a9b42273675d 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -1,4 +1,3 @@
1#include "event.h"
2#include "symbol.h" 1#include "symbol.h"
3#include <stdlib.h> 2#include <stdlib.h>
4#include <string.h> 3#include <string.h>
@@ -38,13 +37,12 @@ void map__init(struct map *self, enum map_type type,
38 RB_CLEAR_NODE(&self->rb_node); 37 RB_CLEAR_NODE(&self->rb_node);
39} 38}
40 39
41struct map *map__new(struct mmap_event *event, enum map_type type, 40struct map *map__new(u64 start, u64 len, u64 pgoff, u32 pid, char *filename,
42 char *cwd, int cwdlen) 41 enum map_type type, char *cwd, int cwdlen)
43{ 42{
44 struct map *self = malloc(sizeof(*self)); 43 struct map *self = malloc(sizeof(*self));
45 44
46 if (self != NULL) { 45 if (self != NULL) {
47 const char *filename = event->filename;
48 char newfilename[PATH_MAX]; 46 char newfilename[PATH_MAX];
49 struct dso *dso; 47 struct dso *dso;
50 int anon; 48 int anon;
@@ -62,7 +60,7 @@ struct map *map__new(struct mmap_event *event, enum map_type type,
62 anon = is_anon_memory(filename); 60 anon = is_anon_memory(filename);
63 61
64 if (anon) { 62 if (anon) {
65 snprintf(newfilename, sizeof(newfilename), "/tmp/perf-%d.map", event->pid); 63 snprintf(newfilename, sizeof(newfilename), "/tmp/perf-%d.map", pid);
66 filename = newfilename; 64 filename = newfilename;
67 } 65 }
68 66
@@ -70,8 +68,7 @@ struct map *map__new(struct mmap_event *event, enum map_type type,
70 if (dso == NULL) 68 if (dso == NULL)
71 goto out_delete; 69 goto out_delete;
72 70
73 map__init(self, type, event->start, event->start + event->len, 71 map__init(self, type, start, start + len, pgoff, dso);
74 event->pgoff, dso);
75 72
76 if (anon) { 73 if (anon) {
77set_identity: 74set_identity:
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h
index b756368076c6..a4a5bc4fca6d 100644
--- a/tools/perf/util/map.h
+++ b/tools/perf/util/map.h
@@ -68,14 +68,13 @@ u64 map__rip_2objdump(struct map *map, u64 rip);
68u64 map__objdump_2ip(struct map *map, u64 addr); 68u64 map__objdump_2ip(struct map *map, u64 addr);
69 69
70struct symbol; 70struct symbol;
71struct mmap_event;
72 71
73typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym); 72typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym);
74 73
75void map__init(struct map *self, enum map_type type, 74void map__init(struct map *self, enum map_type type,
76 u64 start, u64 end, u64 pgoff, struct dso *dso); 75 u64 start, u64 end, u64 pgoff, struct dso *dso);
77struct map *map__new(struct mmap_event *event, enum map_type, 76struct map *map__new(u64 start, u64 len, u64 pgoff, u32 pid, char *filename,
78 char *cwd, int cwdlen); 77 enum map_type type, char *cwd, int cwdlen);
79void map__delete(struct map *self); 78void map__delete(struct map *self);
80struct map *map__clone(struct map *self); 79struct map *map__clone(struct map *self);
81int map__overlap(struct map *l, struct map *r); 80int map__overlap(struct map *l, struct map *r);