On Wed, Aug 13, 2025 at 2:29 PM Eduard Zingerman <eddyz87@xxxxxxxxx> wrote: > > On Mon, 2025-08-11 at 22:20 +0100, Mykyta Yatsenko wrote: > > From: Mykyta Yatsenko <yatsenko@xxxxxxxx> > > > > This patch adds support for dumping BPF program instructions directly > > from veristat. > > While it is already possible to inspect BPF program dump using bpftool, > > it requires multiple commands. During active development, it's common > > for developers to use veristat for testing verification. Integrating > > instruction dumping into veristat reduces the need to switch tools and > > simplifies the workflow. > > By making this information more readily accessible, this change aims > > to streamline the BPF development cycle and improve usability for > > developers. > > > > Signed-off-by: Mykyta Yatsenko <yatsenko@xxxxxxxx> > > --- > > I have a feature request for this: > generate local labels for branch and call targets. > E.g. as in the tools/testing/selftests/bpf/jit_disasm_helpers.c. > Or as in llvm-objdump -d --symbolize-operands. should we teach bpftool that? > > That aside, it looks like the code is very similar to bpftool's > xlated_dumper.c. Is there a way to share the code? > There would be now three places where xlated program is printed: > - bpftool > - veristat > - selftests (this one does not handle ksyms, but it would be nice if it could) I was going to ask the question if veristat should just delegate all this functionality to bpftool using popen() (it's very likely you'll have bpftool installed if you have veristat), but I guess if we can share more code between bpftool and veristat, it's fine as well. As it stands right now, it does seem like a lot of duplication and we'll just have to maintain two copies of the same logic, which isn't great. > Should we add something like this to libbpf itself? I'd rather not, doesn't seem like it's that essential to be part of libbpf... [...]