Merge branch 'btf-dump'
authorAlexei Starovoitov <ast@kernel.org>
Fri, 26 Apr 2019 04:45:14 +0000 (21:45 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 26 Apr 2019 04:45:15 +0000 (21:45 -0700)
commit0c0cad2c2824ac38106ad0649263eca30954beb6
tree3d13ca7dc8dd49fbd4b0e02f969daeee66d76836
parent77d764263d1165a2edf13735915fc39bc44abf1d
parent8ed1875bf3a77d1653b895e41774aec9a341a97f
Merge branch 'btf-dump'

Andrii Nakryiko says:

====================
This patch set adds a new `bpftool btf dump` sub-command, which allows to dump
BTF contents (only types for now). Currently it only outputs low-level
content, almost 1:1 with binary BTF format, but follow up patches will add
ability to dump BTF types as a compilable C header file. JSON output is
supported as well.

Patch #1 adds `btf` sub-command, dumping BTF types in human-readable format.
It also implements reading .BTF data from ELF file.
Patch #2 adds minimal documentation with output format examples and different
ways to specify source of BTF data.
Patch #3 adds support for btf command in bash-completion/bpftool script.
Patch #4 fixes minor indentation issue in bash-completion script.

Output format is mostly following existing format of BPF verifier log, but
deviates from it in few places. More details are in commit message for patch 1.

Example of output for all supported BTF kinds are in patch #2 as part of
documentation. Some field names are quite verbose and I'd rather shorten them,
if we don't feel like being very close to BPF verifier names is a necessity,
but in this patch I left them exactly the same as in verifier log.

v3->v4:
  - reverse Christmas tree (Quentin)
  - better docs (Quentin)

v2->v3:
  - make map's key|value|kv|all suggestion more precise (Quentin)
  - fix default case indentations (Quentin)

v1->v2:
  - fix unnecessary trailing whitespaces in bpftool-btf.rst (Yonghong)
  - add btf in main.c for a list of possible OBJECTs
  - handle unknown keyword under `bpftool btf dump` (Yonghong)
====================

Signed-off-by: Alexei Starovoitov <ast@kernel.org>