diff options
author | Ingo Molnar <mingo@elte.hu> | 2010-03-17 06:31:45 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-03-17 06:31:48 -0400 |
commit | e4713e93b125497e9ba44d93de1bd9d8e5ad8946 (patch) | |
tree | c57f865a10fc1b2419f83bcbbe4a46ee711a60a3 /tools/perf/util/symbol.c | |
parent | 984763cb90d4b5444baa0c3e43feff7926bf1834 (diff) | |
parent | a6b84574eed7e4fd8cb8dac2d0926fe2cf34b941 (diff) |
Merge branch 'perf/urgent' into perf/core
Merge reason: We'll be queueing dependent changes.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/symbol.c')
-rw-r--r-- | tools/perf/util/symbol.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 292f941555a8..3eb9de4baef3 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -151,9 +151,17 @@ void dso__set_long_name(struct dso *self, char *name) | |||
151 | self->long_name_len = strlen(name); | 151 | self->long_name_len = strlen(name); |
152 | } | 152 | } |
153 | 153 | ||
154 | static void dso__set_short_name(struct dso *self, const char *name) | ||
155 | { | ||
156 | if (name == NULL) | ||
157 | return; | ||
158 | self->short_name = name; | ||
159 | self->short_name_len = strlen(name); | ||
160 | } | ||
161 | |||
154 | static void dso__set_basename(struct dso *self) | 162 | static void dso__set_basename(struct dso *self) |
155 | { | 163 | { |
156 | self->short_name = basename(self->long_name); | 164 | dso__set_short_name(self, basename(self->long_name)); |
157 | } | 165 | } |
158 | 166 | ||
159 | struct dso *dso__new(const char *name) | 167 | struct dso *dso__new(const char *name) |
@@ -164,7 +172,7 @@ struct dso *dso__new(const char *name) | |||
164 | int i; | 172 | int i; |
165 | strcpy(self->name, name); | 173 | strcpy(self->name, name); |
166 | dso__set_long_name(self, self->name); | 174 | dso__set_long_name(self, self->name); |
167 | self->short_name = self->name; | 175 | dso__set_short_name(self, self->name); |
168 | for (i = 0; i < MAP__NR_TYPES; ++i) | 176 | for (i = 0; i < MAP__NR_TYPES; ++i) |
169 | self->symbols[i] = self->symbol_names[i] = RB_ROOT; | 177 | self->symbols[i] = self->symbol_names[i] = RB_ROOT; |
170 | self->slen_calculated = 0; | 178 | self->slen_calculated = 0; |
@@ -885,7 +893,6 @@ static int dso__load_sym(struct dso *self, struct map *map, const char *name, | |||
885 | struct kmap *kmap = self->kernel ? map__kmap(map) : NULL; | 893 | struct kmap *kmap = self->kernel ? map__kmap(map) : NULL; |
886 | struct map *curr_map = map; | 894 | struct map *curr_map = map; |
887 | struct dso *curr_dso = self; | 895 | struct dso *curr_dso = self; |
888 | size_t dso_name_len = strlen(self->short_name); | ||
889 | Elf_Data *symstrs, *secstrs; | 896 | Elf_Data *symstrs, *secstrs; |
890 | uint32_t nr_syms; | 897 | uint32_t nr_syms; |
891 | int err = -1; | 898 | int err = -1; |
@@ -975,7 +982,8 @@ static int dso__load_sym(struct dso *self, struct map *map, const char *name, | |||
975 | char dso_name[PATH_MAX]; | 982 | char dso_name[PATH_MAX]; |
976 | 983 | ||
977 | if (strcmp(section_name, | 984 | if (strcmp(section_name, |
978 | curr_dso->short_name + dso_name_len) == 0) | 985 | (curr_dso->short_name + |
986 | self->short_name_len)) == 0) | ||
979 | goto new_symbol; | 987 | goto new_symbol; |
980 | 988 | ||
981 | if (strcmp(section_name, ".text") == 0) { | 989 | if (strcmp(section_name, ".text") == 0) { |
@@ -1770,7 +1778,7 @@ struct dso *dso__new_kernel(const char *name) | |||
1770 | struct dso *self = dso__new(name ?: "[kernel.kallsyms]"); | 1778 | struct dso *self = dso__new(name ?: "[kernel.kallsyms]"); |
1771 | 1779 | ||
1772 | if (self != NULL) { | 1780 | if (self != NULL) { |
1773 | self->short_name = "[kernel]"; | 1781 | dso__set_short_name(self, "[kernel]"); |
1774 | self->kernel = 1; | 1782 | self->kernel = 1; |
1775 | } | 1783 | } |
1776 | 1784 | ||