aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2013-12-10 09:58:52 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-12-10 14:51:09 -0500
commit5230fb7db42914e47786a6e920d2624739b0f896 (patch)
tree6a4b843c41f87fe161c3ac2e2d2362c547efe94c
parent58a98c9cc583435784a93f23754128363b4cca94 (diff)
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.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/util/probe-event.c2
-rw-r--r--tools/perf/util/symbol.c31
-rw-r--r--tools/perf/util/symbol.h3
3 files changed, 14 insertions, 22 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 9c6989ca2bea..d7cff57945c2 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -154,7 +154,7 @@ static struct dso *kernel_get_module_dso(const char *module)
154 154
155 vmlinux_name = symbol_conf.vmlinux_name; 155 vmlinux_name = symbol_conf.vmlinux_name;
156 if (vmlinux_name) { 156 if (vmlinux_name) {
157 if (dso__load_vmlinux(dso, map, vmlinux_name, NULL) <= 0) 157 if (dso__load_vmlinux(dso, map, vmlinux_name, false, NULL) <= 0)
158 return NULL; 158 return NULL;
159 } else { 159 } else {
160 if (dso__load_vmlinux_path(dso, map, NULL) <= 0) { 160 if (dso__load_vmlinux_path(dso, map, NULL) <= 0) {
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 265a149bc43f..9a5de8837d6d 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1408,7 +1408,8 @@ struct map *map_groups__find_by_name(struct map_groups *mg,
1408} 1408}
1409 1409
1410int dso__load_vmlinux(struct dso *dso, struct map *map, 1410int dso__load_vmlinux(struct dso *dso, struct map *map,
1411 const char *vmlinux, symbol_filter_t filter) 1411 const char *vmlinux, bool vmlinux_allocated,
1412 symbol_filter_t filter)
1412{ 1413{
1413 int err = -1; 1414 int err = -1;
1414 struct symsrc ss; 1415 struct symsrc ss;
@@ -1438,6 +1439,7 @@ int dso__load_vmlinux(struct dso *dso, struct map *map,
1438 else 1439 else
1439 dso->data_type = DSO_BINARY_TYPE__VMLINUX; 1440 dso->data_type = DSO_BINARY_TYPE__VMLINUX;
1440 dso__set_long_name(dso, (char *)vmlinux); 1441 dso__set_long_name(dso, (char *)vmlinux);
1442 dso->long_name_allocated = vmlinux_allocated;
1441 dso__set_loaded(dso, map->type); 1443 dso__set_loaded(dso, map->type);
1442 pr_debug("Using %s for symbols\n", symfs_vmlinux); 1444 pr_debug("Using %s for symbols\n", symfs_vmlinux);
1443 } 1445 }
@@ -1456,21 +1458,16 @@ int dso__load_vmlinux_path(struct dso *dso, struct map *map,
1456 1458
1457 filename = dso__build_id_filename(dso, NULL, 0); 1459 filename = dso__build_id_filename(dso, NULL, 0);
1458 if (filename != NULL) { 1460 if (filename != NULL) {
1459 err = dso__load_vmlinux(dso, map, filename, filter); 1461 err = dso__load_vmlinux(dso, map, filename, true, filter);
1460 if (err > 0) { 1462 if (err > 0)
1461 dso->long_name_allocated = 1;
1462 goto out; 1463 goto out;
1463 }
1464 free(filename); 1464 free(filename);
1465 } 1465 }
1466 1466
1467 for (i = 0; i < vmlinux_path__nr_entries; ++i) { 1467 for (i = 0; i < vmlinux_path__nr_entries; ++i) {
1468 err = dso__load_vmlinux(dso, map, vmlinux_path[i], filter); 1468 err = dso__load_vmlinux(dso, map, vmlinux_path[i], false, filter);
1469 if (err > 0) { 1469 if (err > 0)
1470 dso__set_long_name(dso, strdup(vmlinux_path[i]));
1471 dso->long_name_allocated = 1;
1472 break; 1470 break;
1473 }
1474 } 1471 }
1475out: 1472out:
1476 return err; 1473 return err;
@@ -1607,15 +1604,8 @@ static int dso__load_kernel_sym(struct dso *dso, struct map *map,
1607 } 1604 }
1608 1605
1609 if (!symbol_conf.ignore_vmlinux && symbol_conf.vmlinux_name != NULL) { 1606 if (!symbol_conf.ignore_vmlinux && symbol_conf.vmlinux_name != NULL) {
1610 err = dso__load_vmlinux(dso, map, 1607 return dso__load_vmlinux(dso, map, symbol_conf.vmlinux_name,
1611 symbol_conf.vmlinux_name, filter); 1608 false, filter);
1612 if (err > 0) {
1613 dso__set_long_name(dso,
1614 strdup(symbol_conf.vmlinux_name));
1615 dso->long_name_allocated = 1;
1616 return err;
1617 }
1618 return err;
1619 } 1609 }
1620 1610
1621 if (!symbol_conf.ignore_vmlinux && vmlinux_path != NULL) { 1611 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 */ 1661 */
1672 if (symbol_conf.default_guest_vmlinux_name != NULL) { 1662 if (symbol_conf.default_guest_vmlinux_name != NULL) {
1673 err = dso__load_vmlinux(dso, map, 1663 err = dso__load_vmlinux(dso, map,
1674 symbol_conf.default_guest_vmlinux_name, filter); 1664 symbol_conf.default_guest_vmlinux_name,
1665 false, filter);
1675 return err; 1666 return err;
1676 } 1667 }
1677 1668
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index f1031a1358a1..6de9c2b8a601 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -206,7 +206,8 @@ bool symsrc__possibly_runtime(struct symsrc *ss);
206 206
207int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter); 207int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter);
208int dso__load_vmlinux(struct dso *dso, struct map *map, 208int dso__load_vmlinux(struct dso *dso, struct map *map,
209 const char *vmlinux, symbol_filter_t filter); 209 const char *vmlinux, bool vmlinux_allocated,
210 symbol_filter_t filter);
210int dso__load_vmlinux_path(struct dso *dso, struct map *map, 211int dso__load_vmlinux_path(struct dso *dso, struct map *map,
211 symbol_filter_t filter); 212 symbol_filter_t filter);
212int dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map, 213int dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map,