First commit adds the Subroutine class which is used to represent subroutines in the contract.
Second commit adds support to generate shortened CFG for subroutines.
In full CFG, subgraph containing the subroutine is added after each callsub instruction. This makes it hard to follow through the CFG for large contracts.
In the shortened version of CFG, Instead of the entire subroutine's subgraph, a small box containing Subroutine {name} is added after the callsub instruction.
Users can generate shortened CFG's using subroutine-cfg. This printer creates a dot file for the main contract and for each one of the subroutines defined in the contract.
TBD: Shortened CFG's are not generated by default (when --print-cfg option is used). A help message is displayed instead of that. Have to determine if we want to generate them by default or not.
tealer test.teal --print-cfg
Analyzing test.teal
CFG exported to file: test_full_cfg.dot
Note: Use `subroutine-cfg` printer to generate CFG of subroutines and shortened version of contract CFG
First commit adds the Subroutine class which is used to represent subroutines in the contract. Second commit adds support to generate shortened CFG for subroutines.
In full CFG, subgraph containing the subroutine is added after each callsub instruction. This makes it hard to follow through the CFG for large contracts. In the shortened version of CFG, Instead of the entire subroutine's subgraph, a small box containing
Subroutine {name}
is added after the callsub instruction.Users can generate shortened CFG's using
subroutine-cfg
. This printer creates a dot file for the main contract and for each one of the subroutines defined in the contract. TBD: Shortened CFG's are not generated by default (when--print-cfg
option is used). A help message is displayed instead of that. Have to determine if we want to generate them by default or not.Example
Full CFG
Shortened CFG
Subroutine CFG (recursive)