aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/util/probe-event.c30
-rw-r--r--tools/perf/util/probe-finder.c42
2 files changed, 38 insertions, 34 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 3b6a5297bf16..089d78ecbdda 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -95,7 +95,7 @@ static int init_vmlinux(void)
95 goto out; 95 goto out;
96 96
97 if (machine__create_kernel_maps(&machine) < 0) { 97 if (machine__create_kernel_maps(&machine) < 0) {
98 pr_debug("machine__create_kernel_maps "); 98 pr_debug("machine__create_kernel_maps() failed.\n");
99 goto out; 99 goto out;
100 } 100 }
101out: 101out:
@@ -140,7 +140,8 @@ static int open_vmlinux(const char *module)
140{ 140{
141 const char *path = kernel_get_module_path(module); 141 const char *path = kernel_get_module_path(module);
142 if (!path) { 142 if (!path) {
143 pr_err("Failed to find path of %s module", module ?: "kernel"); 143 pr_err("Failed to find path of %s module.\n",
144 module ?: "kernel");
144 return -ENOENT; 145 return -ENOENT;
145 } 146 }
146 pr_debug("Try to open %s\n", path); 147 pr_debug("Try to open %s\n", path);
@@ -217,7 +218,7 @@ static int try_to_find_probe_trace_events(struct perf_probe_event *pev,
217 pr_warning("Warning: No dwarf info found in the vmlinux - " 218 pr_warning("Warning: No dwarf info found in the vmlinux - "
218 "please rebuild kernel with CONFIG_DEBUG_INFO=y.\n"); 219 "please rebuild kernel with CONFIG_DEBUG_INFO=y.\n");
219 if (!need_dwarf) { 220 if (!need_dwarf) {
220 pr_debug("Trying to use symbols.\nn"); 221 pr_debug("Trying to use symbols.\n");
221 return 0; 222 return 0;
222 } 223 }
223 } 224 }
@@ -457,7 +458,7 @@ int show_available_vars(struct perf_probe_event *pevs, int npevs,
457 458
458 fd = open_vmlinux(module); 459 fd = open_vmlinux(module);
459 if (fd < 0) { 460 if (fd < 0) {
460 pr_warning("Failed to open debuginfo file.\n"); 461 pr_warning("Failed to open debug information file.\n");
461 return fd; 462 return fd;
462 } 463 }
463 464
@@ -690,39 +691,40 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev)
690 691
691 /* Exclusion check */ 692 /* Exclusion check */
692 if (pp->lazy_line && pp->line) { 693 if (pp->lazy_line && pp->line) {
693 semantic_error("Lazy pattern can't be used with line number."); 694 semantic_error("Lazy pattern can't be used with"
695 " line number.\n");
694 return -EINVAL; 696 return -EINVAL;
695 } 697 }
696 698
697 if (pp->lazy_line && pp->offset) { 699 if (pp->lazy_line && pp->offset) {
698 semantic_error("Lazy pattern can't be used with offset."); 700 semantic_error("Lazy pattern can't be used with offset.\n");
699 return -EINVAL; 701 return -EINVAL;
700 } 702 }
701 703
702 if (pp->line && pp->offset) { 704 if (pp->line && pp->offset) {
703 semantic_error("Offset can't be used with line number."); 705 semantic_error("Offset can't be used with line number.\n");
704 return -EINVAL; 706 return -EINVAL;
705 } 707 }
706 708
707 if (!pp->line && !pp->lazy_line && pp->file && !pp->function) { 709 if (!pp->line && !pp->lazy_line && pp->file && !pp->function) {
708 semantic_error("File always requires line number or " 710 semantic_error("File always requires line number or "
709 "lazy pattern."); 711 "lazy pattern.\n");
710 return -EINVAL; 712 return -EINVAL;
711 } 713 }
712 714
713 if (pp->offset && !pp->function) { 715 if (pp->offset && !pp->function) {
714 semantic_error("Offset requires an entry function."); 716 semantic_error("Offset requires an entry function.\n");
715 return -EINVAL; 717 return -EINVAL;
716 } 718 }
717 719
718 if (pp->retprobe && !pp->function) { 720 if (pp->retprobe && !pp->function) {
719 semantic_error("Return probe requires an entry function."); 721 semantic_error("Return probe requires an entry function.\n");
720 return -EINVAL; 722 return -EINVAL;
721 } 723 }
722 724
723 if ((pp->offset || pp->line || pp->lazy_line) && pp->retprobe) { 725 if ((pp->offset || pp->line || pp->lazy_line) && pp->retprobe) {
724 semantic_error("Offset/Line/Lazy pattern can't be used with " 726 semantic_error("Offset/Line/Lazy pattern can't be used with "
725 "return probe."); 727 "return probe.\n");
726 return -EINVAL; 728 return -EINVAL;
727 } 729 }
728 730
@@ -996,7 +998,7 @@ int synthesize_perf_probe_arg(struct perf_probe_arg *pa, char *buf, size_t len)
996 998
997 return tmp - buf; 999 return tmp - buf;
998error: 1000error:
999 pr_debug("Failed to synthesize perf probe argument: %s", 1001 pr_debug("Failed to synthesize perf probe argument: %s\n",
1000 strerror(-ret)); 1002 strerror(-ret));
1001 return ret; 1003 return ret;
1002} 1004}
@@ -1046,7 +1048,7 @@ static char *synthesize_perf_probe_point(struct perf_probe_point *pp)
1046 1048
1047 return buf; 1049 return buf;
1048error: 1050error:
1049 pr_debug("Failed to synthesize perf probe point: %s", 1051 pr_debug("Failed to synthesize perf probe point: %s\n",
1050 strerror(-ret)); 1052 strerror(-ret));
1051 if (buf) 1053 if (buf)
1052 free(buf); 1054 free(buf);
@@ -1787,7 +1789,7 @@ static int del_trace_probe_event(int fd, const char *group,
1787 1789
1788 ret = e_snprintf(buf, 128, "%s:%s", group, event); 1790 ret = e_snprintf(buf, 128, "%s:%s", group, event);
1789 if (ret < 0) { 1791 if (ret < 0) {
1790 pr_err("Failed to copy event."); 1792 pr_err("Failed to copy event.\n");
1791 return ret; 1793 return ret;
1792 } 1794 }
1793 1795
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 3991d73d1cff..90b629226bd7 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -627,8 +627,8 @@ static_var:
627 regs = get_arch_regstr(regn); 627 regs = get_arch_regstr(regn);
628 if (!regs) { 628 if (!regs) {
629 /* This should be a bug in DWARF or this tool */ 629 /* This should be a bug in DWARF or this tool */
630 pr_warning("Mapping for DWARF register number %u " 630 pr_warning("Mapping for the register number %u "
631 "missing on this architecture.", regn); 631 "missing on this architecture.\n", regn);
632 return -ERANGE; 632 return -ERANGE;
633 } 633 }
634 634
@@ -674,13 +674,14 @@ static int convert_variable_type(Dwarf_Die *vr_die,
674 if (ret != DW_TAG_pointer_type && 674 if (ret != DW_TAG_pointer_type &&
675 ret != DW_TAG_array_type) { 675 ret != DW_TAG_array_type) {
676 pr_warning("Failed to cast into string: " 676 pr_warning("Failed to cast into string: "
677 "%s(%s) is not a pointer nor array.", 677 "%s(%s) is not a pointer nor array.\n",
678 dwarf_diename(vr_die), dwarf_diename(&type)); 678 dwarf_diename(vr_die), dwarf_diename(&type));
679 return -EINVAL; 679 return -EINVAL;
680 } 680 }
681 if (ret == DW_TAG_pointer_type) { 681 if (ret == DW_TAG_pointer_type) {
682 if (die_get_real_type(&type, &type) == NULL) { 682 if (die_get_real_type(&type, &type) == NULL) {
683 pr_warning("Failed to get a type information."); 683 pr_warning("Failed to get a type"
684 " information.\n");
684 return -ENOENT; 685 return -ENOENT;
685 } 686 }
686 while (*ref_ptr) 687 while (*ref_ptr)
@@ -695,7 +696,7 @@ static int convert_variable_type(Dwarf_Die *vr_die,
695 if (!die_compare_name(&type, "char") && 696 if (!die_compare_name(&type, "char") &&
696 !die_compare_name(&type, "unsigned char")) { 697 !die_compare_name(&type, "unsigned char")) {
697 pr_warning("Failed to cast into string: " 698 pr_warning("Failed to cast into string: "
698 "%s is not (unsigned) char *.", 699 "%s is not (unsigned) char *.\n",
699 dwarf_diename(vr_die)); 700 dwarf_diename(vr_die));
700 return -EINVAL; 701 return -EINVAL;
701 } 702 }
@@ -805,8 +806,8 @@ static int convert_variable_fields(Dwarf_Die *vr_die, const char *varname,
805 return -EINVAL; 806 return -EINVAL;
806 } 807 }
807 if (field->name[0] == '[') { 808 if (field->name[0] == '[') {
808 pr_err("Semantic error: %s is not a pointor nor array.", 809 pr_err("Semantic error: %s is not a pointor"
809 varname); 810 " nor array.\n", varname);
810 return -EINVAL; 811 return -EINVAL;
811 } 812 }
812 if (field->ref) { 813 if (field->ref) {
@@ -953,7 +954,7 @@ static int convert_to_trace_point(Dwarf_Die *sp_die, Dwarf_Addr paddr,
953 name = dwarf_diename(sp_die); 954 name = dwarf_diename(sp_die);
954 if (name) { 955 if (name) {
955 if (dwarf_entrypc(sp_die, &eaddr) != 0) { 956 if (dwarf_entrypc(sp_die, &eaddr) != 0) {
956 pr_warning("Failed to get entry pc of %s\n", 957 pr_warning("Failed to get entry address of %s\n",
957 dwarf_diename(sp_die)); 958 dwarf_diename(sp_die));
958 return -ENOENT; 959 return -ENOENT;
959 } 960 }
@@ -969,7 +970,7 @@ static int convert_to_trace_point(Dwarf_Die *sp_die, Dwarf_Addr paddr,
969 if (retprobe) { 970 if (retprobe) {
970 if (eaddr != paddr) { 971 if (eaddr != paddr) {
971 pr_warning("Return probe must be on the head of" 972 pr_warning("Return probe must be on the head of"
972 " a real function\n"); 973 " a real function.\n");
973 return -EINVAL; 974 return -EINVAL;
974 } 975 }
975 tp->retprobe = true; 976 tp->retprobe = true;
@@ -1008,7 +1009,7 @@ static int call_probe_finder(Dwarf_Die *sp_die, struct probe_finder *pf)
1008 Dwarf_Frame *frame; 1009 Dwarf_Frame *frame;
1009 if (dwarf_cfi_addrframe(pf->cfi, pf->addr, &frame) != 0 || 1010 if (dwarf_cfi_addrframe(pf->cfi, pf->addr, &frame) != 0 ||
1010 dwarf_frame_cfa(frame, &pf->fb_ops, &nops) != 0) { 1011 dwarf_frame_cfa(frame, &pf->fb_ops, &nops) != 0) {
1011 pr_warning("Failed to get CFA on 0x%jx\n", 1012 pr_warning("Failed to get call frame on 0x%jx\n",
1012 (uintmax_t)pf->addr); 1013 (uintmax_t)pf->addr);
1013 return -ENOENT; 1014 return -ENOENT;
1014 } 1015 }
@@ -1035,7 +1036,7 @@ static int find_probe_point_by_line(struct probe_finder *pf)
1035 int ret = 0; 1036 int ret = 0;
1036 1037
1037 if (dwarf_getsrclines(&pf->cu_die, &lines, &nlines) != 0) { 1038 if (dwarf_getsrclines(&pf->cu_die, &lines, &nlines) != 0) {
1038 pr_warning("No source lines found in this CU.\n"); 1039 pr_warning("No source lines found.\n");
1039 return -ENOENT; 1040 return -ENOENT;
1040 } 1041 }
1041 1042
@@ -1137,7 +1138,7 @@ static int find_probe_point_lazy(Dwarf_Die *sp_die, struct probe_finder *pf)
1137 } 1138 }
1138 1139
1139 if (dwarf_getsrclines(&pf->cu_die, &lines, &nlines) != 0) { 1140 if (dwarf_getsrclines(&pf->cu_die, &lines, &nlines) != 0) {
1140 pr_warning("No source lines found in this CU.\n"); 1141 pr_warning("No source lines found.\n");
1141 return -ENOENT; 1142 return -ENOENT;
1142 } 1143 }
1143 1144
@@ -1195,7 +1196,7 @@ static int probe_point_inline_cb(Dwarf_Die *in_die, void *data)
1195 else { 1196 else {
1196 /* Get probe address */ 1197 /* Get probe address */
1197 if (dwarf_entrypc(in_die, &addr) != 0) { 1198 if (dwarf_entrypc(in_die, &addr) != 0) {
1198 pr_warning("Failed to get entry pc of %s.\n", 1199 pr_warning("Failed to get entry address of %s.\n",
1199 dwarf_diename(in_die)); 1200 dwarf_diename(in_die));
1200 param->retval = -ENOENT; 1201 param->retval = -ENOENT;
1201 return DWARF_CB_ABORT; 1202 return DWARF_CB_ABORT;
@@ -1236,8 +1237,8 @@ static int probe_point_search_cb(Dwarf_Die *sp_die, void *data)
1236 param->retval = find_probe_point_lazy(sp_die, pf); 1237 param->retval = find_probe_point_lazy(sp_die, pf);
1237 else { 1238 else {
1238 if (dwarf_entrypc(sp_die, &pf->addr) != 0) { 1239 if (dwarf_entrypc(sp_die, &pf->addr) != 0) {
1239 pr_warning("Failed to get entry pc of %s.\n", 1240 pr_warning("Failed to get entry address of "
1240 dwarf_diename(sp_die)); 1241 "%s.\n", dwarf_diename(sp_die));
1241 param->retval = -ENOENT; 1242 param->retval = -ENOENT;
1242 return DWARF_CB_ABORT; 1243 return DWARF_CB_ABORT;
1243 } 1244 }
@@ -1279,7 +1280,7 @@ static int find_probes(int fd, struct probe_finder *pf)
1279 1280
1280 dbg = dwfl_init_offline_dwarf(fd, &dwfl, &bias); 1281 dbg = dwfl_init_offline_dwarf(fd, &dwfl, &bias);
1281 if (!dbg) { 1282 if (!dbg) {
1282 pr_warning("No dwarf info found in the vmlinux - " 1283 pr_warning("No debug information found in the vmlinux - "
1283 "please rebuild with CONFIG_DEBUG_INFO=y.\n"); 1284 "please rebuild with CONFIG_DEBUG_INFO=y.\n");
1284 return -EBADF; 1285 return -EBADF;
1285 } 1286 }
@@ -1524,7 +1525,7 @@ int find_perf_probe_point(unsigned long addr, struct perf_probe_point *ppt)
1524 /* Open the live linux kernel */ 1525 /* Open the live linux kernel */
1525 dbg = dwfl_init_live_kernel_dwarf(addr, &dwfl, &bias); 1526 dbg = dwfl_init_live_kernel_dwarf(addr, &dwfl, &bias);
1526 if (!dbg) { 1527 if (!dbg) {
1527 pr_warning("No dwarf info found in the vmlinux - " 1528 pr_warning("No debug information found in the vmlinux - "
1528 "please rebuild with CONFIG_DEBUG_INFO=y.\n"); 1529 "please rebuild with CONFIG_DEBUG_INFO=y.\n");
1529 ret = -EINVAL; 1530 ret = -EINVAL;
1530 goto end; 1531 goto end;
@@ -1534,7 +1535,8 @@ int find_perf_probe_point(unsigned long addr, struct perf_probe_point *ppt)
1534 addr += bias; 1535 addr += bias;
1535 /* Find cu die */ 1536 /* Find cu die */
1536 if (!dwarf_addrdie(dbg, (Dwarf_Addr)addr - bias, &cudie)) { 1537 if (!dwarf_addrdie(dbg, (Dwarf_Addr)addr - bias, &cudie)) {
1537 pr_warning("No CU DIE is found at %lx\n", addr); 1538 pr_warning("Failed to find debug information for address %lx\n",
1539 addr);
1538 ret = -EINVAL; 1540 ret = -EINVAL;
1539 goto end; 1541 goto end;
1540 } 1542 }
@@ -1659,7 +1661,7 @@ static int find_line_range_by_line(Dwarf_Die *sp_die, struct line_finder *lf)
1659 1661
1660 line_list__init(&lf->lr->line_list); 1662 line_list__init(&lf->lr->line_list);
1661 if (dwarf_getsrclines(&lf->cu_die, &lines, &nlines) != 0) { 1663 if (dwarf_getsrclines(&lf->cu_die, &lines, &nlines) != 0) {
1662 pr_warning("No source lines found in this CU.\n"); 1664 pr_warning("No source lines found.\n");
1663 return -ENOENT; 1665 return -ENOENT;
1664 } 1666 }
1665 1667
@@ -1784,7 +1786,7 @@ int find_line_range(int fd, struct line_range *lr)
1784 1786
1785 dbg = dwfl_init_offline_dwarf(fd, &dwfl, &bias); 1787 dbg = dwfl_init_offline_dwarf(fd, &dwfl, &bias);
1786 if (!dbg) { 1788 if (!dbg) {
1787 pr_warning("No dwarf info found in the vmlinux - " 1789 pr_warning("No debug information found in the vmlinux - "
1788 "please rebuild with CONFIG_DEBUG_INFO=y.\n"); 1790 "please rebuild with CONFIG_DEBUG_INFO=y.\n");
1789 return -EBADF; 1791 return -EBADF;
1790 } 1792 }