All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libbpf: Add friendly error prompt for missing .BTF section
@ 2022-09-26  5:53 Tianyi Liu
  2022-09-27  4:36 ` Andrii Nakryiko
  0 siblings, 1 reply; 5+ messages in thread
From: Tianyi Liu @ 2022-09-26  5:53 UTC (permalink / raw)
  To: andrii; +Cc: bpf, trivial, Tianyi Liu

Fresh users usually forget to turn on BTF generating flags compiling
kernels, and will receive a confusing error "No such file or directory"
(from return value ENOENT) with command "bpftool btf dump file vmlinux".

Hope this can help them find the mistake.

Signed-off-by: Tianyi Liu <i.pear@outlook.com>
---
 tools/lib/bpf/btf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
index 2d14f1a52..9fbae1f3d 100644
--- a/tools/lib/bpf/btf.c
+++ b/tools/lib/bpf/btf.c
@@ -990,6 +990,8 @@ static struct btf *btf_parse_elf(const char *path, struct btf *base_btf,
 	err = 0;
 
 	if (!btf_data) {
+		pr_warn("Failed to get section %s from ELF %s, check CONFIG_DEBUG_INFO_BTF if compiling kernel\n",
+			BTF_ELF_SEC, path);
 		err = -ENOENT;
 		goto done;
 	}
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-09-30 22:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-26  5:53 [PATCH] libbpf: Add friendly error prompt for missing .BTF section Tianyi Liu
2022-09-27  4:36 ` Andrii Nakryiko
2022-09-28 11:23   ` Tianyi Liu
2022-09-30  1:58     ` John Fastabend
2022-09-30 22:06       ` Andrii Nakryiko

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.