Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754719AbbEOGov (ORCPT ); Fri, 15 May 2015 02:44:51 -0400 Received: from terminus.zytor.com ([198.137.202.10]:58188 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753869AbbEOGor (ORCPT ); Fri, 15 May 2015 02:44:47 -0400 Date: Thu, 14 May 2015 23:44:29 -0700 From: tip-bot for He Kuang Message-ID: Cc: hekuang@huawei.com, tglx@linutronix.de, jolsa@kernel.org, wangnan0@huawei.com, hpa@zytor.com, masami.hiramatsu.pt@hitachi.com, mingo@kernel.org, acme@redhat.com, a.p.zijlstra@chello.nl, linux-kernel@vger.kernel.org Reply-To: linux-kernel@vger.kernel.org, acme@redhat.com, a.p.zijlstra@chello.nl, mingo@kernel.org, masami.hiramatsu.pt@hitachi.com, hpa@zytor.com, tglx@linutronix.de, jolsa@kernel.org, wangnan0@huawei.com, hekuang@huawei.com In-Reply-To: <1431336304-16863-3-git-send-email-hekuang@huawei.com> References: <1431336304-16863-3-git-send-email-hekuang@huawei.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf probe: Show better error message when failed to find variable Git-Commit-ID: 7d5eaba9b33682b734e3a79c21c4a9a5f91624b1 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2789 Lines: 65 Commit-ID: 7d5eaba9b33682b734e3a79c21c4a9a5f91624b1 Gitweb: http://git.kernel.org/tip/7d5eaba9b33682b734e3a79c21c4a9a5f91624b1 Author: He Kuang AuthorDate: Mon, 11 May 2015 09:25:04 +0000 Committer: Arnaldo Carvalho de Melo CommitDate: Tue, 12 May 2015 09:59:50 -0300 perf probe: Show better error message when failed to find variable Indicate to check variable location range in error message when we got failed to find the variable. Before this patch: $ perf probe --add 'generic_perform_write+118 bytes' Failed to find the location of bytes at this address. Perhaps, it has been optimized out. Error: Failed to add events. After this patch: $ perf probe --add 'generic_perform_write+118 bytes' Failed to find the location of the 'bytes' variable at this address. Perhaps it has been optimized out. Use -V with the --range option to show 'bytes' location range. Error: Failed to add events. Signed-off-by: He Kuang Acked-by: Masami Hiramatsu Cc: Jiri Olsa Cc: Peter Zijlstra Cc: Wang Nan Link: http://lkml.kernel.org/r/1431336304-16863-3-git-send-email-hekuang@huawei.com [ Improve the error message based on lkml thread ] Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/probe-finder.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 5804086..590a24a 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -527,10 +527,12 @@ static int convert_variable(Dwarf_Die *vr_die, struct probe_finder *pf) ret = convert_variable_location(vr_die, pf->addr, pf->fb_ops, &pf->sp_die, pf->tvar); - if (ret == -ENOENT || ret == -EINVAL) - pr_err("Failed to find the location of %s at this address.\n" - " Perhaps, it has been optimized out.\n", pf->pvar->var); - else if (ret == -ENOTSUP) + if (ret == -ENOENT || ret == -EINVAL) { + pr_err("Failed to find the location of the '%s' variable at this address.\n" + " Perhaps it has been optimized out.\n" + " Use -V with the --range option to show '%s' location range.\n", + pf->pvar->var, pf->pvar->var); + } else if (ret == -ENOTSUP) pr_err("Sorry, we don't support this variable location yet.\n"); else if (ret == 0 && pf->pvar->field) { ret = convert_variable_fields(vr_die, pf->pvar->var, -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/