aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/probe-event.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/probe-event.c')
-rw-r--r--tools/perf/util/probe-event.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 784ea42ad8cb..ac15ff780009 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -258,21 +258,33 @@ static void clear_probe_trace_events(struct probe_trace_event *tevs, int ntevs)
258#ifdef HAVE_DWARF_SUPPORT 258#ifdef HAVE_DWARF_SUPPORT
259 259
260/* Open new debuginfo of given module */ 260/* Open new debuginfo of given module */
261static struct debuginfo *open_debuginfo(const char *module) 261static struct debuginfo *open_debuginfo(const char *module, bool silent)
262{ 262{
263 const char *path = module; 263 const char *path = module;
264 struct debuginfo *ret;
264 265
265 if (!module || !strchr(module, '/')) { 266 if (!module || !strchr(module, '/')) {
266 path = kernel_get_module_path(module); 267 path = kernel_get_module_path(module);
267 if (!path) { 268 if (!path) {
268 pr_err("Failed to find path of %s module.\n", 269 if (!silent)
269 module ?: "kernel"); 270 pr_err("Failed to find path of %s module.\n",
271 module ?: "kernel");
270 return NULL; 272 return NULL;
271 } 273 }
272 } 274 }
273 return debuginfo__new(path); 275 ret = debuginfo__new(path);
276 if (!ret && !silent) {
277 pr_warning("The %s file has no debug information.\n", path);
278 if (!module || !strtailcmp(path, ".ko"))
279 pr_warning("Rebuild with CONFIG_DEBUG_INFO=y, ");
280 else
281 pr_warning("Rebuild with -g, ");
282 pr_warning("or install an appropriate debuginfo package.\n");
283 }
284 return ret;
274} 285}
275 286
287
276static int get_text_start_address(const char *exec, unsigned long *address) 288static int get_text_start_address(const char *exec, unsigned long *address)
277{ 289{
278 Elf *elf; 290 Elf *elf;
@@ -333,15 +345,13 @@ static int find_perf_probe_point_from_dwarf(struct probe_trace_point *tp,
333 pr_debug("try to find information at %" PRIx64 " in %s\n", addr, 345 pr_debug("try to find information at %" PRIx64 " in %s\n", addr,
334 tp->module ? : "kernel"); 346 tp->module ? : "kernel");
335 347
336 dinfo = open_debuginfo(tp->module); 348 dinfo = open_debuginfo(tp->module, verbose == 0);
337 if (dinfo) { 349 if (dinfo) {
338 ret = debuginfo__find_probe_point(dinfo, 350 ret = debuginfo__find_probe_point(dinfo,
339 (unsigned long)addr, pp); 351 (unsigned long)addr, pp);
340 debuginfo__delete(dinfo); 352 debuginfo__delete(dinfo);
341 } else { 353 } else
342 pr_debug("Failed to open debuginfo at 0x%" PRIx64 "\n", addr);
343 ret = -ENOENT; 354 ret = -ENOENT;
344 }
345 355
346 if (ret > 0) { 356 if (ret > 0) {
347 pp->retprobe = tp->retprobe; 357 pp->retprobe = tp->retprobe;
@@ -457,13 +467,11 @@ static int try_to_find_probe_trace_events(struct perf_probe_event *pev,
457 struct debuginfo *dinfo; 467 struct debuginfo *dinfo;
458 int ntevs, ret = 0; 468 int ntevs, ret = 0;
459 469
460 dinfo = open_debuginfo(target); 470 dinfo = open_debuginfo(target, !need_dwarf);
461 471
462 if (!dinfo) { 472 if (!dinfo) {
463 if (need_dwarf) { 473 if (need_dwarf)
464 pr_warning("Failed to open debuginfo file.\n");
465 return -ENOENT; 474 return -ENOENT;
466 }
467 pr_debug("Could not open debuginfo. Try to use symbols.\n"); 475 pr_debug("Could not open debuginfo. Try to use symbols.\n");
468 return 0; 476 return 0;
469 } 477 }
@@ -620,11 +628,9 @@ static int __show_line_range(struct line_range *lr, const char *module)
620 char *tmp; 628 char *tmp;
621 629
622 /* Search a line range */ 630 /* Search a line range */
623 dinfo = open_debuginfo(module); 631 dinfo = open_debuginfo(module, false);
624 if (!dinfo) { 632 if (!dinfo)
625 pr_warning("Failed to open debuginfo file.\n");
626 return -ENOENT; 633 return -ENOENT;
627 }
628 634
629 ret = debuginfo__find_line_range(dinfo, lr); 635 ret = debuginfo__find_line_range(dinfo, lr);
630 debuginfo__delete(dinfo); 636 debuginfo__delete(dinfo);
@@ -772,9 +778,8 @@ int show_available_vars(struct perf_probe_event *pevs, int npevs,
772 if (ret < 0) 778 if (ret < 0)
773 return ret; 779 return ret;
774 780
775 dinfo = open_debuginfo(module); 781 dinfo = open_debuginfo(module, false);
776 if (!dinfo) { 782 if (!dinfo) {
777 pr_warning("Failed to open debuginfo file.\n");
778 ret = -ENOENT; 783 ret = -ENOENT;
779 goto out; 784 goto out;
780 } 785 }