Added code to convert the basic blocks obtained from the gcc AST json to a networkx digraph. Nodes are represented by a data class BBNode which currently has one member variable index. Edges are built into the graph following the edges field of the basic block json, and each edge in the digraph contains an EdgeData object which includes the edges gcc flags and human readable type obtained from the flags. The main functionality is provided by the function basic_blocks_to_digraph() which takes a list of basic blocks e.g. the basic blocks of a function and returns the digraph representing the flow of control between these basic blocks.
Added gcc_basic_blocks_to_digraph.py which adds a namedtuple BBNode to store node data in the digraph, and a namedtuple EdgeData to store relevant data from the json for each node
Added GccEdgeFlagIntFlag enum to facilitate understanding the gcc flags from the json
This script can also be executed. If so, one should provide the path to the gcc AST json. When run, the script creates the networkx digraphs for each function in the AST and generates pdfs for them. Furthermore, it prints out the collective edge data for each digraph.
Added code to convert the basic blocks obtained from the gcc AST json to a networkx digraph. Nodes are represented by a data class
BBNode
which currently has one member variableindex
. Edges are built into the graph following theedges
field of the basic block json, and each edge in the digraph contains anEdgeData
object which includes the edges gcc flags and human readable type obtained from the flags. The main functionality is provided by the functionbasic_blocks_to_digraph()
which takes a list of basic blocks e.g. the basic blocks of a function and returns the digraph representing the flow of control between these basic blocks.gcc_basic_blocks_to_digraph.py
which adds a namedtupleBBNode
to store node data in the digraph, and a namedtupleEdgeData
to store relevant data from the json for each nodeGccEdgeFlag
IntFlag
enum to facilitate understanding the gcc flags from the json