diff options
author | Andrii Nakryiko <andrii@kernel.org> | 2020-11-05 07:34:01 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-11-06 05:37:31 +0300 |
commit | 75fa1777694c245c1e59ac774cb1d58a15ecefeb (patch) | |
tree | e963ce371e93ab69cf3d88277a18cbe504d31e59 /tools/bpf/bpftool/btf.c | |
parent | 232338fa2fb47726ab7c459419115a6ab6bfb3e3 (diff) | |
download | linux-75fa1777694c245c1e59ac774cb1d58a15ecefeb.tar.xz |
tools/bpftool: Add bpftool support for split BTF
Add ability to work with split BTF by providing extra -B flag, which allows to
specify the path to the base BTF file.
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20201105043402.2530976-12-andrii@kernel.org
Diffstat (limited to 'tools/bpf/bpftool/btf.c')
-rw-r--r-- | tools/bpf/bpftool/btf.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/bpf/bpftool/btf.c b/tools/bpf/bpftool/btf.c index 8ab142ff5eac..c96b56e8e3a4 100644 --- a/tools/bpf/bpftool/btf.c +++ b/tools/bpf/bpftool/btf.c @@ -358,8 +358,12 @@ static int dump_btf_raw(const struct btf *btf, } } else { int cnt = btf__get_nr_types(btf); + int start_id = 1; - for (i = 1; i <= cnt; i++) { + if (base_btf) + start_id = btf__get_nr_types(base_btf) + 1; + + for (i = start_id; i <= cnt; i++) { t = btf__type_by_id(btf, i); dump_btf_type(btf, i, t); } @@ -438,7 +442,6 @@ static int do_dump(int argc, char **argv) return -1; } src = GET_ARG(); - if (is_prefix(src, "map")) { struct bpf_map_info info = {}; __u32 len = sizeof(info); @@ -499,7 +502,7 @@ static int do_dump(int argc, char **argv) } NEXT_ARG(); } else if (is_prefix(src, "file")) { - btf = btf__parse(*argv, NULL); + btf = btf__parse_split(*argv, base_btf); if (IS_ERR(btf)) { err = -PTR_ERR(btf); btf = NULL; |