From: Andrii Nakryiko <andriin@fb.com>
To: <andrii.nakryiko@gmail.com>, <netdev@vger.kernel.org>,
<bpf@vger.kernel.org>
Subject: [PATCH v4 bpf-next 0/4] add btf dumping to bpftool
Date: Thu, 25 Apr 2019 15:30:07 -0700 [thread overview]
Message-ID: <20190425223011.284686-1-andriin@fb.com> (raw)
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)
Andrii Nakryiko (4):
bpftool: add ability to dump BTF types
bpftool/docs: add btf sub-command documentation
bpftool: add bash completions for btf command
bpftool: fix indendation in bash-completion/bpftool
.../bpf/bpftool/Documentation/bpftool-btf.rst | 222 +++++++
.../bpftool/Documentation/bpftool-cgroup.rst | 3 +-
.../bpftool/Documentation/bpftool-feature.rst | 3 +-
.../bpf/bpftool/Documentation/bpftool-map.rst | 3 +-
.../bpf/bpftool/Documentation/bpftool-net.rst | 3 +-
.../bpftool/Documentation/bpftool-perf.rst | 3 +-
.../bpftool/Documentation/bpftool-prog.rst | 3 +-
tools/bpf/bpftool/Documentation/bpftool.rst | 3 +-
tools/bpf/bpftool/bash-completion/bpftool | 68 +-
tools/bpf/bpftool/btf.c | 586 ++++++++++++++++++
tools/bpf/bpftool/main.c | 3 +-
tools/bpf/bpftool/main.h | 1 +
12 files changed, 882 insertions(+), 19 deletions(-)
create mode 100644 tools/bpf/bpftool/Documentation/bpftool-btf.rst
create mode 100644 tools/bpf/bpftool/btf.c
--
2.17.1
next reply other threads:[~2019-04-25 22:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-25 22:30 Andrii Nakryiko [this message]
2019-04-25 22:30 ` [PATCH v4 bpf-next 1/4] bpftool: add ability to dump BTF types Andrii Nakryiko
2019-04-25 22:30 ` [PATCH v4 bpf-next 2/4] bpftool/docs: add btf sub-command documentation Andrii Nakryiko
2019-04-25 22:30 ` [PATCH v4 bpf-next 3/4] bpftool: add bash completions for btf command Andrii Nakryiko
2019-04-25 22:30 ` [PATCH v4 bpf-next 4/4] bpftool: fix indendation in bash-completion/bpftool Andrii Nakryiko
2019-04-26 4:48 ` [PATCH v4 bpf-next 0/4] add btf dumping to bpftool Alexei Starovoitov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190425223011.284686-1-andriin@fb.com \
--to=andriin@fb.com \
--cc=andrii.nakryiko@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox