提交 5230fb7d 编写于 作者: A Arnaldo Carvalho de Melo

perf symbols: Set alloc flag close to setting the long_name

This is a preparatory patch to do with dso__set_long_name what was done
with the short name variant.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-mb7eqhkyejq1qcf3p22wz2x7@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 58a98c9c
...@@ -154,7 +154,7 @@ static struct dso *kernel_get_module_dso(const char *module) ...@@ -154,7 +154,7 @@ static struct dso *kernel_get_module_dso(const char *module)
vmlinux_name = symbol_conf.vmlinux_name; vmlinux_name = symbol_conf.vmlinux_name;
if (vmlinux_name) { if (vmlinux_name) {
if (dso__load_vmlinux(dso, map, vmlinux_name, NULL) <= 0) if (dso__load_vmlinux(dso, map, vmlinux_name, false, NULL) <= 0)
return NULL; return NULL;
} else { } else {
if (dso__load_vmlinux_path(dso, map, NULL) <= 0) { if (dso__load_vmlinux_path(dso, map, NULL) <= 0) {
......
...@@ -1408,7 +1408,8 @@ struct map *map_groups__find_by_name(struct map_groups *mg, ...@@ -1408,7 +1408,8 @@ struct map *map_groups__find_by_name(struct map_groups *mg,
} }
int dso__load_vmlinux(struct dso *dso, struct map *map, int dso__load_vmlinux(struct dso *dso, struct map *map,
const char *vmlinux, symbol_filter_t filter) const char *vmlinux, bool vmlinux_allocated,
symbol_filter_t filter)
{ {
int err = -1; int err = -1;
struct symsrc ss; struct symsrc ss;
...@@ -1438,6 +1439,7 @@ int dso__load_vmlinux(struct dso *dso, struct map *map, ...@@ -1438,6 +1439,7 @@ int dso__load_vmlinux(struct dso *dso, struct map *map,
else else
dso->data_type = DSO_BINARY_TYPE__VMLINUX; dso->data_type = DSO_BINARY_TYPE__VMLINUX;
dso__set_long_name(dso, (char *)vmlinux); dso__set_long_name(dso, (char *)vmlinux);
dso->long_name_allocated = vmlinux_allocated;
dso__set_loaded(dso, map->type); dso__set_loaded(dso, map->type);
pr_debug("Using %s for symbols\n", symfs_vmlinux); pr_debug("Using %s for symbols\n", symfs_vmlinux);
} }
...@@ -1456,21 +1458,16 @@ int dso__load_vmlinux_path(struct dso *dso, struct map *map, ...@@ -1456,21 +1458,16 @@ int dso__load_vmlinux_path(struct dso *dso, struct map *map,
filename = dso__build_id_filename(dso, NULL, 0); filename = dso__build_id_filename(dso, NULL, 0);
if (filename != NULL) { if (filename != NULL) {
err = dso__load_vmlinux(dso, map, filename, filter); err = dso__load_vmlinux(dso, map, filename, true, filter);
if (err > 0) { if (err > 0)
dso->long_name_allocated = 1;
goto out; goto out;
}
free(filename); free(filename);
} }
for (i = 0; i < vmlinux_path__nr_entries; ++i) { for (i = 0; i < vmlinux_path__nr_entries; ++i) {
err = dso__load_vmlinux(dso, map, vmlinux_path[i], filter); err = dso__load_vmlinux(dso, map, vmlinux_path[i], false, filter);
if (err > 0) { if (err > 0)
dso__set_long_name(dso, strdup(vmlinux_path[i]));
dso->long_name_allocated = 1;
break; break;
}
} }
out: out:
return err; return err;
...@@ -1607,15 +1604,8 @@ static int dso__load_kernel_sym(struct dso *dso, struct map *map, ...@@ -1607,15 +1604,8 @@ static int dso__load_kernel_sym(struct dso *dso, struct map *map,
} }
if (!symbol_conf.ignore_vmlinux && symbol_conf.vmlinux_name != NULL) { if (!symbol_conf.ignore_vmlinux && symbol_conf.vmlinux_name != NULL) {
err = dso__load_vmlinux(dso, map, return dso__load_vmlinux(dso, map, symbol_conf.vmlinux_name,
symbol_conf.vmlinux_name, filter); false, filter);
if (err > 0) {
dso__set_long_name(dso,
strdup(symbol_conf.vmlinux_name));
dso->long_name_allocated = 1;
return err;
}
return err;
} }
if (!symbol_conf.ignore_vmlinux && vmlinux_path != NULL) { if (!symbol_conf.ignore_vmlinux && vmlinux_path != NULL) {
...@@ -1671,7 +1661,8 @@ static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map, ...@@ -1671,7 +1661,8 @@ static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map,
*/ */
if (symbol_conf.default_guest_vmlinux_name != NULL) { if (symbol_conf.default_guest_vmlinux_name != NULL) {
err = dso__load_vmlinux(dso, map, err = dso__load_vmlinux(dso, map,
symbol_conf.default_guest_vmlinux_name, filter); symbol_conf.default_guest_vmlinux_name,
false, filter);
return err; return err;
} }
......
...@@ -206,7 +206,8 @@ bool symsrc__possibly_runtime(struct symsrc *ss); ...@@ -206,7 +206,8 @@ bool symsrc__possibly_runtime(struct symsrc *ss);
int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter); int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter);
int dso__load_vmlinux(struct dso *dso, struct map *map, int dso__load_vmlinux(struct dso *dso, struct map *map,
const char *vmlinux, symbol_filter_t filter); const char *vmlinux, bool vmlinux_allocated,
symbol_filter_t filter);
int dso__load_vmlinux_path(struct dso *dso, struct map *map, int dso__load_vmlinux_path(struct dso *dso, struct map *map,
symbol_filter_t filter); symbol_filter_t filter);
int dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map, int dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册