Skip to content

bpftool: Add inline annotations when dumping program CFGs

Quentin Monnet bpf linux-s390 3 versions – Applied

Status from this message: This series was applied to bpf/bpf-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest7 patches 4 repliesApplied 7/7
  2. v25 patches 7 repliesSuperseded
  3. v15 patches 5 repliesSuperseded

Changes in v3 from the cover letter

- 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()).

Patches in v3 All 7 applied

#Subject and filesSizeRepliesApplied
1/7bpftool: Fix documentation about line info display for prog dumpstools/bpf/bpftool/Documentation/bpftool-prog.rst+4 -60 repliesApplied
2/7bpftool: Fix bug for long instructions in program CFG dumpstools/bpf/bpftool/xlated_dumper.c+7 -00 repliesApplied
3/7bpftool: Support inline annotations when dumping the CFG of a programtools/bpf/bpftool/btf_dumper.c tools/bpf/bpftool/cfg.c tools/bpf/bpftool/cfg.h +3 more+88 -264 repliesApplied
4/7bpftool: Return an error on prog dumps if both CFG and JSON are requiredtools/bpf/bpftool/bash-completion/bpftool tools/bpf/bpftool/prog.c+11 -60 repliesApplied
5/7bpftool: Support "opcodes", "linum", "visual" simultaneouslytools/bpf/bpftool/Documentation/bpftool-prog.rst tools/bpf/bpftool/bash-completion/bpftool tools/bpf/bpftool/prog.c+47 -390 repliesApplied
6/7bpftool: Support printing opcodes and source file references in CFGtools/bpf/bpftool/btf_dumper.c tools/bpf/bpftool/cfg.c tools/bpf/bpftool/cfg.h +4 more+83 -150 repliesApplied
7/7bpftool: Clean up _bpftool_once_attr() calls in bash completiontools/bpf/bpftool/bash-completion/bpftool+3 -130 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

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

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(-)
Signature · 1 line
2.34.1