tools: bpftool: generate .dot graph from CFG information
authorJiong Wang <jiong.wang@netronome.com>
Fri, 2 Mar 2018 02:01:21 +0000 (18:01 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 2 Mar 2018 02:29:49 +0000 (18:29 -0800)
commitefcef17a6d6575dacca22bce69e139354c5a2170
tree2305cd907b66788820d35647f7ef39392550319a
parent6e9eb7e3f8705e5e3f1a6a2b47450ec606ab012b
tools: bpftool: generate .dot graph from CFG information

This patch let bpftool print .dot graph file into stdout.

This graph is generated by the following steps:

  - iterate through the function list.
  - generate basic-block(BB) definition for each BB in the function.
  - draw out edges to connect BBs.

This patch is the initial support, the layout and decoration of the .dot
graph could be improved.

Also, it will be useful if we could visualize some performance data from
static analysis.

Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/bpf/bpftool/cfg.c
tools/bpf/bpftool/xlated_dumper.c
tools/bpf/bpftool/xlated_dumper.h