Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753084AbbEKJ0B (ORCPT ); Mon, 11 May 2015 05:26:01 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:52649 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752464AbbEKJZ5 (ORCPT ); Mon, 11 May 2015 05:25:57 -0400 From: He Kuang To: , , , , CC: , Subject: [PATCH v3 3/3] perf probe: Show better error message when failed to find variable Date: Mon, 11 May 2015 09:25:04 +0000 Message-ID: <1431336304-16863-3-git-send-email-hekuang@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1431336304-16863-1-git-send-email-hekuang@huawei.com> References: <1431336304-16863-1-git-send-email-hekuang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.107.197.210] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1795 Lines: 46 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 bytes at this address. Perhaps, it has been optimized out. Use -V with --range option to show variable location range. Error: Failed to add events. Signed-off-by: He Kuang Acked-by: Masami Hiramatsu --- tools/perf/util/probe-finder.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index f032329..8510cde 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -529,7 +529,9 @@ static int convert_variable(Dwarf_Die *vr_die, struct probe_finder *pf) &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); + " Perhaps, it has been optimized out.\n" + " Use -V with --range option to show variable location range.\n", + 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) { -- 1.8.5.2 -- 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/