Converts a level 2 BPF verifier log into an annotated control flow graph (CFG) and outputs it in DOT format. BPF instructions and corresponding C lines are grouped into basic blocks, with each instruction annotated by the number of times the verifier has visited it.
- More intense basic block colors indicate more frequent visits.
- Blue edges represent true branches in conditionals.
- Bold edges indicate back-edges.
log2dot [-h] [-o dot_file] [log_file]
log_file
: A verifier log produced withBPF_LOG_LEVEL2
. If omitted, input is read fromstdin
.dot_file
: The output file name. If omitted, output is written tostdout
.
- The
pydot
package is required to generate the graph. It can be installed via:or using a distribution package manager, e.g.:pip3 install pydot
dnf install python3-pydot # Fedora
$ veristat -vl2 -f iter_nested_deeply_iters iters.bpf.o > test.log
$ log2dot.py test.log | xdot -
Here, xdot
is used for interactive visualization of the generated DOT file.