diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/thread.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index 00c14b98d651..f98032c135c6 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <string.h> | 4 | #include <string.h> |
5 | #include "thread.h" | 5 | #include "thread.h" |
6 | #include "util.h" | 6 | #include "util.h" |
7 | #include "debug.h" | ||
7 | 8 | ||
8 | static struct thread *thread__new(pid_t pid) | 9 | static struct thread *thread__new(pid_t pid) |
9 | { | 10 | { |
@@ -85,9 +86,27 @@ void thread__insert_map(struct thread *self, struct map *map) | |||
85 | 86 | ||
86 | list_for_each_entry_safe(pos, tmp, &self->maps, node) { | 87 | list_for_each_entry_safe(pos, tmp, &self->maps, node) { |
87 | if (map__overlap(pos, map)) { | 88 | if (map__overlap(pos, map)) { |
88 | list_del_init(&pos->node); | 89 | if (verbose >= 2) { |
89 | /* XXX leaks dsos */ | 90 | printf("overlapping maps:\n"); |
90 | free(pos); | 91 | map__fprintf(map, stdout); |
92 | map__fprintf(pos, stdout); | ||
93 | } | ||
94 | |||
95 | if (map->start <= pos->start && map->end > pos->start) | ||
96 | pos->start = map->end; | ||
97 | |||
98 | if (map->end >= pos->end && map->start < pos->end) | ||
99 | pos->end = map->start; | ||
100 | |||
101 | if (verbose >= 2) { | ||
102 | printf("after collision:\n"); | ||
103 | map__fprintf(pos, stdout); | ||
104 | } | ||
105 | |||
106 | if (pos->start >= pos->end) { | ||
107 | list_del_init(&pos->node); | ||
108 | free(pos); | ||
109 | } | ||
91 | } | 110 | } |
92 | } | 111 | } |
93 | 112 | ||