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-next>] [day] [month] [year] [list]
Message-Id: <1515668586-14327-1-git-send-email-yao.jin@linux.intel.com>
Date:   Thu, 11 Jan 2018 19:03:06 +0800
From:   Jin Yao <yao.jin@...ux.intel.com>
To:     acme@...nel.org, jolsa@...nel.org, peterz@...radead.org,
        mingo@...hat.com, alexander.shishkin@...ux.intel.com
Cc:     Linux-kernel@...r.kernel.org, ak@...ux.intel.com,
        kan.liang@...el.com, yao.jin@...el.com,
        Jin Yao <yao.jin@...ux.intel.com>
Subject: [PATCH] perf util: Display warning when perf report/annotate is missing some libs

We keep having bug reports that when users build perf on their own,
but they don't install some needed libraries like libelf, libbfd/libibery.

The perf can build, but it is missing important functionality.

For example, perf report doesn't display any symbols and perf annotate
doesn't work.

This patch displays warnings that these libraries are missing in build
when perf report / perf annotate are used.

Signed-off-by: Jin Yao <yao.jin@...ux.intel.com>
---
 tools/perf/builtin-annotate.c |  2 ++
 tools/perf/builtin-report.c   |  2 ++
 tools/perf/util/symbol.c      | 21 +++++++++++++++++++++
 tools/perf/util/symbol.h      |  2 ++
 4 files changed, 27 insertions(+)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index f15731a..609eb7a 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -511,6 +511,8 @@ int cmd_annotate(int argc, const char **argv)
 
 	setup_browser(true);
 
+	build_lib_warning();
+
 	ret = __cmd_annotate(&annotate);
 
 out_delete:
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index dd4df9a..550adb7 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -1293,6 +1293,8 @@ int cmd_report(int argc, const char **argv)
 		}
 	}
 
+	build_lib_warning();
+
 	if (symbol__init(&session->header.env) < 0)
 		goto error;
 
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index cc065d4..4205ba8 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -2224,3 +2224,24 @@ int symbol__config_symfs(const struct option *opt __maybe_unused,
 	free(bf);
 	return 0;
 }
+
+void build_lib_warning(void)
+{
+#ifndef HAVE_LIBELF_SUPPORT
+	pr_warning("Symbols are disabled!\n"
+		   "Please install libelf-dev, libelf-devel "
+		   "or elfutils-libelf-devel before building perf.\n");
+#endif
+
+#ifndef HAVE_DWARF_SUPPORT
+	pr_warning("Unwind support is disabled!\n"
+		   "Please install elfutils-devel/libdw-dev "
+		   "before building perf.\n");
+#endif
+
+#ifndef HAVE_LIBBFD_SUPPORT
+	pr_warning("C++ demangling and line numbers are disabled!\n"
+		   "Please install binutils-dev[el]/"
+		   "libiberty-dev before building perf.\n");
+#endif
+}
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 0563f33..d88e046 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -383,6 +383,8 @@ int get_sdt_note_list(struct list_head *head, const char *target);
 int cleanup_sdt_note_list(struct list_head *sdt_notes);
 int sdt_notes__get_count(struct list_head *start);
 
+void build_lib_warning(void);
+
 #define SDT_BASE_SCN ".stapsdt.base"
 #define SDT_NOTE_SCN  ".note.stapsdt"
 #define SDT_NOTE_TYPE 3
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ