From: "Frank Ch. Eigler" <fche@redhat.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: ahmadkhorrami <ahmadkhorrami@ut.ac.ir>,
Milian Wolff <milian.wolff@kdab.com>,
Steven Rostedt <rostedt@goodmis.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Linux-trace Users <linux-trace-users@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
linux-trace-users-owner@vger.kernel.org,
Jin Yao <yao.jin@linux.intel.com>,
Namhyung Kim <namhyung@kernel.org>,
Andi Kleen <ak@linux.intel.com>
Subject: Re: debuginfod-based dwarf downloading, was Re: Wrong Perf Backtraces
Date: Tue, 31 Mar 2020 10:00:39 -0400 [thread overview]
Message-ID: <20200331140039.GA10415@redhat.com> (raw)
In-Reply-To: <20200331092646.GA2518490@krava>
Hi -
> I think it's a good base, thanks a lot!
> I made few comments before reading above,
> feel free to post v2, if not we'll take over ;-)
Thanks, see below.
I tried to move the libdebuginfod feature test out of
FEATURE_TEST_BASIC but couldn't get it going elsewhere
in perf/Makefile.config, so it's back here for v2:
Author: Frank Ch. Eigler <fche@redhat.com>
Date: Mon Mar 30 16:15:47 2020 -0400
perf build-ids: fall back to debuginfod query if debuginfo not found
During a perf-record, use the -ldebuginfod API to query a debuginfod
server, should the debug data not be found in the usual system
locations. If successful, the usual $HOME/.debug dir is populated.
v2: use #ifdef HAVE_DEBUGINFOD_SUPPORT guards
include feature test source file
Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index 574c2e0b9d20..51e051858d21 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -48,6 +48,7 @@ FEATURE_TESTS_BASIC := \
libelf-gelf_getnote \
libelf-getshdrstrndx \
libelf-mmap \
+ libdebuginfod \
libnuma \
numa_num_possible_cpus \
libperl \
@@ -114,6 +115,7 @@ FEATURE_DISPLAY ?= \
libbfd \
libcap \
libelf \
+ libdebuginfod \
libnuma \
numa_num_possible_cpus \
libperl \
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 7ac0d8088565..1109f5ec96f7 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -26,6 +26,7 @@ FILES= \
test-libelf-gelf_getnote.bin \
test-libelf-getshdrstrndx.bin \
test-libelf-mmap.bin \
+ test-libdebuginfod.bin \
test-libnuma.bin \
test-numa_num_possible_cpus.bin \
test-libperl.bin \
@@ -155,6 +156,9 @@ endif
$(OUTPUT)test-libelf-getshdrstrndx.bin:
$(BUILD) -lelf
+$(OUTPUT)test-libdebuginfod.bin:
+ $(BUILD) -ldebuginfod
+
$(OUTPUT)test-libnuma.bin:
$(BUILD) -lnuma
diff --git a/tools/build/feature/test-libdebuginfod.c b/tools/build/feature/test-libdebuginfod.c
new file mode 100644
index 000000000000..0d20b06b4b4f
--- /dev/null
+++ b/tools/build/feature/test-libdebuginfod.c
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <elfutils/debuginfod.h>
+
+int main(void)
+{
+ debuginfod_client* c = debuginfod_begin();
+ return (long)c;
+}
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 80e55e796be9..15eeecf4ff17 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -467,6 +467,11 @@ ifndef NO_LIBELF
CFLAGS += -DHAVE_ELF_GETSHDRSTRNDX_SUPPORT
endif
+ ifeq ($(feature-libdebuginfod), 1)
+ CFLAGS += -DHAVE_DEBUGINFOD_SUPPORT
+ EXTLIBS += -ldebuginfod
+ endif
+
ifndef NO_DWARF
ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
msg := $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled);
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index c076fc7fe025..31207b6e2066 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -31,6 +31,10 @@
#include "probe-file.h"
#include "strlist.h"
+#ifdef HAVE_DEBUGINFOD_SUPPORT
+#include <elfutils/debuginfod.h>
+#endif
+
#include <linux/ctype.h>
#include <linux/zalloc.h>
@@ -636,6 +640,21 @@ static char *build_id_cache__find_debug(const char *sbuild_id,
if (realname && access(realname, R_OK))
zfree(&realname);
nsinfo__mountns_exit(&nsc);
+
+#ifdef HAVE_DEBUGINFOD_SUPPORT
+ if (realname == NULL) {
+ debuginfod_client* c = debuginfod_begin();
+ if (c != NULL) {
+ int fd = debuginfod_find_debuginfo(c,
+ (const unsigned char*)sbuild_id, 0,
+ &realname);
+ if (fd >= 0)
+ close(fd); /* retaining reference by realname */
+ debuginfod_end(c);
+ }
+ }
+#endif
+
out:
free(debugfile);
return realname;
next prev parent reply other threads:[~2020-03-31 14:00 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <157597d74ff17f781d9de7e7e3defd13@ut.ac.ir>
2020-03-22 20:24 ` Wrong Perf Backtraces ahmadkhorrami
2020-03-23 0:34 ` Steven Rostedt
[not found] ` <21b3df4080709f193d62b159887e2a83@ut.ac.ir>
2020-03-23 8:49 ` Jiri Olsa
2020-03-23 10:03 ` ahmadkhorrami
2020-03-25 15:18 ` ahmadkhorrami
2020-03-25 15:46 ` Jiri Olsa
2020-03-25 18:54 ` ahmadkhorrami
2020-03-25 18:58 ` Arnaldo Carvalho de Melo
2020-03-25 19:10 ` ahmadkhorrami
2020-03-25 19:28 ` Arnaldo Carvalho de Melo
2020-03-25 20:01 ` ahmadkhorrami
2020-03-25 20:39 ` Jiri Olsa
2020-03-25 21:02 ` Jiri Olsa
2020-03-25 21:09 ` Steven Rostedt
2020-03-25 21:37 ` ahmadkhorrami
2020-03-25 21:46 ` Jiri Olsa
2020-03-25 22:21 ` ahmadkhorrami
2020-03-25 23:09 ` ahmadkhorrami
2020-03-26 9:59 ` Jiri Olsa
2020-03-26 13:20 ` ahmadkhorrami
2020-03-26 15:39 ` Jiri Olsa
2020-03-26 18:19 ` ahmadkhorrami
2020-03-26 18:21 ` ahmadkhorrami
2020-03-27 9:20 ` Jiri Olsa
2020-03-27 10:59 ` ahmadkhorrami
2020-03-27 11:04 ` ahmadkhorrami
2020-03-27 12:10 ` Milian Wolff
2020-03-27 12:58 ` ahmadkhorrami
2020-03-27 13:25 ` Milian Wolff
2020-03-27 13:33 ` ahmadkhorrami
2020-03-27 18:43 ` ahmadkhorrami
2020-03-27 22:37 ` Jiri Olsa
2020-03-27 23:12 ` ahmadkhorrami
2020-03-28 23:34 ` Jiri Olsa
2020-03-29 0:43 ` ahmadkhorrami
2020-03-29 1:16 ` ahmadkhorrami
2020-03-29 11:19 ` Jiri Olsa
2020-03-29 11:52 ` ahmadkhorrami
2020-03-29 12:08 ` Jiri Olsa
2020-03-29 12:39 ` ahmadkhorrami
2020-03-29 13:50 ` Milian Wolff
2020-03-29 14:23 ` ahmadkhorrami
2020-03-29 19:20 ` Jiri Olsa
2020-03-30 6:09 ` Milian Wolff
2020-03-30 13:07 ` Jiri Olsa
2020-03-30 13:49 ` ahmadkhorrami
2020-03-30 19:05 ` ahmadkhorrami
2020-03-30 21:05 ` debuginfod-based dwarf downloading, was " Frank Ch. Eigler
2020-03-31 9:26 ` Jiri Olsa
2020-03-31 14:00 ` Frank Ch. Eigler [this message]
2020-03-31 4:43 ` ahmadkhorrami
2020-03-31 9:30 ` Jiri Olsa
2020-03-31 11:53 ` ahmadkhorrami
2020-03-31 12:43 ` ahmadkhorrami
2020-03-31 13:20 ` Jiri Olsa
2020-03-31 13:39 ` ahmadkhorrami
2020-03-31 14:44 ` Milian Wolff
2020-03-31 15:02 ` ahmadkhorrami
2020-03-31 15:05 ` ahmadkhorrami
2020-03-31 15:29 ` Milian Wolff
2020-03-31 16:10 ` Arnaldo Carvalho de Melo
2020-03-31 19:20 ` ahmadkhorrami
2020-03-31 19:17 ` ahmadkhorrami
2020-03-31 20:57 ` ahmadkhorrami
2020-04-04 1:01 ` ahmadkhorrami
2020-04-11 16:42 ` ahmadkhorrami
2020-04-11 21:04 ` ahmadkhorrami
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200331140039.GA10415@redhat.com \
--to=fche@redhat.com \
--cc=acme@redhat.com \
--cc=ahmadkhorrami@ut.ac.ir \
--cc=ak@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=linux-trace-users-owner@vger.kernel.org \
--cc=linux-trace-users@vger.kernel.org \
--cc=milian.wolff@kdab.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=yao.jin@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.