Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+14 -22
+1 -1
tools/perf/util/probe-event.c
··· 154 154 155 155 vmlinux_name = symbol_conf.vmlinux_name; 156 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 158 return NULL; 159 159 } else { 160 160 if (dso__load_vmlinux_path(dso, map, NULL) <= 0) {
+11 -20
tools/perf/util/symbol.c
··· 1408 1408 } 1409 1409 1410 1410 int 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 1414 int err = -1; 1414 1415 struct symsrc ss; ··· 1439 1438 else 1440 1439 dso->data_type = DSO_BINARY_TYPE__VMLINUX; 1441 1440 dso__set_long_name(dso, (char *)vmlinux); 1441 + dso->long_name_allocated = vmlinux_allocated; 1442 1442 dso__set_loaded(dso, map->type); 1443 1443 pr_debug("Using %s for symbols\n", symfs_vmlinux); 1444 1444 } ··· 1458 1456 1459 1457 filename = dso__build_id_filename(dso, NULL, 0); 1460 1458 if (filename != NULL) { 1461 - err = dso__load_vmlinux(dso, map, filename, filter); 1462 - if (err > 0) { 1463 - dso->long_name_allocated = 1; 1459 + err = dso__load_vmlinux(dso, map, filename, true, filter); 1460 + if (err > 0) 1464 1461 goto out; 1465 - } 1466 1462 free(filename); 1467 1463 } 1468 1464 1469 1465 for (i = 0; i < vmlinux_path__nr_entries; ++i) { 1470 - err = dso__load_vmlinux(dso, map, vmlinux_path[i], filter); 1471 - if (err > 0) { 1472 - dso__set_long_name(dso, strdup(vmlinux_path[i])); 1473 - dso->long_name_allocated = 1; 1466 + err = dso__load_vmlinux(dso, map, vmlinux_path[i], false, filter); 1467 + if (err > 0) 1474 1468 break; 1475 - } 1476 1469 } 1477 1470 out: 1478 1471 return err; ··· 1604 1607 } 1605 1608 1606 1609 if (!symbol_conf.ignore_vmlinux && symbol_conf.vmlinux_name != NULL) { 1607 - err = dso__load_vmlinux(dso, map, 1608 - symbol_conf.vmlinux_name, filter); 1609 - if (err > 0) { 1610 - dso__set_long_name(dso, 1611 - strdup(symbol_conf.vmlinux_name)); 1612 - dso->long_name_allocated = 1; 1613 - return err; 1614 - } 1615 - return err; 1610 + return dso__load_vmlinux(dso, map, symbol_conf.vmlinux_name, 1611 + false, filter); 1616 1612 } 1617 1613 1618 1614 if (!symbol_conf.ignore_vmlinux && vmlinux_path != NULL) { ··· 1661 1671 */ 1662 1672 if (symbol_conf.default_guest_vmlinux_name != NULL) { 1663 1673 err = dso__load_vmlinux(dso, map, 1664 - symbol_conf.default_guest_vmlinux_name, filter); 1674 + symbol_conf.default_guest_vmlinux_name, 1675 + false, filter); 1665 1676 return err; 1666 1677 } 1667 1678
+2 -1
tools/perf/util/symbol.h
··· 206 206 207 207 int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter); 208 208 int 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); 210 211 int dso__load_vmlinux_path(struct dso *dso, struct map *map, 211 212 symbol_filter_t filter); 212 213 int dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map,