lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1431349804-31849-3-git-send-email-hekuang@huawei.com>
Date:	Mon, 11 May 2015 13:10:04 +0000
From:	He Kuang <hekuang@...wei.com>
To:	<masami.hiramatsu.pt@...achi.com>, <a.p.zijlstra@...llo.nl>,
	<acme@...nel.org>, <jolsa@...nel.org>, <mingo@...hat.com>
CC:	<wangnan0@...wei.com>, <linux-kernel@...r.kernel.org>
Subject: [PATCH v4 3/3] 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, and put user-supplied variable name in
quotes.

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 --range option to show variable location range.
    Error: Failed to add events.

Signed-off-by: He Kuang <hekuang@...wei.com>
---
 tools/perf/util/probe-finder.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index f032329..0fc2ae8 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -528,8 +528,10 @@ 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);
+		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 --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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ