linux/tools/bpf/bpftool
Andrii Nakryiko 5b438f01d7 bpftool: Dump more info about DATASEC members
Dump succinct information for each member of DATASEC: its kinds and name. This
is extremely helpful to see at a quick glance what is inside each DATASEC of
a given BTF. Without this, one has to jump around BTF data to just find out
the name of a VAR or FUNC. DATASEC's var_secinfo member is special in that
regard because it doesn't itself contain the name of the member, delegating
that to the referenced VAR and FUNC kinds. Other kinds, like
STRUCT/UNION/FUNC/ENUM, encode member names directly and thus are clearly
identifiable in BTF dump.

The new output looks like this:

[35] DATASEC '.bss' size=0 vlen=6
        type_id=8 offset=0 size=4 (VAR 'input_bss1')
        type_id=13 offset=0 size=4 (VAR 'input_bss_weak')
        type_id=16 offset=0 size=4 (VAR 'output_bss1')
        type_id=17 offset=0 size=4 (VAR 'output_data1')
        type_id=18 offset=0 size=4 (VAR 'output_rodata1')
        type_id=20 offset=0 size=8 (VAR 'output_sink1')
[36] DATASEC '.data' size=0 vlen=2
        type_id=9 offset=0 size=4 (VAR 'input_data1')
        type_id=14 offset=0 size=4 (VAR 'input_data_weak')
[37] DATASEC '.kconfig' size=0 vlen=2
        type_id=25 offset=0 size=4 (VAR 'LINUX_KERNEL_VERSION')
        type_id=28 offset=0 size=1 (VAR 'CONFIG_BPF_SYSCALL')
[38] DATASEC '.ksyms' size=0 vlen=1
        type_id=30 offset=0 size=1 (VAR 'bpf_link_fops')
[39] DATASEC '.rodata' size=0 vlen=2
        type_id=12 offset=0 size=4 (VAR 'input_rodata1')
        type_id=15 offset=0 size=4 (VAR 'input_rodata_weak')
[40] DATASEC 'license' size=0 vlen=1
        type_id=24 offset=0 size=4 (VAR 'LICENSE')

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20210423181348.1801389-3-andrii@kernel.org
2021-04-23 14:05:26 -07:00
..
bash-completion bpftool: Add gen object command to perform BPF static linking 2021-03-18 16:14:23 -07:00
Documentation bpftool: Add gen object command to perform BPF static linking 2021-03-18 16:14:23 -07:00
skeleton
.gitignore tools/bpf: Remove bpf-helpers from bpftool docs 2021-03-04 18:39:45 -08:00
btf.c bpftool: Dump more info about DATASEC members 2021-04-23 14:05:26 -07:00
btf_dumper.c tools/bpftool: Add BTF_KIND_FLOAT support 2021-03-04 17:58:15 -08:00
cfg.c
cfg.h
cgroup.c
common.c sock_map: Introduce BPF_SK_SKB_VERDICT 2021-04-01 10:56:14 -07:00
feature.c bpf: Add kernel/modules BTF presence checks to bpftool feature command 2021-02-24 17:24:37 +01:00
gen.c bpftool: Add gen object command to perform BPF static linking 2021-03-18 16:14:23 -07:00
iter.c
jit_disasm.c
json_writer.c
json_writer.h
link.c
main.c bpftool: Fix maybe-uninitialized warnings 2021-03-16 12:26:49 -07:00
main.h
Makefile New features: 2021-02-22 13:59:43 -08:00
map.c bpftool: Fix maybe-uninitialized warnings 2021-03-16 12:26:49 -07:00
map_perf_ring.c
net.c bpftool: Fix a clang compilation warning 2021-04-15 16:50:22 -07:00
netlink_dumper.c
netlink_dumper.h
perf.c
pids.c tools/bpftool: Fix PID fetching with a lot of results 2020-12-08 16:45:20 +01:00
prog.c sock_map: Introduce BPF_SK_SKB_VERDICT 2021-04-01 10:56:14 -07:00
struct_ops.c
tracelog.c
xlated_dumper.c bpftool: Print subprog address properly 2021-02-26 13:23:53 -08:00
xlated_dumper.h