aboutsummaryrefslogtreecommitdiff
path: root/tools/lib/bpf/btf_dump.c
AgeCommit message (Collapse)AuthorFilesLines
2019-08-07libbpf: convert libbpf code to use new btf helpersAndrii Nakryiko1-92/+46
Simplify code by relying on newly added BTF helper functions. Signed-off-by: Andrii Nakryiko <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]>
2019-06-18libbpf: add common min/max macro to libbpf_internal.hAndrii Nakryiko1-3/+0
Multiple files in libbpf redefine their own definitions for min/max. Let's define them in libbpf_internal.h and use those everywhere. Signed-off-by: Andrii Nakryiko <[email protected]> Acked-by: Song Liu <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]>
2019-05-24libbpf: add btf_dump API for BTF-to-C conversionAndrii Nakryiko1-0/+1336
BTF contains enough type information to allow generating valid compilable C header w/ correct layout of structs/unions and all the typedef/enum definitions. This patch adds a new "object" - btf_dump to facilitate dumping BTF as valid C. btf_dump__dump_type() is the main API which takes care of dumping out (through user-provided printf-like callback function) C definitions for given type ID and it's required dependencies. This allows for not just dumping out entirety of BTF types, but also selective filtering based on user-provided criterias w/ minimal set of dependent types. Signed-off-by: Andrii Nakryiko <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]>