OSDN Git Service

bpf: btf: Add BTF_KIND_FUNC and BTF_KIND_FUNC_PROTO
authorMartin KaFai Lau <kafai@fb.com>
Mon, 19 Nov 2018 23:29:08 +0000 (15:29 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 20 Nov 2018 18:54:38 +0000 (10:54 -0800)
commit2667a2626f4da370409c2830552f6e8c8b8c41e2
treec6eba2292a81ead78b2c48075c8f7eb75588a172
parentb47a0bd23e34022aa0d4b812fcebe85cb0c54d49
bpf: btf: Add BTF_KIND_FUNC and BTF_KIND_FUNC_PROTO

This patch adds BTF_KIND_FUNC and BTF_KIND_FUNC_PROTO
to support the function debug info.

BTF_KIND_FUNC_PROTO must not have a name (i.e. !t->name_off)
and it is followed by >= 0 'struct bpf_param' objects to
describe the function arguments.

The BTF_KIND_FUNC must have a valid name and it must
refer back to a BTF_KIND_FUNC_PROTO.

The above is the conclusion after the discussion between
Edward Cree, Alexei, Daniel, Yonghong and Martin.

By combining BTF_KIND_FUNC and BTF_LIND_FUNC_PROTO,
a complete function signature can be obtained.  It will be
used in the later patches to learn the function signature of
a running bpf program.

Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/uapi/linux/btf.h
kernel/bpf/btf.c