diff options
author | Paul Mundt <lethal@linux-sh.org> | 2011-08-29 03:08:51 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2011-08-29 03:08:51 -0400 |
commit | b9a3acf46afdafc601947136f63e9dd228cd86e8 (patch) | |
tree | 2b206b6d3c51f673c94fbcdf03df2a699e7110d2 /tools/perf/util/symbol.c | |
parent | 9f0fa7991af382bfa8c9575d2457a0b6ad03ac4c (diff) | |
parent | 21d41f2b312231536cf981c960c83cc4493c0293 (diff) |
Merge branch 'sh/stable-updates' into sh-latest
Diffstat (limited to 'tools/perf/util/symbol.c')
-rw-r--r-- | tools/perf/util/symbol.c | 68 |
1 files changed, 43 insertions, 25 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index eec196329fd9..469c0264ed29 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -1504,6 +1504,17 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter) | |||
1504 | dso->adjust_symbols = 0; | 1504 | dso->adjust_symbols = 0; |
1505 | 1505 | ||
1506 | if (strncmp(dso->name, "/tmp/perf-", 10) == 0) { | 1506 | if (strncmp(dso->name, "/tmp/perf-", 10) == 0) { |
1507 | struct stat st; | ||
1508 | |||
1509 | if (lstat(dso->name, &st) < 0) | ||
1510 | return -1; | ||
1511 | |||
1512 | if (st.st_uid && (st.st_uid != geteuid())) { | ||
1513 | pr_warning("File %s not owned by current user or root, " | ||
1514 | "ignoring it.\n", dso->name); | ||
1515 | return -1; | ||
1516 | } | ||
1517 | |||
1507 | ret = dso__load_perf_map(dso, map, filter); | 1518 | ret = dso__load_perf_map(dso, map, filter); |
1508 | dso->symtab_type = ret > 0 ? SYMTAB__JAVA_JIT : | 1519 | dso->symtab_type = ret > 0 ? SYMTAB__JAVA_JIT : |
1509 | SYMTAB__NOT_FOUND; | 1520 | SYMTAB__NOT_FOUND; |
@@ -2170,27 +2181,22 @@ size_t machines__fprintf_dsos_buildid(struct rb_root *machines, | |||
2170 | return ret; | 2181 | return ret; |
2171 | } | 2182 | } |
2172 | 2183 | ||
2173 | struct dso *dso__new_kernel(const char *name) | 2184 | static struct dso* |
2185 | dso__kernel_findnew(struct machine *machine, const char *name, | ||
2186 | const char *short_name, int dso_type) | ||
2174 | { | 2187 | { |
2175 | struct dso *dso = dso__new(name ?: "[kernel.kallsyms]"); | 2188 | /* |
2176 | 2189 | * The kernel dso could be created by build_id processing. | |
2177 | if (dso != NULL) { | 2190 | */ |
2178 | dso__set_short_name(dso, "[kernel]"); | 2191 | struct dso *dso = __dsos__findnew(&machine->kernel_dsos, name); |
2179 | dso->kernel = DSO_TYPE_KERNEL; | ||
2180 | } | ||
2181 | |||
2182 | return dso; | ||
2183 | } | ||
2184 | 2192 | ||
2185 | static struct dso *dso__new_guest_kernel(struct machine *machine, | 2193 | /* |
2186 | const char *name) | 2194 | * We need to run this in all cases, since during the build_id |
2187 | { | 2195 | * processing we had no idea this was the kernel dso. |
2188 | char bf[PATH_MAX]; | 2196 | */ |
2189 | struct dso *dso = dso__new(name ?: machine__mmap_name(machine, bf, | ||
2190 | sizeof(bf))); | ||
2191 | if (dso != NULL) { | 2197 | if (dso != NULL) { |
2192 | dso__set_short_name(dso, "[guest.kernel]"); | 2198 | dso__set_short_name(dso, short_name); |
2193 | dso->kernel = DSO_TYPE_GUEST_KERNEL; | 2199 | dso->kernel = dso_type; |
2194 | } | 2200 | } |
2195 | 2201 | ||
2196 | return dso; | 2202 | return dso; |
@@ -2208,24 +2214,36 @@ void dso__read_running_kernel_build_id(struct dso *dso, struct machine *machine) | |||
2208 | dso->has_build_id = true; | 2214 | dso->has_build_id = true; |
2209 | } | 2215 | } |
2210 | 2216 | ||
2211 | static struct dso *machine__create_kernel(struct machine *machine) | 2217 | static struct dso *machine__get_kernel(struct machine *machine) |
2212 | { | 2218 | { |
2213 | const char *vmlinux_name = NULL; | 2219 | const char *vmlinux_name = NULL; |
2214 | struct dso *kernel; | 2220 | struct dso *kernel; |
2215 | 2221 | ||
2216 | if (machine__is_host(machine)) { | 2222 | if (machine__is_host(machine)) { |
2217 | vmlinux_name = symbol_conf.vmlinux_name; | 2223 | vmlinux_name = symbol_conf.vmlinux_name; |
2218 | kernel = dso__new_kernel(vmlinux_name); | 2224 | if (!vmlinux_name) |
2225 | vmlinux_name = "[kernel.kallsyms]"; | ||
2226 | |||
2227 | kernel = dso__kernel_findnew(machine, vmlinux_name, | ||
2228 | "[kernel]", | ||
2229 | DSO_TYPE_KERNEL); | ||
2219 | } else { | 2230 | } else { |
2231 | char bf[PATH_MAX]; | ||
2232 | |||
2220 | if (machine__is_default_guest(machine)) | 2233 | if (machine__is_default_guest(machine)) |
2221 | vmlinux_name = symbol_conf.default_guest_vmlinux_name; | 2234 | vmlinux_name = symbol_conf.default_guest_vmlinux_name; |
2222 | kernel = dso__new_guest_kernel(machine, vmlinux_name); | 2235 | if (!vmlinux_name) |
2236 | vmlinux_name = machine__mmap_name(machine, bf, | ||
2237 | sizeof(bf)); | ||
2238 | |||
2239 | kernel = dso__kernel_findnew(machine, vmlinux_name, | ||
2240 | "[guest.kernel]", | ||
2241 | DSO_TYPE_GUEST_KERNEL); | ||
2223 | } | 2242 | } |
2224 | 2243 | ||
2225 | if (kernel != NULL) { | 2244 | if (kernel != NULL && (!kernel->has_build_id)) |
2226 | dso__read_running_kernel_build_id(kernel, machine); | 2245 | dso__read_running_kernel_build_id(kernel, machine); |
2227 | dsos__add(&machine->kernel_dsos, kernel); | 2246 | |
2228 | } | ||
2229 | return kernel; | 2247 | return kernel; |
2230 | } | 2248 | } |
2231 | 2249 | ||
@@ -2329,7 +2347,7 @@ void machine__destroy_kernel_maps(struct machine *machine) | |||
2329 | 2347 | ||
2330 | int machine__create_kernel_maps(struct machine *machine) | 2348 | int machine__create_kernel_maps(struct machine *machine) |
2331 | { | 2349 | { |
2332 | struct dso *kernel = machine__create_kernel(machine); | 2350 | struct dso *kernel = machine__get_kernel(machine); |
2333 | 2351 | ||
2334 | if (kernel == NULL || | 2352 | if (kernel == NULL || |
2335 | __machine__create_kernel_maps(machine, kernel) < 0) | 2353 | __machine__create_kernel_maps(machine, kernel) < 0) |