[PATCH bpf-next 0/3] bpf: btf: json print btf info with bpftool map dump

From: Okash Khawaja
Date: Wed Jun 20 2018 - 16:39:58 EST


Hi,

These patches augment the bpftool's map dump command with BTF info. In
particular, when user runs `bpftool map dump [-j|-p] id <map-id>`, they will
see map data formatted and tagged based upon BTF information associated with
that map. Here is what each patch does:

Patch 1 exports BTF functions inside libbpf, to be used by patch 2.

Patch 2 adds btf_dumper which uses type info exported in patch 1 along
with json_writer to json print or pretty json print map values alongside
btf debug info.

Patch 3 uses btf_dumper to json or pretty print map values when -j or -p
flag is specified to `btf map dump`.

Further details are included in patch descriptions.

Thanks,
Okash