diff options
Diffstat (limited to 'tools/perf/builtin-annotate.c')
-rw-r--r-- | tools/perf/builtin-annotate.c | 79 |
1 files changed, 1 insertions, 78 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index fee663adeea2..543c4524f8c2 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -51,83 +51,6 @@ struct sym_ext { | |||
51 | char *path; | 51 | char *path; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | struct map { | ||
55 | struct list_head node; | ||
56 | u64 start; | ||
57 | u64 end; | ||
58 | u64 pgoff; | ||
59 | u64 (*map_ip)(struct map *, u64); | ||
60 | struct dso *dso; | ||
61 | }; | ||
62 | |||
63 | static u64 map__map_ip(struct map *map, u64 ip) | ||
64 | { | ||
65 | return ip - map->start + map->pgoff; | ||
66 | } | ||
67 | |||
68 | static u64 vdso__map_ip(struct map *map __used, u64 ip) | ||
69 | { | ||
70 | return ip; | ||
71 | } | ||
72 | |||
73 | static struct map *map__new(struct mmap_event *event) | ||
74 | { | ||
75 | struct map *self = malloc(sizeof(*self)); | ||
76 | |||
77 | if (self != NULL) { | ||
78 | const char *filename = event->filename; | ||
79 | |||
80 | self->start = event->start; | ||
81 | self->end = event->start + event->len; | ||
82 | self->pgoff = event->pgoff; | ||
83 | |||
84 | self->dso = dsos__findnew(filename); | ||
85 | if (self->dso == NULL) | ||
86 | goto out_delete; | ||
87 | |||
88 | if (self->dso == vdso) | ||
89 | self->map_ip = vdso__map_ip; | ||
90 | else | ||
91 | self->map_ip = map__map_ip; | ||
92 | } | ||
93 | return self; | ||
94 | out_delete: | ||
95 | free(self); | ||
96 | return NULL; | ||
97 | } | ||
98 | |||
99 | static struct map *map__clone(struct map *self) | ||
100 | { | ||
101 | struct map *map = malloc(sizeof(*self)); | ||
102 | |||
103 | if (!map) | ||
104 | return NULL; | ||
105 | |||
106 | memcpy(map, self, sizeof(*self)); | ||
107 | |||
108 | return map; | ||
109 | } | ||
110 | |||
111 | static int map__overlap(struct map *l, struct map *r) | ||
112 | { | ||
113 | if (l->start > r->start) { | ||
114 | struct map *t = l; | ||
115 | l = r; | ||
116 | r = t; | ||
117 | } | ||
118 | |||
119 | if (l->end > r->start) | ||
120 | return 1; | ||
121 | |||
122 | return 0; | ||
123 | } | ||
124 | |||
125 | static size_t map__fprintf(struct map *self, FILE *fp) | ||
126 | { | ||
127 | return fprintf(fp, " %Lx-%Lx %Lx %s\n", | ||
128 | self->start, self->end, self->pgoff, self->dso->name); | ||
129 | } | ||
130 | |||
131 | 54 | ||
132 | struct thread { | 55 | struct thread { |
133 | struct rb_node rb_node; | 56 | struct rb_node rb_node; |
@@ -797,7 +720,7 @@ static int | |||
797 | process_mmap_event(event_t *event, unsigned long offset, unsigned long head) | 720 | process_mmap_event(event_t *event, unsigned long offset, unsigned long head) |
798 | { | 721 | { |
799 | struct thread *thread = threads__findnew(event->mmap.pid); | 722 | struct thread *thread = threads__findnew(event->mmap.pid); |
800 | struct map *map = map__new(&event->mmap); | 723 | struct map *map = map__new(&event->mmap, NULL, 0); |
801 | 724 | ||
802 | dprintf("%p [%p]: PERF_EVENT_MMAP %d: [%p(%p) @ %p]: %s\n", | 725 | dprintf("%p [%p]: PERF_EVENT_MMAP %d: [%p(%p) @ %p]: %s\n", |
803 | (void *)(offset + head), | 726 | (void *)(offset + head), |