diff options
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/data.c | 9 | ||||
-rw-r--r-- | tools/perf/util/machine.c | 16 | ||||
-rw-r--r-- | tools/perf/util/probe-finder.c | 15 | ||||
-rw-r--r-- | tools/perf/util/symbol-elf.c | 2 |
4 files changed, 31 insertions, 11 deletions
diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c index 1fbcd8bdc11b..55de44ecebef 100644 --- a/tools/perf/util/data.c +++ b/tools/perf/util/data.c | |||
@@ -86,10 +86,17 @@ static int open_file_read(struct perf_data_file *file) | |||
86 | 86 | ||
87 | static int open_file_write(struct perf_data_file *file) | 87 | static int open_file_write(struct perf_data_file *file) |
88 | { | 88 | { |
89 | int fd; | ||
90 | |||
89 | if (check_backup(file)) | 91 | if (check_backup(file)) |
90 | return -1; | 92 | return -1; |
91 | 93 | ||
92 | return open(file->path, O_CREAT|O_RDWR|O_TRUNC, S_IRUSR|S_IWUSR); | 94 | fd = open(file->path, O_CREAT|O_RDWR|O_TRUNC, S_IRUSR|S_IWUSR); |
95 | |||
96 | if (fd < 0) | ||
97 | pr_err("failed to open %s : %s\n", file->path, strerror(errno)); | ||
98 | |||
99 | return fd; | ||
93 | } | 100 | } |
94 | 101 | ||
95 | static int open_file(struct perf_data_file *file) | 102 | static int open_file(struct perf_data_file *file) |
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index a53cd0b8c151..27c2a5efe450 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
@@ -717,7 +717,7 @@ static char *get_kernel_version(const char *root_dir) | |||
717 | } | 717 | } |
718 | 718 | ||
719 | static int map_groups__set_modules_path_dir(struct map_groups *mg, | 719 | static int map_groups__set_modules_path_dir(struct map_groups *mg, |
720 | const char *dir_name) | 720 | const char *dir_name, int depth) |
721 | { | 721 | { |
722 | struct dirent *dent; | 722 | struct dirent *dent; |
723 | DIR *dir = opendir(dir_name); | 723 | DIR *dir = opendir(dir_name); |
@@ -742,7 +742,15 @@ static int map_groups__set_modules_path_dir(struct map_groups *mg, | |||
742 | !strcmp(dent->d_name, "..")) | 742 | !strcmp(dent->d_name, "..")) |
743 | continue; | 743 | continue; |
744 | 744 | ||
745 | ret = map_groups__set_modules_path_dir(mg, path); | 745 | /* Do not follow top-level source and build symlinks */ |
746 | if (depth == 0) { | ||
747 | if (!strcmp(dent->d_name, "source") || | ||
748 | !strcmp(dent->d_name, "build")) | ||
749 | continue; | ||
750 | } | ||
751 | |||
752 | ret = map_groups__set_modules_path_dir(mg, path, | ||
753 | depth + 1); | ||
746 | if (ret < 0) | 754 | if (ret < 0) |
747 | goto out; | 755 | goto out; |
748 | } else { | 756 | } else { |
@@ -786,11 +794,11 @@ static int machine__set_modules_path(struct machine *machine) | |||
786 | if (!version) | 794 | if (!version) |
787 | return -1; | 795 | return -1; |
788 | 796 | ||
789 | snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s/kernel", | 797 | snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s", |
790 | machine->root_dir, version); | 798 | machine->root_dir, version); |
791 | free(version); | 799 | free(version); |
792 | 800 | ||
793 | return map_groups__set_modules_path_dir(&machine->kmaps, modules_path); | 801 | return map_groups__set_modules_path_dir(&machine->kmaps, modules_path, 0); |
794 | } | 802 | } |
795 | 803 | ||
796 | static int machine__create_module(void *arg, const char *name, u64 start) | 804 | static int machine__create_module(void *arg, const char *name, u64 start) |
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index df0238654698..562762117639 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c | |||
@@ -985,7 +985,7 @@ static int debuginfo__find_probes(struct debuginfo *dbg, | |||
985 | 985 | ||
986 | #if _ELFUTILS_PREREQ(0, 142) | 986 | #if _ELFUTILS_PREREQ(0, 142) |
987 | /* Get the call frame information from this dwarf */ | 987 | /* Get the call frame information from this dwarf */ |
988 | pf->cfi = dwarf_getcfi(dbg->dbg); | 988 | pf->cfi = dwarf_getcfi_elf(dwarf_getelf(dbg->dbg)); |
989 | #endif | 989 | #endif |
990 | 990 | ||
991 | off = 0; | 991 | off = 0; |
@@ -1441,13 +1441,15 @@ static int line_range_walk_cb(const char *fname, int lineno, | |||
1441 | void *data) | 1441 | void *data) |
1442 | { | 1442 | { |
1443 | struct line_finder *lf = data; | 1443 | struct line_finder *lf = data; |
1444 | int err; | ||
1444 | 1445 | ||
1445 | if ((strtailcmp(fname, lf->fname) != 0) || | 1446 | if ((strtailcmp(fname, lf->fname) != 0) || |
1446 | (lf->lno_s > lineno || lf->lno_e < lineno)) | 1447 | (lf->lno_s > lineno || lf->lno_e < lineno)) |
1447 | return 0; | 1448 | return 0; |
1448 | 1449 | ||
1449 | if (line_range_add_line(fname, lineno, lf->lr) < 0) | 1450 | err = line_range_add_line(fname, lineno, lf->lr); |
1450 | return -EINVAL; | 1451 | if (err < 0 && err != -EEXIST) |
1452 | return err; | ||
1451 | 1453 | ||
1452 | return 0; | 1454 | return 0; |
1453 | } | 1455 | } |
@@ -1473,14 +1475,15 @@ static int find_line_range_by_line(Dwarf_Die *sp_die, struct line_finder *lf) | |||
1473 | 1475 | ||
1474 | static int line_range_inline_cb(Dwarf_Die *in_die, void *data) | 1476 | static int line_range_inline_cb(Dwarf_Die *in_die, void *data) |
1475 | { | 1477 | { |
1476 | find_line_range_by_line(in_die, data); | 1478 | int ret = find_line_range_by_line(in_die, data); |
1477 | 1479 | ||
1478 | /* | 1480 | /* |
1479 | * We have to check all instances of inlined function, because | 1481 | * We have to check all instances of inlined function, because |
1480 | * some execution paths can be optimized out depends on the | 1482 | * some execution paths can be optimized out depends on the |
1481 | * function argument of instances | 1483 | * function argument of instances. However, if an error occurs, |
1484 | * it should be handled by the caller. | ||
1482 | */ | 1485 | */ |
1483 | return 0; | 1486 | return ret < 0 ? ret : 0; |
1484 | } | 1487 | } |
1485 | 1488 | ||
1486 | /* Search function definition from function name */ | 1489 | /* Search function definition from function name */ |
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 3b7dbf51d4a9..6864661a79dd 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <inttypes.h> | 6 | #include <inttypes.h> |
7 | 7 | ||
8 | #include "symbol.h" | 8 | #include "symbol.h" |
9 | #include "vdso.h" | ||
9 | #include <symbol/kallsyms.h> | 10 | #include <symbol/kallsyms.h> |
10 | #include "debug.h" | 11 | #include "debug.h" |
11 | 12 | ||
@@ -618,6 +619,7 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name, | |||
618 | GElf_Shdr shdr; | 619 | GElf_Shdr shdr; |
619 | ss->adjust_symbols = (ehdr.e_type == ET_EXEC || | 620 | ss->adjust_symbols = (ehdr.e_type == ET_EXEC || |
620 | ehdr.e_type == ET_REL || | 621 | ehdr.e_type == ET_REL || |
622 | is_vdso_map(dso->short_name) || | ||
621 | elf_section_by_name(elf, &ehdr, &shdr, | 623 | elf_section_by_name(elf, &ehdr, &shdr, |
622 | ".gnu.prelink_undo", | 624 | ".gnu.prelink_undo", |
623 | NULL) != NULL); | 625 | NULL) != NULL); |