Skip to contentSkip to conversation

Add CONFIG_DEBUG_INFO_BTF check to bpftool feature command

PATCH Superseded grantseltzer 2 participants 2 messages Feb 21, 2021 – Feb 22, 2021

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Add CONFIG_DEBUG_INFO_BTF check to bpftool feature command

This adds the CONFIG_DEBUG_INFO_BTF kernel compile option to output of the bpftool feature command. This is relevant for developers that want to use libbpf to account for data structure definition differences between kernels.

---
 tools/bpf/bpftool/feature.c | 2 ++
 1 file changed, 2 insertions(+)
tools/bpf/bpftool/feature.c +2 -0
index 359960a8f..34343e7fa 100644
@@ -336,6 +336,8 @@ static void probe_kernel_image_config(const char *define_prefix)
 		{ "CONFIG_BPF_JIT", },
 		/* Avoid compiling eBPF interpreter (use JIT only) */
 		{ "CONFIG_BPF_JIT_ALWAYS_ON", },
+		/* Enable using BTF debug information */
+		{ "CONFIG_DEBUG_INFO_BTF", },
 
 		/* cgroups */
 		{ "CONFIG_CGROUPS", },
Signature · 1 line
2.29.2
#1 lore raw

2021-02-20 05:13 UTC+0000 ~ grantseltzer <[email protected]>

Quoted 15 lines

This adds the CONFIG_DEBUG_INFO_BTF kernel compile option to output of the bpftool feature command. This is relevant for developers that want to use libbpf to account for data structure definition differences between kernels.

---
 tools/bpf/bpftool/feature.c | 2 ++
 1 file changed, 2 insertions(+)
tools/bpf/bpftool/feature.c +0 -0
index 359960a8f..34343e7fa 100644

tools/bpf/bpftool/feature.c static void probe_kernel_image_config(const char *define_prefix) · line 340

Quoted 5 lines
tools/bpf/bpftool/feature.c +2 -0
@@ -336,6 +336,8 @@ static void probe_kernel_image_config(const char *define_prefix)
 		{ "CONFIG_BPF_JIT", },
 		/* Avoid compiling eBPF interpreter (use JIT only) */
 		{ "CONFIG_BPF_JIT_ALWAYS_ON", },
+		/* Enable using BTF debug information */
+		{ "CONFIG_DEBUG_INFO_BTF", },

Nit: The comment is slightly misleading, you can use BTF to list program C instructions or map structures without this option for example. Maybe something like this?

	/* Kernel BTF debug information available */

Thanks for the patch!
Quentin