From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753522AbdK1AYR (ORCPT ); Mon, 27 Nov 2017 19:24:17 -0500 Received: from mga02.intel.com ([134.134.136.20]:6481 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753331AbdK1AXe (ORCPT ); Mon, 27 Nov 2017 19:23:34 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,466,1505804400"; d="scan'208";a="12682729" From: Andi Kleen To: acme@kernel.org Cc: jolsa@kernel.org, mhiramat@kernel.org, adrian.hunter@intel.com, linux-kernel@vger.kernel.org, Andi Kleen Subject: [PATCH 11/12] perf, tools: Print probe warnings for binaries only once per binary Date: Mon, 27 Nov 2017 16:23:20 -0800 Message-Id: <20171128002321.2878-12-andi@firstfloor.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171128002321.2878-1-andi@firstfloor.org> References: <20171128002321.2878-1-andi@firstfloor.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andi Kleen When the perf probe code is called from perf script we may end up with a flood of bad binary errors with -v. Only print the error message once in this case. Signed-off-by: Andi Kleen --- tools/perf/util/probe-event.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index fb5031ac24a2..85fbeeb364bf 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -492,12 +492,16 @@ static struct debuginfo *open_debuginfo(const char *module, struct nsinfo *nsi, nsinfo__mountns_enter(nsi, &nsc); ret = debuginfo__new(path); if (!ret && (!silent || verbose)) { - pr_warning("The %s file has no debug information.\n", path); - if (!module || !strtailcmp(path, ".ko")) - pr_warning("Rebuild with CONFIG_DEBUG_INFO=y, "); - else - pr_warning("Rebuild with -g, "); - pr_warning("or install an appropriate debuginfo package.\n"); + static char printed[1024]; + if (strcmp(path, printed)) { + snprintf(printed, sizeof printed, "%s", path); + pr_warning("The %s file has no debug information.\n", path); + if (!module || !strtailcmp(path, ".ko")) + pr_warning("Rebuild with CONFIG_DEBUG_INFO=y, "); + else + pr_warning("Rebuild with -g, "); + pr_warning("or install an appropriate debuginfo package.\n"); + } } nsinfo__mountns_exit(&nsc); return ret; -- 2.13.6