JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.
If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.
If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.
| CodeSonar® 9.2p0 | CONFIDENTIAL | CodeSecure Inc |
CodeSonar can construct control flow graphs (CFGs). With these graphs enabled, you can navigate through a program's control flow structure as well as its dependence structure.
The sequential flow of control through the program is represented by control-flow edges (CFG_EDGE) between points (PDG_VERTEX), a structure known as a control flow graph, or CFG for short.
For example, consider the following example program and its corresponding CFG (with printf() calls collapsed to 'print' points).
/* Return a+b */ static int add(int a, int b){ return a + b; } /* Sum 0 through 10. */ void main() { int sum, i; sum = 0; i = 1; while ( i<11 ) { sum = add(sum, i); i = add(i, 1); } printf("sum = %d\n", sum); printf("i = %d\n", i); } |
|
Each function is associated with an intraprocedural CFG that models control flow between points strictly within the function based on the assumption that all function calls are atomic operations.
The inter-procedural CFG is a single graph that models the control flow between points in the entire project.
Edges in the CFG are called control flow edges.
| Language | CFG Edges from a point | Types | ||
|---|---|---|---|---|
| Intraprocedural | Interprocedural | CFG Edge | CFG Edge Set | |
| C++ | point::cfg_targets() | point::cfg_inter_targets() | typedef cfg_edge | class cfg_edge_set |
| Python | point.cfg_targets() | point.cfg_inter_targets() | pair (point, edge_label) | class cfg_edge_set |
| C | cs_pdg_vertex_cfg_targets() | cs_pdg_vertex_cfg_inter_targets() | typedef cs_cfg_edge | typedef cs_cfg_edge_set, typedef cs_const_cfg_edge_set |
Example C/C++ CFGs are provided in section Control Flow Graphs for C/C++ Programs.
See also:
To report problems with this documentation, please visit https://support.codesecure.com/.