mbox series

[bpf-next,v3,0/7] bpftool: Add inline annotations when dumping program CFGs

Message ID 20230405132120.59886-1-quentin@isovalent.com (mailing list archive)
Headers show
Series bpftool: Add inline annotations when dumping program CFGs | expand

Message

Quentin Monnet April 5, 2023, 1:21 p.m. UTC
This set contains some improvements for bpftool's "visual" program dump
option, which produces the control flow graph in a DOT format. The main
objective is to add support for inline annotations on such graphs, so that
we can have the C source code for the program showing up alongside the
instructions, when available. The last commits also make it possible to
display the line numbers or the bare opcodes in the graph, as supported by
regular program dumps.

v3:
- Fixed formatting of DOT graph: escape spaces, and remove indent that
  would cause some unwanted spaces to show up in the resulting graph.
- Don't print line information if the record is empty.
- Add '<' and ' ' to the list of escaped characters for generting the
  DOT graph.
- Truncate long file paths, use shorter field names ("line", "col") for
  code location information in the graph, add missing separator space.
- Add a commit to return an error if JSON output and CFG are both
  required.
- Add a drive-by, clean up commit for bash completion (avoid unnecessary
  calls to _bpftool_once_attr()).

v2: Replace fputc(..., stdout) with putchar(...) in dotlabel_puts().

Quentin Monnet (7):
  bpftool: Fix documentation about line info display for prog dumps
  bpftool: Fix bug for long instructions in program CFG dumps
  bpftool: Support inline annotations when dumping the CFG of a program
  bpftool: Return an error on prog dumps if both CFG and JSON are
    required
  bpftool: Support "opcodes", "linum", "visual" simultaneously
  bpftool: Support printing opcodes and source file references in CFG
  bpftool: Clean up _bpftool_once_attr() calls in bash completion

 .../bpftool/Documentation/bpftool-prog.rst    | 18 ++--
 tools/bpf/bpftool/bash-completion/bpftool     | 42 +++++-----
 tools/bpf/bpftool/btf_dumper.c                | 83 +++++++++++++++++++
 tools/bpf/bpftool/cfg.c                       | 29 ++++---
 tools/bpf/bpftool/cfg.h                       |  5 +-
 tools/bpf/bpftool/main.h                      |  2 +
 tools/bpf/bpftool/prog.c                      | 78 ++++++++---------
 tools/bpf/bpftool/xlated_dumper.c             | 54 +++++++++++-
 tools/bpf/bpftool/xlated_dumper.h             |  3 +-
 9 files changed, 226 insertions(+), 88 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org April 6, 2023, 4:30 a.m. UTC | #1
Hello:

This series was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Wed,  5 Apr 2023 14:21:13 +0100 you wrote:
> This set contains some improvements for bpftool's "visual" program dump
> option, which produces the control flow graph in a DOT format. The main
> objective is to add support for inline annotations on such graphs, so that
> we can have the C source code for the program showing up alongside the
> instructions, when available. The last commits also make it possible to
> display the line numbers or the bare opcodes in the graph, as supported by
> regular program dumps.
> 
> [...]

Here is the summary with links:
  - [bpf-next,v3,1/7] bpftool: Fix documentation about line info display for prog dumps
    https://git.kernel.org/bpf/bpf-next/c/e27f0f1620b6
  - [bpf-next,v3,2/7] bpftool: Fix bug for long instructions in program CFG dumps
    https://git.kernel.org/bpf/bpf-next/c/67cf52cdb6c8
  - [bpf-next,v3,3/7] bpftool: Support inline annotations when dumping the CFG of a program
    https://git.kernel.org/bpf/bpf-next/c/9fd496848b1c
  - [bpf-next,v3,4/7] bpftool: Return an error on prog dumps if both CFG and JSON are required
    https://git.kernel.org/bpf/bpf-next/c/05a06be72289
  - [bpf-next,v3,5/7] bpftool: Support "opcodes", "linum", "visual" simultaneously
    https://git.kernel.org/bpf/bpf-next/c/9b79f02722bb
  - [bpf-next,v3,6/7] bpftool: Support printing opcodes and source file references in CFG
    https://git.kernel.org/bpf/bpf-next/c/7483a7a70a12
  - [bpf-next,v3,7/7] bpftool: Clean up _bpftool_once_attr() calls in bash completion
    https://git.kernel.org/bpf/bpf-next/c/7319296855f1

You are awesome, thank you!